@vmz/vmz 0.1.11 → 0.1.13
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/build-assemble.js +3 -4
- package/dist/cdn-policy.js +4 -5
- package/dist/cli.js +15 -50
- package/dist/content-addressed-assets.d.ts +2 -8
- package/dist/content-addressed-assets.js +34 -110
- package/dist/delivery-profile.d.ts +1 -11
- package/dist/delivery-profile.js +1 -70
- package/dist/dev-session.d.ts +0 -1
- package/dist/dev-session.js +64 -220
- package/dist/document-build.js +34 -61
- package/dist/document-cmd.js +9 -2
- package/dist/document-enrich.d.ts +1 -2
- package/dist/document-enrich.js +4 -15
- package/dist/document-integrate.js +21 -28
- package/dist/embedded-packaging.js +1 -2
- package/dist/index.d.ts +1 -15
- package/dist/index.js +3 -58
- package/dist/locale-check.js +61 -28
- package/dist/locale-cmd.js +42 -10
- package/dist/locale-route-emit.d.ts +1 -4
- package/dist/locale-route-emit.js +32 -7
- package/dist/locale-router.js +8 -26
- package/dist/pack.js +2 -3
- package/dist/production-observability.js +2 -3
- package/dist/production-test-pack.js +3 -4
- package/dist/release-pack.js +18 -5
- package/dist/server-artifact.js +3 -4
- package/dist/site-delivery.js +3 -4
- package/dist/static-emit.js +78 -116
- package/dist/test-cmd.js +1 -2
- package/package.json +12 -12
- package/dist/dev-watch-roots.d.ts +0 -67
- package/dist/dev-watch-roots.js +0 -220
- package/dist/document-host-chrome.d.ts +0 -28
- package/dist/document-host-chrome.js +0 -128
- package/dist/native-addon.d.ts +0 -9
- package/dist/native-addon.js +0 -84
- package/dist/pretty-json.d.ts +0 -19
- package/dist/pretty-json.js +0 -43
- package/dist/route-path.d.ts +0 -35
- package/dist/route-path.js +0 -77
- package/dist/wechat-packaging.d.ts +0 -22
- package/dist/wechat-packaging.js +0 -59
package/dist/route-path.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser HTTP path projection from Route Graph / `vmz-deployment.json`.
|
|
3
|
-
* Mini pack ignores this and lowers RouteId → chunk id → page stem.
|
|
4
|
-
*/
|
|
5
|
-
export declare function isRouteBoundaryStem(stem: string): boolean;
|
|
6
|
-
export declare function isRouteGroupDir(seg: string): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* File-route fallback (`pages/home` → `/home`, `pages/index` → `/`).
|
|
9
|
-
* Used only when a deployment unit has no `pathPattern`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function filePathPatternFromChunk(chunkId: string): string;
|
|
12
|
-
export type DeploymentPageUnit = {
|
|
13
|
-
kind?: string;
|
|
14
|
-
chunkId?: string;
|
|
15
|
-
clientEntry?: string;
|
|
16
|
-
programIr?: string;
|
|
17
|
-
pathPattern?: string;
|
|
18
|
-
routeId?: string;
|
|
19
|
-
};
|
|
20
|
-
/** Canonical Browser HTTP pattern for a page unit. Mini must not read this. */
|
|
21
|
-
export declare function unitBrowserPathPattern(unit: DeploymentPageUnit | null | undefined): string;
|
|
22
|
-
export type PathSeg = {
|
|
23
|
-
kind: 'static';
|
|
24
|
-
value: string;
|
|
25
|
-
} | {
|
|
26
|
-
kind: 'param';
|
|
27
|
-
name: string;
|
|
28
|
-
} | {
|
|
29
|
-
kind: 'catch';
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
32
|
-
export declare function parsePathPattern(pattern: string): PathSeg[];
|
|
33
|
-
export declare function listPublicPageUnits(deployment: {
|
|
34
|
-
units?: DeploymentPageUnit[];
|
|
35
|
-
} | null | undefined): DeploymentPageUnit[];
|
package/dist/route-path.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser HTTP path projection from Route Graph / `vmz-deployment.json`.
|
|
3
|
-
* Mini pack ignores this and lowers RouteId → chunk id → page stem.
|
|
4
|
-
*/
|
|
5
|
-
export function isRouteBoundaryStem(stem) {
|
|
6
|
-
return stem === 'Layout' || stem === 'Loading' || stem === 'Error' || stem === 'NotFound';
|
|
7
|
-
}
|
|
8
|
-
export function isRouteGroupDir(seg) {
|
|
9
|
-
return typeof seg === 'string' && seg.startsWith('(') && seg.endsWith(')') && seg.length > 2;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* File-route fallback (`pages/home` → `/home`, `pages/index` → `/`).
|
|
13
|
-
* Used only when a deployment unit has no `pathPattern`.
|
|
14
|
-
*/
|
|
15
|
-
export function filePathPatternFromChunk(chunkId) {
|
|
16
|
-
const rel = String(chunkId || '').replace(/^pages\//, '');
|
|
17
|
-
const parts = rel.split('/').filter(Boolean);
|
|
18
|
-
const segs = [];
|
|
19
|
-
for (let i = 0; i < parts.length; i++) {
|
|
20
|
-
const p = parts[i];
|
|
21
|
-
if (isRouteGroupDir(p))
|
|
22
|
-
continue;
|
|
23
|
-
if (p === 'index' && i === parts.length - 1)
|
|
24
|
-
continue;
|
|
25
|
-
if (isRouteBoundaryStem(p))
|
|
26
|
-
continue;
|
|
27
|
-
segs.push(p);
|
|
28
|
-
}
|
|
29
|
-
return segs.length ? `/${segs.join('/')}` : '/';
|
|
30
|
-
}
|
|
31
|
-
/** Canonical Browser HTTP pattern for a page unit. Mini must not read this. */
|
|
32
|
-
export function unitBrowserPathPattern(unit) {
|
|
33
|
-
const explicit = String(unit?.pathPattern || '').trim();
|
|
34
|
-
if (explicit)
|
|
35
|
-
return explicit.startsWith('/') ? explicit : `/${explicit}`;
|
|
36
|
-
return filePathPatternFromChunk(String(unit?.chunkId || ''));
|
|
37
|
-
}
|
|
38
|
-
export function parsePathPattern(pattern) {
|
|
39
|
-
const raw = String(pattern || '').trim();
|
|
40
|
-
if (!raw || raw === '/')
|
|
41
|
-
return [];
|
|
42
|
-
const parts = raw.replace(/^\/+/, '').replace(/\/+$/, '').split('/').filter(Boolean);
|
|
43
|
-
const segs = [];
|
|
44
|
-
for (const p of parts) {
|
|
45
|
-
if (isRouteGroupDir(p))
|
|
46
|
-
continue;
|
|
47
|
-
segs.push(parsePathSegment(p));
|
|
48
|
-
}
|
|
49
|
-
return segs;
|
|
50
|
-
}
|
|
51
|
-
function parsePathSegment(p) {
|
|
52
|
-
const catchAll = /^\[\.\.\.([^\]]+)\]$/.exec(p);
|
|
53
|
-
const star = /^\*([A-Za-z_][\w]*)$/.exec(p);
|
|
54
|
-
const param = /^\[([^\]]+)\]$/.exec(p);
|
|
55
|
-
const colon = /^:([A-Za-z_][\w]*)$/.exec(p);
|
|
56
|
-
if (catchAll)
|
|
57
|
-
return { kind: 'catch', name: catchAll[1] };
|
|
58
|
-
if (star)
|
|
59
|
-
return { kind: 'catch', name: star[1] };
|
|
60
|
-
if (param)
|
|
61
|
-
return { kind: 'param', name: param[1] };
|
|
62
|
-
if (colon)
|
|
63
|
-
return { kind: 'param', name: colon[1] };
|
|
64
|
-
return { kind: 'static', value: p.toLowerCase() };
|
|
65
|
-
}
|
|
66
|
-
export function listPublicPageUnits(deployment) {
|
|
67
|
-
const units = Array.isArray(deployment?.units) ? deployment.units : [];
|
|
68
|
-
return units.filter((u) => {
|
|
69
|
-
if (u?.kind !== 'page')
|
|
70
|
-
return false;
|
|
71
|
-
const chunkId = String(u.chunkId || '').replace(/\\/g, '/');
|
|
72
|
-
if (!chunkId.startsWith('pages/'))
|
|
73
|
-
return false;
|
|
74
|
-
const stem = chunkId.split('/').pop() || '';
|
|
75
|
-
return !isRouteBoundaryStem(stem);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Materialize `defineConfig({ delivery: { packaging: { wechat } } })` for wechat_pack.
|
|
3
|
-
* Pure data only. Writes `dist/_vmz/wechat-packaging.json` (not a second config entry).
|
|
4
|
-
*/
|
|
5
|
-
export declare const WECHAT_PACKAGING_SCHEMA = "vmz.target.wechat_packaging.v0";
|
|
6
|
-
export declare const WECHAT_PACKAGING_REL = "dist/_vmz/wechat-packaging.json";
|
|
7
|
-
/**
|
|
8
|
-
* @param {unknown} delivery
|
|
9
|
-
* @returns {{ schema: string, appId: string, projectName?: string, title?: string }}
|
|
10
|
-
*/
|
|
11
|
-
export declare function wechatPackagingFromDelivery(delivery: any): {
|
|
12
|
-
schema: string;
|
|
13
|
-
appId: any;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Load `vmz.config.*` and write the WeChat packaging contract for the Rust packer.
|
|
17
|
-
* @param {string} project
|
|
18
|
-
*/
|
|
19
|
-
export declare function materializeWechatPackaging(project: any): {
|
|
20
|
-
schema: string;
|
|
21
|
-
appId: any;
|
|
22
|
-
};
|
package/dist/wechat-packaging.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Materialize `defineConfig({ delivery: { packaging: { wechat } } })` for wechat_pack.
|
|
3
|
-
* Pure data only. Writes `dist/_vmz/wechat-packaging.json` (not a second config entry).
|
|
4
|
-
*/
|
|
5
|
-
// @ts-nocheck
|
|
6
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
import { createJiti } from 'jiti';
|
|
9
|
-
import { pickDeliveryPackaging } from './delivery-profile.js';
|
|
10
|
-
import { writePrettyJsonFile } from './pretty-json.js';
|
|
11
|
-
export const WECHAT_PACKAGING_SCHEMA = 'vmz.target.wechat_packaging.v0';
|
|
12
|
-
export const WECHAT_PACKAGING_REL = 'dist/_vmz/wechat-packaging.json';
|
|
13
|
-
const CONFIG_NAMES = ['vmz.config.ts', 'vmz.config.mts', 'vmz.config.mjs', 'vmz.config.js'];
|
|
14
|
-
function loadConfigSync(project) {
|
|
15
|
-
for (const name of CONFIG_NAMES) {
|
|
16
|
-
const full = path.join(project, name);
|
|
17
|
-
if (!existsSync(full))
|
|
18
|
-
continue;
|
|
19
|
-
const jiti = createJiti(import.meta.url, {
|
|
20
|
-
interopDefault: true,
|
|
21
|
-
moduleCache: false,
|
|
22
|
-
});
|
|
23
|
-
return jiti(full);
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @param {unknown} delivery
|
|
29
|
-
* @returns {{ schema: string, appId: string, projectName?: string, title?: string }}
|
|
30
|
-
*/
|
|
31
|
-
export function wechatPackagingFromDelivery(delivery) {
|
|
32
|
-
const diagnostics = [];
|
|
33
|
-
const packaging = pickDeliveryPackaging(delivery && typeof delivery === 'object' ? delivery : {}, diagnostics);
|
|
34
|
-
const wechat = packaging && packaging.wechat ? packaging.wechat : {};
|
|
35
|
-
/** @type {{ schema: string, appId: string, projectName?: string, title?: string }} */
|
|
36
|
-
const out = {
|
|
37
|
-
schema: WECHAT_PACKAGING_SCHEMA,
|
|
38
|
-
appId: typeof wechat.appId === 'string' && wechat.appId.trim() ? wechat.appId.trim() : 'touristappid',
|
|
39
|
-
};
|
|
40
|
-
if (typeof wechat.projectName === 'string' && wechat.projectName.trim()) {
|
|
41
|
-
out.projectName = wechat.projectName.trim();
|
|
42
|
-
}
|
|
43
|
-
if (typeof wechat.title === 'string' && wechat.title.trim()) {
|
|
44
|
-
out.title = wechat.title.trim();
|
|
45
|
-
}
|
|
46
|
-
return out;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Load `vmz.config.*` and write the WeChat packaging contract for the Rust packer.
|
|
50
|
-
* @param {string} project
|
|
51
|
-
*/
|
|
52
|
-
export function materializeWechatPackaging(project) {
|
|
53
|
-
const cfg = loadConfigSync(project);
|
|
54
|
-
const spec = wechatPackagingFromDelivery(cfg?.delivery);
|
|
55
|
-
const abs = path.join(project, WECHAT_PACKAGING_REL);
|
|
56
|
-
mkdirSync(path.dirname(abs), { recursive: true });
|
|
57
|
-
writePrettyJsonFile(abs, spec);
|
|
58
|
-
return spec;
|
|
59
|
-
}
|