@zenithbuild/bundler 0.6.10 → 0.6.12
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/package.json +9 -8
- package/scripts/render-assets.mjs +55 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenithbuild/bundler",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rm -rf dist && cargo build --release && tsc -p tsconfig.meta.json && node ../../scripts/stage-bundler-platform-package.mjs",
|
|
6
6
|
"contract:deps": "node dependency_contract.spec.js",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
|
-
"dist",
|
|
23
|
+
"dist/**",
|
|
24
|
+
"scripts/render-assets.mjs",
|
|
24
25
|
"package.json",
|
|
25
26
|
"README.md",
|
|
26
27
|
"LICENSE"
|
|
@@ -35,14 +36,14 @@
|
|
|
35
36
|
},
|
|
36
37
|
"homepage": "https://github.com/zenithbuild/framework#readme",
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@zenithbuild/router": "0.6.
|
|
39
|
-
"@zenithbuild/runtime": "0.6.
|
|
39
|
+
"@zenithbuild/router": "0.6.12",
|
|
40
|
+
"@zenithbuild/runtime": "0.6.12"
|
|
40
41
|
},
|
|
41
42
|
"optionalDependencies": {
|
|
42
|
-
"@zenithbuild/bundler-darwin-arm64": "0.6.
|
|
43
|
-
"@zenithbuild/bundler-darwin-x64": "0.6.
|
|
44
|
-
"@zenithbuild/bundler-linux-x64": "0.6.
|
|
45
|
-
"@zenithbuild/bundler-win32-x64": "0.6.
|
|
43
|
+
"@zenithbuild/bundler-darwin-arm64": "0.6.12",
|
|
44
|
+
"@zenithbuild/bundler-darwin-x64": "0.6.12",
|
|
45
|
+
"@zenithbuild/bundler-linux-x64": "0.6.12",
|
|
46
|
+
"@zenithbuild/bundler-win32-x64": "0.6.12"
|
|
46
47
|
},
|
|
47
48
|
"type": "module",
|
|
48
49
|
"private": false
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { runtimeModuleSource } from '@zenithbuild/runtime/template';
|
|
2
|
+
import { renderRouterModule } from '@zenithbuild/router/template';
|
|
3
|
+
|
|
4
|
+
const IR_VERSION = 1;
|
|
5
|
+
|
|
6
|
+
function normalizeNewlines(value) {
|
|
7
|
+
return String(value).replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async function readStdin() {
|
|
11
|
+
let data = '';
|
|
12
|
+
for await (const chunk of process.stdin) {
|
|
13
|
+
data += chunk;
|
|
14
|
+
}
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function main() {
|
|
19
|
+
const rawInput = await readStdin();
|
|
20
|
+
const parsed = rawInput.trim().length > 0 ? JSON.parse(rawInput) : {};
|
|
21
|
+
|
|
22
|
+
const manifestJson = typeof parsed.manifestJson === 'string'
|
|
23
|
+
? normalizeNewlines(parsed.manifestJson)
|
|
24
|
+
: '{}';
|
|
25
|
+
const runtimeImport = typeof parsed.runtimeImport === 'string' && parsed.runtimeImport.length > 0
|
|
26
|
+
? parsed.runtimeImport
|
|
27
|
+
: '/assets/runtime.placeholder.js';
|
|
28
|
+
const coreImport = typeof parsed.coreImport === 'string' && parsed.coreImport.length > 0
|
|
29
|
+
? parsed.coreImport
|
|
30
|
+
: '/assets/core.placeholder.js';
|
|
31
|
+
|
|
32
|
+
const runtimeSource = normalizeNewlines(runtimeModuleSource());
|
|
33
|
+
const routerSource = normalizeNewlines(
|
|
34
|
+
renderRouterModule({
|
|
35
|
+
manifestJson,
|
|
36
|
+
runtimeImport,
|
|
37
|
+
coreImport
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// Keep output key order deterministic.
|
|
42
|
+
const output = {
|
|
43
|
+
irVersion: IR_VERSION,
|
|
44
|
+
runtimeSource,
|
|
45
|
+
routerSource
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
process.stdout.write(JSON.stringify(output));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
main().catch((error) => {
|
|
52
|
+
const message = error instanceof Error ? error.stack || error.message : String(error);
|
|
53
|
+
process.stderr.write(`[render-assets] ${message}\n`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
});
|