@vmz/vmz 0.2.5 → 0.2.6
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/dist/host-materialize/serve-host-runtime.js +2 -0
- package/dist/workspace/delivery-runtime-files.d.ts +15 -0
- package/dist/workspace/delivery-runtime-files.js +34 -0
- package/dist/workspace/delivery-runtime-imports.d.ts +6 -0
- package/dist/workspace/delivery-runtime-imports.js +87 -0
- package/dist/workspace/pack.js +4 -31
- package/package.json +18 -17
|
@@ -24,6 +24,8 @@ export function materializeServeHostRuntime(outDir, coreDist = resolveCoreRuntim
|
|
|
24
24
|
if (entry.rewriteVmzRuntimeImport) {
|
|
25
25
|
const text = readFileSync(src, 'utf8')
|
|
26
26
|
.replace(/from\s+(['"])\.\/vmz-runtime\.js\1/g, 'from $1../../vmz-runtime.js$1')
|
|
27
|
+
.replace(/from\s+(['"])\.\.\/\.\.\/faces\/vmz-runtime\.js\1/g, 'from $1../../../vmz-runtime.js$1')
|
|
28
|
+
.replace(/from\s+(['"])\.\.\/\.\.\/faces\/server\.js\1/g, 'from $1../../../vmz-runtime.js$1')
|
|
27
29
|
.replace(/from\s+(['"])\.\.\/faces\/vmz-runtime\.js\1/g, 'from $1../../vmz-runtime.js$1')
|
|
28
30
|
.replace(/from\s+(['"])\.\.\/faces\/server\.js\1/g, 'from $1../../vmz-runtime.js$1');
|
|
29
31
|
writeFileSync(dst, text, 'utf8');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load packages/runtimes/vmz/delivery-runtime-files.json — sole browser/SSR delivery copy list.
|
|
3
|
+
*/
|
|
4
|
+
export type DeliveryRuntimeFileEntry = {
|
|
5
|
+
src: string;
|
|
6
|
+
out: string;
|
|
7
|
+
};
|
|
8
|
+
export type DeliveryRuntimeFilesManifest = {
|
|
9
|
+
schema: string;
|
|
10
|
+
flatBarrels: DeliveryRuntimeFileEntry[];
|
|
11
|
+
nested: DeliveryRuntimeFileEntry[];
|
|
12
|
+
};
|
|
13
|
+
export declare function loadDeliveryRuntimeFilesManifest(pathOverride?: string): DeliveryRuntimeFilesManifest;
|
|
14
|
+
/** All [src, out] pairs for materialize / pack. */
|
|
15
|
+
export declare function deliveryRuntimeFilePairs(manifest?: DeliveryRuntimeFilesManifest): ReadonlyArray<readonly [string, string]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load packages/runtimes/vmz/delivery-runtime-files.json — sole browser/SSR delivery copy list.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
const MANIFEST_BASENAME = 'delivery-runtime-files.json';
|
|
8
|
+
function manifestPathFromHere() {
|
|
9
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
return join(here, '..', '..', MANIFEST_BASENAME);
|
|
11
|
+
}
|
|
12
|
+
let cached = null;
|
|
13
|
+
export function loadDeliveryRuntimeFilesManifest(pathOverride) {
|
|
14
|
+
if (!pathOverride && cached)
|
|
15
|
+
return cached;
|
|
16
|
+
const p = pathOverride || manifestPathFromHere();
|
|
17
|
+
const raw = JSON.parse(readFileSync(p, 'utf8'));
|
|
18
|
+
if (raw.schema !== 'vmz.delivery-runtime-files.v0') {
|
|
19
|
+
throw new Error(`delivery-runtime-files: unexpected schema ${raw.schema}`);
|
|
20
|
+
}
|
|
21
|
+
if (!Array.isArray(raw.flatBarrels) || !raw.flatBarrels.length) {
|
|
22
|
+
throw new Error('delivery-runtime-files: flatBarrels empty');
|
|
23
|
+
}
|
|
24
|
+
if (!Array.isArray(raw.nested) || !raw.nested.length) {
|
|
25
|
+
throw new Error('delivery-runtime-files: nested empty');
|
|
26
|
+
}
|
|
27
|
+
if (!pathOverride)
|
|
28
|
+
cached = raw;
|
|
29
|
+
return raw;
|
|
30
|
+
}
|
|
31
|
+
/** All [src, out] pairs for materialize / pack. */
|
|
32
|
+
export function deliveryRuntimeFilePairs(manifest = loadDeliveryRuntimeFilesManifest()) {
|
|
33
|
+
return [...manifest.flatBarrels, ...manifest.nested].map((f) => [f.src, f.out]);
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite `@vmz/core` dist imports for flat app delivery layout.
|
|
3
|
+
* Keep in sync with `rewrite_delivery_imports` in vmz-compiler compile.rs.
|
|
4
|
+
*/
|
|
5
|
+
/** @param {string} text @param {string} outName delivery-relative output path */
|
|
6
|
+
export declare function rewriteDeliveryImports(text: string, outName: string): string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite `@vmz/core` dist imports for flat app delivery layout.
|
|
3
|
+
* Keep in sync with `rewrite_delivery_imports` in vmz-compiler compile.rs.
|
|
4
|
+
*/
|
|
5
|
+
function replaceImportPath(text, from, to) {
|
|
6
|
+
let out = text;
|
|
7
|
+
out = out.replaceAll(`'${from}'`, `'${to}'`);
|
|
8
|
+
out = out.replaceAll(`"${from}"`, `"${to}"`);
|
|
9
|
+
return out;
|
|
10
|
+
}
|
|
11
|
+
function replaceQuotedPrefix(text, from, to) {
|
|
12
|
+
let out = text;
|
|
13
|
+
out = out.replaceAll(`'${from}`, `'${to}`);
|
|
14
|
+
out = out.replaceAll(`"${from}`, `"${to}`);
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
function rewriteFlatDeliveryImports(text) {
|
|
18
|
+
let out = text;
|
|
19
|
+
const pairs = [
|
|
20
|
+
['../browser/dom-core.js', './dom-core.js'],
|
|
21
|
+
['../browser/direct-host-box.js', './direct-host-box.js'],
|
|
22
|
+
['../browser/unknown-component.js', './unknown-component.js'],
|
|
23
|
+
['../shared/dom-attr-normalize.js', './dom-attr-normalize.js'],
|
|
24
|
+
['../browser/client-nav.js', './vmz-client-nav.js'],
|
|
25
|
+
['../ssr/dom-ssr.js', './dom-ssr.js'],
|
|
26
|
+
['../faces/server.js', './vmz-runtime.js'],
|
|
27
|
+
['../faces/vmz-runtime.js', './vmz-runtime.js'],
|
|
28
|
+
['../faces/http.js', './vmz-http.js'],
|
|
29
|
+
];
|
|
30
|
+
for (const [from, to] of pairs) {
|
|
31
|
+
out = replaceImportPath(out, from, to);
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
function rewriteNestedSsrDelivery(text) {
|
|
36
|
+
let out = text;
|
|
37
|
+
for (const [from, to] of [
|
|
38
|
+
['../browser/dom-core.js', '../dom-core.js'],
|
|
39
|
+
['../browser/direct-host-box.js', '../direct-host-box.js'],
|
|
40
|
+
['../browser/unknown-component.js', '../unknown-component.js'],
|
|
41
|
+
]) {
|
|
42
|
+
out = replaceImportPath(out, from, to);
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
function rewriteNestedBrowserDelivery(text) {
|
|
47
|
+
let out = replaceImportPath(text, '../../shared/dom-attr-normalize.js', '../../dom-attr-normalize.js');
|
|
48
|
+
for (const [from, to] of [
|
|
49
|
+
['../direct-host-box.js', '../../direct-host-box.js'],
|
|
50
|
+
['../unknown-component.js', '../../unknown-component.js'],
|
|
51
|
+
['../dom-core.js', '../../dom-core.js'],
|
|
52
|
+
]) {
|
|
53
|
+
out = replaceImportPath(out, from, to);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
function rewriteFlatDeliveryRoot(text, outName) {
|
|
58
|
+
let out = rewriteFlatDeliveryImports(text);
|
|
59
|
+
if (outName === 'dom-core.js') {
|
|
60
|
+
for (const [from, to] of [
|
|
61
|
+
['./diagnostics/', './browser/diagnostics/'],
|
|
62
|
+
['./dom/', './browser/dom/'],
|
|
63
|
+
['./reactivity/', './browser/reactivity/'],
|
|
64
|
+
]) {
|
|
65
|
+
out = replaceQuotedPrefix(out, from, to);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else if (outName === 'dom-ssr.js') {
|
|
69
|
+
out = replaceImportPath(out, './render.js', './ssr/render.js');
|
|
70
|
+
out = replaceQuotedPrefix(out, '../browser/resume/', './browser/resume/');
|
|
71
|
+
}
|
|
72
|
+
else if (outName === 'vmz-client-nav.js') {
|
|
73
|
+
out = replaceQuotedPrefix(out, './navigation/', './browser/navigation/');
|
|
74
|
+
}
|
|
75
|
+
else if (outName === 'dom.browser.js') {
|
|
76
|
+
out = replaceQuotedPrefix(out, '../browser/resume/', './browser/resume/');
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/** @param {string} text @param {string} outName delivery-relative output path */
|
|
81
|
+
export function rewriteDeliveryImports(text, outName) {
|
|
82
|
+
if (outName.startsWith('ssr/'))
|
|
83
|
+
return rewriteNestedSsrDelivery(text);
|
|
84
|
+
if (outName.startsWith('browser/'))
|
|
85
|
+
return rewriteNestedBrowserDelivery(text);
|
|
86
|
+
return rewriteFlatDeliveryRoot(text, outName);
|
|
87
|
+
}
|
package/dist/workspace/pack.js
CHANGED
|
@@ -8,28 +8,10 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { loadDeploymentIr, planBundleInputs } from './bundler-adapter.js';
|
|
10
10
|
import { packClientBareImports } from './pack-client-packages.js';
|
|
11
|
+
import { deliveryRuntimeFilePairs } from './delivery-runtime-files.js';
|
|
12
|
+
import { rewriteDeliveryImports } from './delivery-runtime-imports.js';
|
|
11
13
|
import { writePrettyJsonFile } from './pretty-json.js';
|
|
12
14
|
export const PACK_MANIFEST_SCHEMA = 'vmz.pack.manifest.v0';
|
|
13
|
-
/** Keep in sync with `rewrite_flat_delivery_imports` in vmz-compiler compile.rs. */
|
|
14
|
-
function rewriteFlatDeliveryImports(text) {
|
|
15
|
-
let out = text;
|
|
16
|
-
const pairs = [
|
|
17
|
-
['../browser/dom-core.js', './dom-core.js'],
|
|
18
|
-
['../browser/direct-host-box.js', './direct-host-box.js'],
|
|
19
|
-
['../browser/unknown-component.js', './unknown-component.js'],
|
|
20
|
-
['../shared/dom-attr-normalize.js', './dom-attr-normalize.js'],
|
|
21
|
-
['../browser/client-nav.js', './vmz-client-nav.js'],
|
|
22
|
-
['../ssr/dom-ssr.js', './dom-ssr.js'],
|
|
23
|
-
['../faces/server.js', './vmz-runtime.js'],
|
|
24
|
-
['../faces/vmz-runtime.js', './vmz-runtime.js'],
|
|
25
|
-
['../faces/http.js', './vmz-http.js'],
|
|
26
|
-
];
|
|
27
|
-
for (const [from, to] of pairs) {
|
|
28
|
-
out = out.replaceAll(`'${from}'`, `'${to}'`);
|
|
29
|
-
out = out.replaceAll(`"${from}"`, `"${to}"`);
|
|
30
|
-
}
|
|
31
|
-
return out;
|
|
32
|
-
}
|
|
33
15
|
/**
|
|
34
16
|
* Ensure dom split companions sit next to vmz-dom.js (barrel imports ./dom-core.js).
|
|
35
17
|
* Always refresh from `@vmz/core` when present so SSR/runtime fixes are not sticky in outDir.
|
|
@@ -40,22 +22,13 @@ function rewriteFlatDeliveryImports(text) {
|
|
|
40
22
|
export function ensureRuntimeCompanions(outDir, coreDist) {
|
|
41
23
|
if (!coreDist)
|
|
42
24
|
return [];
|
|
43
|
-
const companions = [
|
|
44
|
-
['browser/dom-core.js', 'dom-core.js'],
|
|
45
|
-
['ssr/dom-ssr.js', 'dom-ssr.js'],
|
|
46
|
-
['faces/dom.client.js', 'dom.client.js'],
|
|
47
|
-
['faces/dom.browser.js', 'dom.browser.js'],
|
|
48
|
-
['browser/direct-host-box.js', 'direct-host-box.js'],
|
|
49
|
-
['browser/unknown-component.js', 'unknown-component.js'],
|
|
50
|
-
['shared/dom-attr-normalize.js', 'dom-attr-normalize.js'],
|
|
51
|
-
];
|
|
52
25
|
const copied = [];
|
|
53
|
-
for (const [srcRel, outName] of
|
|
26
|
+
for (const [srcRel, outName] of deliveryRuntimeFilePairs()) {
|
|
54
27
|
const src = path.join(coreDist, srcRel);
|
|
55
28
|
if (!existsSync(src))
|
|
56
29
|
continue;
|
|
57
30
|
const dest = path.join(outDir, outName);
|
|
58
|
-
const text =
|
|
31
|
+
const text = rewriteDeliveryImports(readFileSync(src, 'utf8'), outName);
|
|
59
32
|
mkdirSync(path.dirname(dest), { recursive: true });
|
|
60
33
|
writeFileSync(dest, text);
|
|
61
34
|
copied.push(outName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmz/vmz",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "VMZ Node toolchain — N-API workspace session + CLI (publish name @vmz/vmz)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@vmz/commander": "0.2.
|
|
52
|
-
"@vmz/core": "0.2.
|
|
53
|
-
"@vmz/diagnostic": "0.2.
|
|
54
|
-
"@vmz/plugin": "0.2.
|
|
55
|
-
"@vmz/protocol": "0.2.
|
|
51
|
+
"@vmz/commander": "0.2.6",
|
|
52
|
+
"@vmz/core": "0.2.6",
|
|
53
|
+
"@vmz/diagnostic": "0.2.6",
|
|
54
|
+
"@vmz/plugin": "0.2.6",
|
|
55
|
+
"@vmz/protocol": "0.2.6",
|
|
56
56
|
"jiti": "^2.6.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@vmz/plugin-markdown-it": "0.2.
|
|
60
|
-
"@vmz/test": "0.2.
|
|
59
|
+
"@vmz/plugin-markdown-it": "0.2.6",
|
|
60
|
+
"@vmz/test": "0.2.6",
|
|
61
61
|
"typescript": "^5.8.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
@@ -85,6 +85,10 @@
|
|
|
85
85
|
"verify:list": "node --import ../../../scripts/test/resolve-ts-from-js.mjs --experimental-strip-types ./tests/conformance/run.ts --list",
|
|
86
86
|
"build:js": "node ../../../scripts/build/clean-package-dist.mjs packages/runtimes/vmz/dist && tsc -p tsconfig.json"
|
|
87
87
|
},
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"access": "public",
|
|
90
|
+
"name": "@vmz/vmz"
|
|
91
|
+
},
|
|
88
92
|
"keywords": [
|
|
89
93
|
"vmz",
|
|
90
94
|
"napi",
|
|
@@ -92,15 +96,12 @@
|
|
|
92
96
|
"cli"
|
|
93
97
|
],
|
|
94
98
|
"optionalDependencies": {
|
|
95
|
-
"@vmz/vmz-win32-x64": "0.2.
|
|
96
|
-
"@vmz/vmz-win32-arm64": "0.2.
|
|
97
|
-
"@vmz/vmz-darwin-x64": "0.2.
|
|
98
|
-
"@vmz/vmz-darwin-arm64": "0.2.
|
|
99
|
-
"@vmz/vmz-linux-x64": "0.2.
|
|
100
|
-
"@vmz/vmz-linux-arm64": "0.2.
|
|
101
|
-
},
|
|
102
|
-
"publishConfig": {
|
|
103
|
-
"access": "public"
|
|
99
|
+
"@vmz/vmz-win32-x64": "0.2.6",
|
|
100
|
+
"@vmz/vmz-win32-arm64": "0.2.6",
|
|
101
|
+
"@vmz/vmz-darwin-x64": "0.2.6",
|
|
102
|
+
"@vmz/vmz-darwin-arm64": "0.2.6",
|
|
103
|
+
"@vmz/vmz-linux-x64": "0.2.6",
|
|
104
|
+
"@vmz/vmz-linux-arm64": "0.2.6"
|
|
104
105
|
},
|
|
105
106
|
"repository": {
|
|
106
107
|
"type": "git",
|