@danielx/civet 0.6.86 → 0.6.88
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/README.md +3 -4
- package/dist/browser.js +607 -254
- package/dist/civet +106 -10
- package/dist/esm.mjs +0 -11
- package/dist/main.js +607 -254
- package/dist/main.mjs +607 -254
- package/package.json +2 -2
- package/register.js +20 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.88",
|
|
5
5
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/main.mjs",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@prettier/sync": "^0.3.0",
|
|
76
76
|
"@types/assert": "^1.5.6",
|
|
77
77
|
"@types/mocha": "^9.1.1",
|
|
78
|
-
"@types/node": "^20.
|
|
78
|
+
"@types/node": "^20.12.2",
|
|
79
79
|
"c8": "^7.12.0",
|
|
80
80
|
"esbuild": "0.20.0",
|
|
81
81
|
"marked": "^4.2.4",
|
package/register.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
@file Civet CJS registration
|
|
2
|
+
@file Civet CJS and ESM registration
|
|
3
3
|
|
|
4
|
-
`
|
|
5
|
-
|
|
4
|
+
`import`ing this file in Node 20.6.0+ will register the `.civet` extension
|
|
5
|
+
for both ESM `import`s and CJS `require`s.
|
|
6
|
+
|
|
7
|
+
@example
|
|
8
|
+
```bash
|
|
9
|
+
node --import @danielx/civet/register source.civet
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
On older Node, `require`ing this file will register the `.civet` extension
|
|
13
|
+
for CJS `require`s.
|
|
6
14
|
|
|
7
15
|
@example
|
|
8
16
|
```bash
|
|
@@ -10,17 +18,25 @@ node -r @danielx/civet/register source.civet
|
|
|
10
18
|
```
|
|
11
19
|
*/
|
|
12
20
|
|
|
21
|
+
try {
|
|
22
|
+
const { register } = require('node:module');
|
|
23
|
+
const { pathToFileURL } = require('node:url');
|
|
24
|
+
|
|
25
|
+
register('./dist/esm.mjs', pathToFileURL(__filename));
|
|
26
|
+
} catch (e) {}
|
|
27
|
+
|
|
28
|
+
// CJS registration
|
|
13
29
|
if (require.extensions) {
|
|
14
30
|
const fs = require("fs");
|
|
15
31
|
const { compile } = require("./");
|
|
16
32
|
|
|
17
33
|
require.extensions[".civet"] = function (module, filename) {
|
|
18
34
|
const js = compile(fs.readFileSync(filename, 'utf8'), {
|
|
35
|
+
filename,
|
|
19
36
|
js: true,
|
|
20
37
|
inlineMap: true,
|
|
21
38
|
});
|
|
22
39
|
module._compile(js, filename);
|
|
23
|
-
return;
|
|
24
40
|
};
|
|
25
41
|
|
|
26
42
|
try {
|