zig-pug 0.3.1 → 0.3.3
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/binding.gyp +16 -10
- package/index.js +20 -0
- package/index.mjs +19 -2
- package/install.js +58 -0
- package/package.json +9 -6
- package/prebuilts/darwin-arm64/libzig-pug.a +0 -0
- package/prebuilts/darwin-x64/libzig-pug.a +0 -0
- package/prebuilts/linux-arm64/libzig-pug.a +0 -0
- package/prebuilts/linux-x64/libzig-pug.a +0 -0
- package/prebuilts/win32-x64/zig-pug.lib +0 -0
- package/vendor/mujs/COPYING +0 -16
- package/vendor/mujs/README +0 -50
- package/vendor/mujs/astnames.h +0 -92
- package/vendor/mujs/jsarray.c +0 -832
- package/vendor/mujs/jsboolean.c +0 -38
- package/vendor/mujs/jsbuiltin.c +0 -249
- package/vendor/mujs/jscompile.c +0 -1428
- package/vendor/mujs/jsdate.c +0 -861
- package/vendor/mujs/jsdtoa.c +0 -749
- package/vendor/mujs/jserror.c +0 -139
- package/vendor/mujs/jsfunction.c +0 -231
- package/vendor/mujs/jsgc.c +0 -284
- package/vendor/mujs/jsi.h +0 -870
- package/vendor/mujs/jsintern.c +0 -137
- package/vendor/mujs/jslex.c +0 -878
- package/vendor/mujs/jsmath.c +0 -194
- package/vendor/mujs/jsnumber.c +0 -198
- package/vendor/mujs/jsobject.c +0 -560
- package/vendor/mujs/json.c +0 -422
- package/vendor/mujs/jsparse.c +0 -1065
- package/vendor/mujs/jsproperty.c +0 -341
- package/vendor/mujs/jsregexp.c +0 -232
- package/vendor/mujs/jsrepr.c +0 -285
- package/vendor/mujs/jsrun.c +0 -2096
- package/vendor/mujs/jsstate.c +0 -334
- package/vendor/mujs/jsstring.c +0 -852
- package/vendor/mujs/jsvalue.c +0 -708
- package/vendor/mujs/libmujs.a +0 -0
- package/vendor/mujs/main.c +0 -396
- package/vendor/mujs/mujs.h +0 -253
- package/vendor/mujs/one.c +0 -25
- package/vendor/mujs/opnames.h +0 -85
- package/vendor/mujs/pp.c +0 -980
- package/vendor/mujs/regexp.c +0 -1277
- package/vendor/mujs/regexp.h +0 -46
- package/vendor/mujs/utf.c +0 -305
- package/vendor/mujs/utf.h +0 -52
- package/vendor/mujs/utfdata.h +0 -2209
package/binding.gyp
CHANGED
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
{
|
|
4
4
|
"target_name": "zigpug",
|
|
5
5
|
"sources": [
|
|
6
|
-
"binding.c"
|
|
7
|
-
"vendor/mujs/one.c"
|
|
6
|
+
"binding.c"
|
|
8
7
|
],
|
|
9
8
|
"include_dirs": [
|
|
10
|
-
"include"
|
|
11
|
-
"vendor/mujs"
|
|
9
|
+
"include"
|
|
12
10
|
],
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
"conditions": [
|
|
12
|
+
["OS=='win'", {
|
|
13
|
+
"libraries": [
|
|
14
|
+
"<(module_root_dir)/prebuilts/win32-<(target_arch)/zig-pug.lib"
|
|
15
|
+
]
|
|
16
|
+
}, {
|
|
17
|
+
"libraries": [
|
|
18
|
+
"-lm",
|
|
19
|
+
"<(module_root_dir)/prebuilts/<(OS)-<(target_arch)/libzig-pug.a"
|
|
20
|
+
],
|
|
21
|
+
"cflags": [
|
|
22
|
+
"-std=c99"
|
|
23
|
+
]
|
|
24
|
+
}]
|
|
19
25
|
],
|
|
20
26
|
"defines": [
|
|
21
27
|
"NAPI_VERSION=8"
|
package/index.js
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
* Powered by Zig and mujs
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
// Check if native addon exists
|
|
10
|
+
const addonPath = path.join(__dirname, 'build', 'Release', 'zigpug.node');
|
|
11
|
+
if (!fs.existsSync(addonPath)) {
|
|
12
|
+
console.error('');
|
|
13
|
+
console.error('zig-pug native addon not found!');
|
|
14
|
+
console.error('');
|
|
15
|
+
console.error('The native addon needs to be built. Please run:');
|
|
16
|
+
console.error('');
|
|
17
|
+
console.error(' cd node_modules/zig-pug && npm run install');
|
|
18
|
+
console.error('');
|
|
19
|
+
console.error('Or if using Bun:');
|
|
20
|
+
console.error('');
|
|
21
|
+
console.error(' cd node_modules/zig-pug && bun run install');
|
|
22
|
+
console.error('');
|
|
23
|
+
throw new Error('zig-pug native addon not built. See instructions above.');
|
|
24
|
+
}
|
|
25
|
+
|
|
6
26
|
const binding = require('./build/Release/zigpug.node');
|
|
7
27
|
|
|
8
28
|
/**
|
package/index.mjs
CHANGED
|
@@ -5,13 +5,30 @@
|
|
|
5
5
|
|
|
6
6
|
import { createRequire } from 'module';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
|
-
import { dirname } from 'path';
|
|
9
|
-
import { readFileSync } from 'fs';
|
|
8
|
+
import { dirname, join } from 'path';
|
|
9
|
+
import { readFileSync, existsSync } from 'fs';
|
|
10
10
|
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = dirname(__filename);
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
14
14
|
|
|
15
|
+
// Check if native addon exists
|
|
16
|
+
const addonPath = join(__dirname, 'build', 'Release', 'zigpug.node');
|
|
17
|
+
if (!existsSync(addonPath)) {
|
|
18
|
+
console.error('');
|
|
19
|
+
console.error('zig-pug native addon not found!');
|
|
20
|
+
console.error('');
|
|
21
|
+
console.error('The native addon needs to be built. Please run:');
|
|
22
|
+
console.error('');
|
|
23
|
+
console.error(' cd node_modules/zig-pug && npm run install');
|
|
24
|
+
console.error('');
|
|
25
|
+
console.error('Or if using Bun:');
|
|
26
|
+
console.error('');
|
|
27
|
+
console.error(' cd node_modules/zig-pug && bun run install');
|
|
28
|
+
console.error('');
|
|
29
|
+
throw new Error('zig-pug native addon not built. See instructions above.');
|
|
30
|
+
}
|
|
31
|
+
|
|
15
32
|
const binding = require('./build/Release/zigpug.node');
|
|
16
33
|
|
|
17
34
|
/**
|
package/install.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Installation script for zig-pug
|
|
4
|
+
* Builds the native addon if it doesn't exist
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { execSync, spawnSync } = require('child_process');
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const addonPath = path.join(__dirname, 'build', 'Release', 'zigpug.node');
|
|
12
|
+
|
|
13
|
+
// Check if addon already exists
|
|
14
|
+
if (fs.existsSync(addonPath)) {
|
|
15
|
+
console.log('✓ zig-pug native addon already built');
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.log('Building zig-pug native addon...');
|
|
20
|
+
|
|
21
|
+
// Try to find node-gyp (local or global)
|
|
22
|
+
let nodeGyp = 'node-gyp';
|
|
23
|
+
|
|
24
|
+
// Check for local node-gyp first
|
|
25
|
+
const localNodeGyp = path.join(__dirname, 'node_modules', '.bin', 'node-gyp');
|
|
26
|
+
if (fs.existsSync(localNodeGyp)) {
|
|
27
|
+
nodeGyp = localNodeGyp;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
// Run node-gyp rebuild
|
|
32
|
+
const result = spawnSync(nodeGyp, ['rebuild'], {
|
|
33
|
+
cwd: __dirname,
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
shell: true
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (result.status !== 0) {
|
|
39
|
+
throw new Error(`node-gyp exited with code ${result.status}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log('✓ zig-pug native addon built successfully');
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('✗ Failed to build zig-pug native addon');
|
|
45
|
+
console.error('');
|
|
46
|
+
console.error('This package requires node-gyp and build tools to be installed.');
|
|
47
|
+
console.error('Please install node-gyp:');
|
|
48
|
+
console.error('');
|
|
49
|
+
console.error(' npm install -g node-gyp');
|
|
50
|
+
console.error('');
|
|
51
|
+
console.error('Or install it locally in this package:');
|
|
52
|
+
console.error('');
|
|
53
|
+
console.error(' cd node_modules/zig-pug && npm install');
|
|
54
|
+
console.error('');
|
|
55
|
+
console.error('For more information: https://github.com/nodejs/node-gyp#installation');
|
|
56
|
+
console.error('');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zig-pug",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "High-performance Pug template engine powered by Zig and mujs. Native N-API addon with ES5.1 JavaScript support, full UTF-8 (emoji, accents), documentation comments (//!), and fast compilation. Compatible with Node.js and Bun.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"install": "node
|
|
14
|
+
"install": "node install.js",
|
|
15
|
+
"postinstall": "node install.js",
|
|
15
16
|
"build": "node-gyp configure build",
|
|
16
17
|
"rebuild": "node-gyp rebuild",
|
|
17
18
|
"clean": "node-gyp clean",
|
|
18
19
|
"test": "node test/test.js",
|
|
19
|
-
"
|
|
20
|
+
"build-prebuilts": "./build-prebuilts.sh",
|
|
21
|
+
"prepublishOnly": "npm run build-prebuilts"
|
|
20
22
|
},
|
|
21
23
|
"keywords": [
|
|
22
24
|
"pug",
|
|
@@ -71,10 +73,10 @@
|
|
|
71
73
|
"engines": {
|
|
72
74
|
"node": ">=14.0.0"
|
|
73
75
|
},
|
|
74
|
-
"dependencies": {
|
|
75
|
-
"devDependencies": {
|
|
76
|
+
"dependencies": {
|
|
76
77
|
"node-gyp": "^10.0.0"
|
|
77
78
|
},
|
|
79
|
+
"devDependencies": {},
|
|
78
80
|
"gypfile": true,
|
|
79
81
|
"binary": {
|
|
80
82
|
"module_name": "zigpug",
|
|
@@ -84,12 +86,13 @@
|
|
|
84
86
|
"files": [
|
|
85
87
|
"index.js",
|
|
86
88
|
"index.mjs",
|
|
89
|
+
"install.js",
|
|
87
90
|
"binding.c",
|
|
88
91
|
"binding.gyp",
|
|
89
92
|
"common.gypi",
|
|
90
93
|
"README.md",
|
|
91
94
|
"LICENSE",
|
|
92
95
|
"include/",
|
|
93
|
-
"
|
|
96
|
+
"prebuilts/"
|
|
94
97
|
]
|
|
95
98
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/vendor/mujs/COPYING
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2013-2020 Artifex Software, Inc.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
copyright notice and this permission notice appear in all copies.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
14
|
-
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
|
package/vendor/mujs/README
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
MuJS: an embeddable Javascript interpreter in C.
|
|
2
|
-
|
|
3
|
-
ABOUT
|
|
4
|
-
|
|
5
|
-
MuJS is a lightweight Javascript interpreter designed for embedding in
|
|
6
|
-
other software to extend them with scripting capabilities.
|
|
7
|
-
|
|
8
|
-
LICENSE
|
|
9
|
-
|
|
10
|
-
MuJS is Copyright 2013-2017 Artifex Software, Inc.
|
|
11
|
-
|
|
12
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
14
|
-
copyright notice and this permission notice appear in all copies.
|
|
15
|
-
|
|
16
|
-
The software is provided "as is" and the author disclaims all warranties with
|
|
17
|
-
regard to this software including all implied warranties of merchantability
|
|
18
|
-
and fitness. In no event shall the author be liable for any special, direct,
|
|
19
|
-
indirect, or consequential damages or any damages whatsoever resulting from
|
|
20
|
-
loss of use, data or profits, whether in an action of contract, negligence
|
|
21
|
-
or other tortious action, arising out of or in connection with the use or
|
|
22
|
-
performance of this software.
|
|
23
|
-
|
|
24
|
-
COMPILING
|
|
25
|
-
|
|
26
|
-
If you are building from source you can either use the provided Unix Makefile:
|
|
27
|
-
|
|
28
|
-
make release
|
|
29
|
-
|
|
30
|
-
Or compile the source with your preferred compiler:
|
|
31
|
-
|
|
32
|
-
cc -O2 -c one.c -o libmujs.o
|
|
33
|
-
|
|
34
|
-
INSTALLING
|
|
35
|
-
|
|
36
|
-
To install the MuJS command line interpreter, static library and header file:
|
|
37
|
-
|
|
38
|
-
make prefix=/usr/local install
|
|
39
|
-
|
|
40
|
-
DOWNLOAD
|
|
41
|
-
|
|
42
|
-
The latest development source is available directly from the git repository:
|
|
43
|
-
|
|
44
|
-
git clone http://git.ghostscript.com/mujs.git
|
|
45
|
-
|
|
46
|
-
REPORTING BUGS AND PROBLEMS
|
|
47
|
-
|
|
48
|
-
Report bugs on the ghostscript bugzilla, with MuJS as the selected component.
|
|
49
|
-
|
|
50
|
-
http://bugs.ghostscript.com/
|
package/vendor/mujs/astnames.h
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"list",
|
|
2
|
-
"fundec",
|
|
3
|
-
"identifier",
|
|
4
|
-
"exp_identifier",
|
|
5
|
-
"exp_number",
|
|
6
|
-
"exp_string",
|
|
7
|
-
"exp_regexp",
|
|
8
|
-
"exp_elision",
|
|
9
|
-
"exp_null",
|
|
10
|
-
"exp_true",
|
|
11
|
-
"exp_false",
|
|
12
|
-
"exp_this",
|
|
13
|
-
"exp_array",
|
|
14
|
-
"exp_object",
|
|
15
|
-
"exp_prop_val",
|
|
16
|
-
"exp_prop_get",
|
|
17
|
-
"exp_prop_set",
|
|
18
|
-
"exp_fun",
|
|
19
|
-
"exp_index",
|
|
20
|
-
"exp_member",
|
|
21
|
-
"exp_call",
|
|
22
|
-
"exp_new",
|
|
23
|
-
"exp_postinc",
|
|
24
|
-
"exp_postdec",
|
|
25
|
-
"exp_delete",
|
|
26
|
-
"exp_void",
|
|
27
|
-
"exp_typeof",
|
|
28
|
-
"exp_preinc",
|
|
29
|
-
"exp_predec",
|
|
30
|
-
"exp_pos",
|
|
31
|
-
"exp_neg",
|
|
32
|
-
"exp_bitnot",
|
|
33
|
-
"exp_lognot",
|
|
34
|
-
"exp_mod",
|
|
35
|
-
"exp_div",
|
|
36
|
-
"exp_mul",
|
|
37
|
-
"exp_sub",
|
|
38
|
-
"exp_add",
|
|
39
|
-
"exp_ushr",
|
|
40
|
-
"exp_shr",
|
|
41
|
-
"exp_shl",
|
|
42
|
-
"exp_in",
|
|
43
|
-
"exp_instanceof",
|
|
44
|
-
"exp_ge",
|
|
45
|
-
"exp_le",
|
|
46
|
-
"exp_gt",
|
|
47
|
-
"exp_lt",
|
|
48
|
-
"exp_strictne",
|
|
49
|
-
"exp_stricteq",
|
|
50
|
-
"exp_ne",
|
|
51
|
-
"exp_eq",
|
|
52
|
-
"exp_bitand",
|
|
53
|
-
"exp_bitxor",
|
|
54
|
-
"exp_bitor",
|
|
55
|
-
"exp_logand",
|
|
56
|
-
"exp_logor",
|
|
57
|
-
"exp_cond",
|
|
58
|
-
"exp_ass",
|
|
59
|
-
"exp_ass_mul",
|
|
60
|
-
"exp_ass_div",
|
|
61
|
-
"exp_ass_mod",
|
|
62
|
-
"exp_ass_add",
|
|
63
|
-
"exp_ass_sub",
|
|
64
|
-
"exp_ass_shl",
|
|
65
|
-
"exp_ass_shr",
|
|
66
|
-
"exp_ass_ushr",
|
|
67
|
-
"exp_ass_bitand",
|
|
68
|
-
"exp_ass_bitxor",
|
|
69
|
-
"exp_ass_bitor",
|
|
70
|
-
"exp_comma",
|
|
71
|
-
"exp_var",
|
|
72
|
-
"stm_block",
|
|
73
|
-
"stm_empty",
|
|
74
|
-
"stm_var",
|
|
75
|
-
"stm_if",
|
|
76
|
-
"stm_do",
|
|
77
|
-
"stm_while",
|
|
78
|
-
"stm_for",
|
|
79
|
-
"stm_for_var",
|
|
80
|
-
"stm_for_in",
|
|
81
|
-
"stm_for_in_var",
|
|
82
|
-
"stm_continue",
|
|
83
|
-
"stm_break",
|
|
84
|
-
"stm_return",
|
|
85
|
-
"stm_with",
|
|
86
|
-
"stm_switch",
|
|
87
|
-
"stm_throw",
|
|
88
|
-
"stm_try",
|
|
89
|
-
"stm_debugger",
|
|
90
|
-
"stm_label",
|
|
91
|
-
"stm_case",
|
|
92
|
-
"stm_default",
|