Skip to content

Commit

Permalink
add export and fix commonjs issue with handlebars
Browse files Browse the repository at this point in the history
  • Loading branch information
capaj committed Apr 29, 2024
1 parent 13a5fb2 commit 4a2ee74
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dictionaries": [],
"words": [
"Aragorn",
"Evalles",
"Langtail",
"undici"
],
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "langtail",
"version": "0.3.0-beta.2",
"version": "0.3.0",
"description": "",
"main": "./dist/LangtailNode.js",
"packageManager": "[email protected]",
Expand Down Expand Up @@ -44,6 +44,11 @@
"require": "./dist/LangtailNode.js",
"import": "./dist/LangtailNode.mjs",
"types": "./dist/LangtailNode.d.ts"
},
"./dist/getOpenAIBody": {
"require": "./dist/getOpenAIBody.js",
"import": "./dist/getOpenAIBody.mjs",
"types": "./dist/getOpenAIBody.d.ts"
}
},
"files": [
Expand Down
6 changes: 4 additions & 2 deletions src/template.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import handlebars from "@langtail/handlebars-evalless"
import { Visitor } from "handlebars"
import * as handlebarsEvalles from "@langtail/handlebars-evalless"
import vanillaHandlebars from "handlebars"

import { handlebarsDateHelper, operatorHelpers } from "./handlebars-helpers"
import { JSONValue } from "./jsonType"
import { ContentArray } from "./schemas"

const handlebars = handlebarsEvalles.default
handlebars.registerHelper("$date", handlebarsDateHelper)
handlebars.registerHelper(operatorHelpers)
const Visitor = vanillaHandlebars.Visitor

/*
* This class is used to wrap the input object to be used in handlebars templates. Without this JSON objects are rendered as [object Object]
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/* Interop Constraints */
"declaration": true,
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,

"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,

/* Type Checking */
Expand Down

0 comments on commit 4a2ee74

Please sign in to comment.