@herb-tools/node 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +7 -1
- package/bin/vendor.cjs +103 -0
- package/dist/herb-node.esm.js +1 -1
- package/extension/libherb/include/version.h +1 -1
- package/extension/libherb/version.h +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.3.1 (2025-06-23)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 0.3.0 (2025-06-21)
|
|
6
|
+
|
|
7
|
+
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|
|
8
|
+
|
|
1
9
|
## 0.2.0 (2025-06-11)
|
|
2
10
|
|
|
3
11
|
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|
package/README.md
CHANGED
package/bin/vendor.cjs
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs")
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const { execSync } = require("child_process")
|
|
6
|
+
|
|
7
|
+
const prismDir = path.resolve(__dirname, "../extension/prism")
|
|
8
|
+
const prismExists = fs.existsSync(prismDir)
|
|
9
|
+
|
|
10
|
+
const libherbDir = path.resolve(__dirname, "../extension/libherb")
|
|
11
|
+
const libherbExists = fs.existsSync(libherbDir)
|
|
12
|
+
|
|
13
|
+
if (prismExists && libherbExists) {
|
|
14
|
+
console.log("Vendored folders already exist, skipping vendor")
|
|
15
|
+
console.log("Run `yarn clean` to remove them")
|
|
16
|
+
process.exit(0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const libherbSourceDir = path.resolve(__dirname, "../../../../src")
|
|
20
|
+
const libherbIncludeDir = path.resolve(libherbSourceDir, "include")
|
|
21
|
+
const libherbTargetDir = path.resolve(__dirname, "../extension/libherb")
|
|
22
|
+
|
|
23
|
+
const prismPath = execSync("bundle show prism").toString().trim()
|
|
24
|
+
console.log(`Found Prism at: ${prismPath}`)
|
|
25
|
+
|
|
26
|
+
const targetDir = path.resolve(__dirname, "../extension/prism")
|
|
27
|
+
const targetIncludeDir = path.resolve(targetDir, "include")
|
|
28
|
+
const targetSrcDir = path.resolve(targetDir, "src")
|
|
29
|
+
const targetUtilDir = path.resolve(targetSrcDir, "util")
|
|
30
|
+
|
|
31
|
+
function ensureDirectoryExists(dir) {
|
|
32
|
+
if (!fs.existsSync(dir)) {
|
|
33
|
+
console.log(`Creating directory: ${dir}`)
|
|
34
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ensureDirectoryExists(targetIncludeDir)
|
|
39
|
+
ensureDirectoryExists(targetSrcDir)
|
|
40
|
+
ensureDirectoryExists(targetUtilDir)
|
|
41
|
+
ensureDirectoryExists(libherbTargetDir)
|
|
42
|
+
|
|
43
|
+
function safeCopyFile(sourcePath, targetPath) {
|
|
44
|
+
try {
|
|
45
|
+
const stats = fs.statSync(sourcePath)
|
|
46
|
+
if (!stats.isFile()) {
|
|
47
|
+
console.log(`Skipping non-file: ${sourcePath}`)
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const content = fs.readFileSync(sourcePath)
|
|
52
|
+
fs.writeFileSync(targetPath, content)
|
|
53
|
+
console.log(`Copied: ${sourcePath} -> ${targetPath}`)
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(`Error copying ${sourcePath}: ${error.message}`)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function copyDirectory(sourceDir, targetDir) {
|
|
60
|
+
if (!fs.existsSync(sourceDir)) {
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
ensureDirectoryExists(targetDir)
|
|
65
|
+
|
|
66
|
+
const entries = fs.readdirSync(sourceDir, { withFileTypes: true })
|
|
67
|
+
|
|
68
|
+
for (const entry of entries) {
|
|
69
|
+
const sourcePath = path.join(sourceDir, entry.name)
|
|
70
|
+
const targetPath = path.join(targetDir, entry.name)
|
|
71
|
+
|
|
72
|
+
if (entry.isDirectory()) {
|
|
73
|
+
copyDirectory(sourcePath, targetPath)
|
|
74
|
+
} else if (entry.isFile()) {
|
|
75
|
+
safeCopyFile(sourcePath, targetPath)
|
|
76
|
+
} else {
|
|
77
|
+
console.log(`Skipping non-file/directory: ${sourcePath}`)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log("Vendoring Prism include files...")
|
|
83
|
+
const includeDir = path.join(prismPath, "include")
|
|
84
|
+
copyDirectory(includeDir, targetIncludeDir)
|
|
85
|
+
|
|
86
|
+
const prismHeader = path.join(prismPath, "src", "prism.h")
|
|
87
|
+
if (fs.existsSync(prismHeader)) {
|
|
88
|
+
safeCopyFile(prismHeader, path.join(targetIncludeDir, "prism.h"))
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
console.log("Vendoring Prism source files...")
|
|
92
|
+
const srcDir = path.join(prismPath, "src")
|
|
93
|
+
copyDirectory(srcDir, targetSrcDir)
|
|
94
|
+
|
|
95
|
+
console.log("Prism source files vendored successfully!")
|
|
96
|
+
|
|
97
|
+
console.log("Vendoring libherb source files...")
|
|
98
|
+
copyDirectory(libherbSourceDir, libherbTargetDir)
|
|
99
|
+
|
|
100
|
+
console.log("Vendoring libherb include files...")
|
|
101
|
+
copyDirectory(libherbIncludeDir, libherbTargetDir)
|
|
102
|
+
|
|
103
|
+
console.log("libherb files vendored successfully!")
|
package/dist/herb-node.esm.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herb-tools/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Native Node.js addon for HTML-aware ERB parsing using Herb.",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"homepage": "https://herb-tools.dev",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"host": "https://github.com/marcoroth/herb/releases/download/"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
|
-
"@herb-tools/core": "0.
|
|
51
|
+
"@herb-tools/core": "0.3.1",
|
|
51
52
|
"@mapbox/node-pre-gyp": "^2.0.0",
|
|
52
53
|
"node-addon-api": "^5.1.0",
|
|
53
54
|
"node-pre-gyp-github": "^2.0.0"
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"package.json",
|
|
57
58
|
"README.md",
|
|
58
59
|
"binding.gyp",
|
|
60
|
+
"bin/vendor.cjs",
|
|
59
61
|
"dist/",
|
|
60
62
|
"src/",
|
|
61
63
|
"extension/**/*.c",
|