Skip to content

Commit

Permalink
Windows fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Breck Yunits authored and Breck Yunits committed May 28, 2024
1 parent 4370617 commit 8b709fc
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 16 deletions.
9 changes: 7 additions & 2 deletions grammar/GrammarLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2781,10 +2781,15 @@ ${rootName}`
else exportScript = `window.${rootName} = ${rootName}`

let nodeJsImports = ``
if (forNodeJs)
if (forNodeJs) {
const path = require("path")
nodeJsImports = Object.keys(GlobalNamespaceAdditions)
.map(key => `const { ${key} } = require("${jtreeProductsPath}/${GlobalNamespaceAdditions[key]}")`)
.map(key => {
const thePath = jtreeProductsPath + "/" + GlobalNamespaceAdditions[key]
return `const { ${key} } = require("${thePath.replace(/\\/g, "\\\\")}")` // escape windows backslashes
})
.join("\n")
}

// todo: we can expose the previous "constants" export, if needed, via the grammar, which we preserve.
return `{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jtree",
"version": "77.1.0",
"version": "77.1.1",
"description": "Simplify your code with Tree Notation. This jtree package includes a Tree Notation parser, compiler-compiler, and virtual machine for Tree Languages, as well as sample languages, implemented in TypeScript.",
"types": "./built/jtree.node.d.ts",
"main": "./products/TreeNode.js",
Expand Down
9 changes: 7 additions & 2 deletions products/GrammarLanguage.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2248,10 +2248,15 @@ ${testCode}`
${rootName}`
else exportScript = `window.${rootName} = ${rootName}`
let nodeJsImports = ``
if (forNodeJs)
if (forNodeJs) {
const path = require("path")
nodeJsImports = Object.keys(GlobalNamespaceAdditions)
.map(key => `const { ${key} } = require("${jtreeProductsPath}/${GlobalNamespaceAdditions[key]}")`)
.map(key => {
const thePath = jtreeProductsPath + "/" + GlobalNamespaceAdditions[key]
return `const { ${key} } = require("${thePath.replace(/\\/g, "\\\\")}")` // escape windows backslashes
})
.join("\n")
}
// todo: we can expose the previous "constants" export, if needed, via the grammar, which we preserve.
return `{
${nodeJsImports}
Expand Down
9 changes: 7 additions & 2 deletions products/GrammarLanguage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2250,10 +2250,15 @@ ${testCode}`
${rootName}`
else exportScript = `window.${rootName} = ${rootName}`
let nodeJsImports = ``
if (forNodeJs)
if (forNodeJs) {
const path = require("path")
nodeJsImports = Object.keys(GlobalNamespaceAdditions)
.map(key => `const { ${key} } = require("${jtreeProductsPath}/${GlobalNamespaceAdditions[key]}")`)
.map(key => {
const thePath = jtreeProductsPath + "/" + GlobalNamespaceAdditions[key]
return `const { ${key} } = require("${thePath.replace(/\\/g, "\\\\")}")` // escape windows backslashes
})
.join("\n")
}
// todo: we can expose the previous "constants" export, if needed, via the grammar, which we preserve.
return `{
${nodeJsImports}
Expand Down
2 changes: 1 addition & 1 deletion products/TreeNode.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,7 @@ TreeNode.iris = `sepal_length,sepal_width,petal_length,petal_width,species
4.9,2.5,4.5,1.7,virginica
5.1,3.5,1.4,0.2,setosa
5,3.4,1.5,0.2,setosa`
TreeNode.getVersion = () => "77.1.0"
TreeNode.getVersion = () => "77.1.1"
class AbstractExtendibleTreeNode extends TreeNode {
_getFromExtended(firstWordPath) {
const hit = this._getNodeFromExtended(firstWordPath)
Expand Down
2 changes: 1 addition & 1 deletion products/TreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -2545,7 +2545,7 @@ TreeNode.iris = `sepal_length,sepal_width,petal_length,petal_width,species
4.9,2.5,4.5,1.7,virginica
5.1,3.5,1.4,0.2,setosa
5,3.4,1.5,0.2,setosa`
TreeNode.getVersion = () => "77.1.0"
TreeNode.getVersion = () => "77.1.1"
class AbstractExtendibleTreeNode extends TreeNode {
_getFromExtended(firstWordPath) {
const hit = this._getNodeFromExtended(firstWordPath)
Expand Down
15 changes: 9 additions & 6 deletions releaseNotes.scroll
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@ startColumns 4

Here's a list of the notable changes in JTree.

# 77.1.0 2023-5-13
# 77.1.1 2024-5-28
- 🏥 attempt a Windows bug fix

# 77.1.0 2024-5-13
- 🎉 TL Designer can now take a `programUrl` as well.

# 77.0.0 2023-5-08
# 77.0.0 2024-5-08
- 🎉 `assembleFile` (formerly `evaluateImports`) is now faster by stripping Parser Definitions from assembled files, using them only in the returned parsers. (There are still many speed improvements to be had here)
- ⚠️ BREAKING: The `TreeFileSystem.evaluateImports` method is now `TreeFileSystem.assembleFile`, and the interface of the returned object has changed.

# 76.2.0 2023-5-03
# 76.2.0 2024-5-03
- 🎉 only ship bare minimum files in npm package

# 76.1.0 2023-5-03
# 76.1.0 2024-5-03
- 🎉 only ship bare minimum files in npm package

# 76.0.0 2023-5-03
# 76.0.0 2024-5-03
- 🎉 all remaining dependencies moved to `devDependencies`

# 75.2.0 2023-5-03
# 75.2.0 2024-5-03
- 🎉 fewer dependencies

# 75.1.1 2023-5-11
Expand Down
2 changes: 1 addition & 1 deletion treeNode/TreeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3043,7 +3043,7 @@ class TreeNode extends AbstractNode {
return str ? indent + str.replace(/\n/g, indent) : ""
}

static getVersion = () => "77.1.0"
static getVersion = () => "77.1.1"

static fromDisk(path: string): TreeNode {
const format = this._getFileFormat(path)
Expand Down

0 comments on commit 8b709fc

Please sign in to comment.