@supertape/loader-jsx 1.0.2 → 1.0.4
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/lib/jsx.js +14 -5
- package/package.json +2 -3
package/lib/jsx.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Buffer} from 'node:buffer';
|
|
1
2
|
import {transformSync} from 'oxc-transform';
|
|
2
3
|
|
|
3
4
|
export function resolve(specifier, context, nextResolve) {
|
|
@@ -21,21 +22,29 @@ export function load(url, context, nextLoad) {
|
|
|
21
22
|
|
|
22
23
|
return {
|
|
23
24
|
format: 'module',
|
|
24
|
-
source: jsxToJs(String(source)),
|
|
25
|
-
shortCircuit: true,
|
|
25
|
+
source: jsxToJs(url, String(source)),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
return nextLoad(url, context);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function jsxToJs(source) {
|
|
33
|
-
const {
|
|
32
|
+
export function jsxToJs(url, source) {
|
|
33
|
+
const {
|
|
34
|
+
errors,
|
|
35
|
+
code,
|
|
36
|
+
map,
|
|
37
|
+
} = transformSync(url, source, {
|
|
38
|
+
sourcemap: true,
|
|
34
39
|
lang: 'jsx',
|
|
35
40
|
});
|
|
36
41
|
|
|
37
42
|
if (errors.length)
|
|
38
43
|
throw Error(errors[0].message);
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
const mapBase64 = Buffer
|
|
46
|
+
.from(JSON.stringify(map))
|
|
47
|
+
.toString('base64');
|
|
48
|
+
|
|
49
|
+
return `${code}\n//# sourceMappingURL=data:application/json;base64,${mapBase64}`;
|
|
41
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supertape/loader-jsx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "📼Supertape loader jsx",
|
|
6
6
|
"homepage": "http://github.com/coderaiser/supertape/tree/master/packages/loader-jsx",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"wisdom": "madrun wisdom"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"oxc-transform": "^0.
|
|
26
|
+
"oxc-transform": "^0.139.0"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"formatter",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"madrun": "^13.0.0",
|
|
38
38
|
"montag": "^2.0.1",
|
|
39
39
|
"nodemon": "^3.0.1",
|
|
40
|
-
"pullout": "^5.0.1",
|
|
41
40
|
"putout": "^42.0.17",
|
|
42
41
|
"superc8": "^12.0.0",
|
|
43
42
|
"supertape": "^13.0.0",
|