@antelopejs/dms-frontend 0.9.3 → 0.10.1
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 +46 -29
- package/dist/commands/build-action.d.ts +3 -0
- package/dist/commands/build-action.js +77 -8
- package/dist/commands/build.js +7 -0
- package/dist/commands/clean-action.js +1 -1
- package/dist/commands/clean.js +1 -1
- package/dist/commands/dev-action.js +4 -3
- package/dist/commands/dev.js +1 -1
- package/dist/commands/prepare-action.js +1 -1
- package/dist/commands/start-action.js +3 -24
- package/dist/commands/workspace-task.js +2 -1
- package/dist/config.js +1 -0
- package/dist/derived-outputs.d.ts +1 -0
- package/dist/derived-outputs.js +6 -4
- package/dist/discovery.js +17 -6
- package/dist/entry-weight.js +15 -0
- package/dist/fs-sync.js +7 -4
- package/dist/help.js +1 -1
- package/dist/index.js +2 -1
- package/dist/internal/built-workspace.d.ts +4 -0
- package/dist/internal/built-workspace.js +43 -0
- package/dist/internal/ensure.d.ts +1 -0
- package/dist/internal/ensure.js +8 -0
- package/dist/internal/locale-catalogs.d.ts +8 -3
- package/dist/internal/locale-catalogs.js +16 -6
- package/dist/internal/manifest-decoder.d.ts +7 -0
- package/dist/internal/manifest-decoder.js +81 -0
- package/dist/internal/own-release.d.ts +5 -0
- package/dist/internal/own-release.js +20 -0
- package/dist/internal/plain-object.d.ts +1 -0
- package/dist/internal/plain-object.js +6 -0
- package/dist/internal/prepared-workspace.d.ts +12 -0
- package/dist/internal/prepared-workspace.js +74 -0
- package/dist/internal/text-list.d.ts +1 -0
- package/dist/internal/text-list.js +10 -0
- package/dist/internal/vite-manifest.d.ts +6 -0
- package/dist/internal/vite-manifest.js +24 -0
- package/dist/layer-watch.js +25 -24
- package/dist/layers.d.ts +1 -1
- package/dist/layers.js +3 -1
- package/dist/locale-files.d.ts +6 -3
- package/dist/locale-files.js +15 -9
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.js +46 -32
- package/dist/materialize.js +6 -2
- package/dist/module-set.js +2 -1
- package/dist/node-options.d.ts +1 -0
- package/dist/node-options.js +8 -0
- package/dist/output.d.ts +15 -9
- package/dist/output.js +30 -18
- package/dist/ports.d.ts +3 -1
- package/dist/ports.js +1 -1
- package/dist/private-values.d.ts +1 -1
- package/dist/private-values.js +5 -3
- package/dist/project-modules.d.ts +5 -1
- package/dist/project-modules.js +23 -15
- package/dist/renderer-range.js +5 -3
- package/dist/server-process.js +1 -1
- package/dist/verify-source-build.js +10 -2
- package/dist/verify-source-client-bundle.d.ts +1 -0
- package/dist/verify-source-client-bundle.js +30 -0
- package/dist/verify-source-runner.js +36 -94
- package/dist/verify-source-sources.js +49 -11
- package/dist/verify-source-workspace.d.ts +2 -0
- package/dist/verify-source-workspace.js +111 -0
- package/dist/workspace-setup.d.ts +1 -0
- package/dist/workspace-setup.js +4 -3
- package/package.json +11 -7
- package/skills/dms-frontend/SKILL.md +1 -1
- package/templates/vue/app-runtime.ts +2 -9
- package/templates/vue/backend-boundary.mjs +132 -0
- package/templates/vue/client-chunking.mjs +2 -0
- package/templates/vue/client-server-guard.mjs +16 -0
- package/templates/vue/compress-assets.mjs +9 -1
- package/templates/vue/entry-weight.mjs +29 -3
- package/templates/vue/frontend-build.ts +4 -3
- package/templates/vue/frontend-module.ts +1 -0
- package/templates/vue/frontend-runtime/module-registration.ts +2 -2
- package/templates/vue/frontend-runtime/state.ts +2 -2
- package/templates/vue/frontend-runtime/types.ts +8 -2
- package/templates/vue/head-order.mjs +10 -2
- package/templates/vue/icon-api.mjs +2 -0
- package/templates/vue/icon-scan.mjs +4 -0
- package/templates/vue/server/auth/backend.mjs +42 -5
- package/templates/vue/server/auth/client-ip.mjs +52 -4
- package/templates/vue/server/auth/establish-endpoints.mjs +11 -7
- package/templates/vue/server/auth/session.mjs +86 -4
- package/templates/vue/server/auth-declarations.mjs +46 -0
- package/templates/vue/server/auth-hooks.mjs +55 -7
- package/templates/vue/server/backend-proxies.mjs +78 -18
- package/templates/vue/server/backend-request.mjs +61 -0
- package/templates/vue/server/backend-response.mjs +23 -6
- package/templates/vue/server/built-files.mjs +7 -0
- package/templates/vue/server/cli-report.mjs +75 -12
- package/templates/vue/server/client-error.mjs +5 -0
- package/templates/vue/server/client-manifest.mjs +23 -1
- package/templates/vue/server/content.mjs +40 -10
- package/templates/vue/server/dev-private-files.mjs +17 -1
- package/templates/vue/server/dev-styles.mjs +38 -0
- package/templates/vue/server/email-bundle-watch.mjs +9 -3
- package/templates/vue/server/email.mjs +14 -6
- package/templates/vue/server/favicon.mjs +3 -0
- package/templates/vue/server/generated-files.mjs +221 -0
- package/templates/vue/server/homepage.mjs +21 -9
- package/templates/vue/server/html-tag.mjs +4 -0
- package/templates/vue/server/icons.mjs +93 -16
- package/templates/vue/server/in-place-render.mjs +35 -0
- package/templates/vue/server/inertia.mjs +76 -3
- package/templates/vue/server/module-event.mjs +118 -25
- package/templates/vue/server/module-route-types.mjs +78 -0
- package/templates/vue/server/module-routes.mjs +151 -96
- package/templates/vue/server/module-server.mjs +121 -40
- package/templates/vue/server/module-testing.mjs +36 -12
- package/templates/vue/server/page-props.mjs +94 -3
- package/templates/vue/server/page-redirects.mjs +37 -0
- package/templates/vue/server/path-patterns.mjs +35 -12
- package/templates/vue/server/proxy-compression.mjs +22 -0
- package/templates/vue/server/proxy-headers.mjs +12 -2
- package/templates/vue/server/proxy-redirects.mjs +21 -5
- package/templates/vue/server/proxy-request.mjs +58 -0
- package/templates/vue/server/proxy-transfers.mjs +44 -10
- package/templates/vue/server/public-endpoints.mjs +139 -28
- package/templates/vue/server/public-options.mjs +20 -6
- package/templates/vue/server/request-failure.mjs +24 -1
- package/templates/vue/server/request-routing.mjs +32 -10
- package/templates/vue/server/request-target.mjs +30 -11
- package/templates/vue/server/route-rules.mjs +48 -18
- package/templates/vue/server/ssr-module.mjs +32 -0
- package/templates/vue/server/static-files.mjs +35 -7
- package/templates/vue/server/type-guards.mjs +71 -0
- package/templates/vue/server/vite-errors.mjs +45 -7
- package/templates/vue/server/web-body.mjs +5 -1
- package/templates/vue/server-module.ts +12 -2
- package/templates/vue/server.mjs +162 -157
- package/templates/vue/sfc-global-types.mjs +112 -13
- package/templates/vue/ssr-renderer.ts +2 -2
- package/templates/vue/ui-inertia-page.mjs +16 -1
- package/templates/vue/ui-kbd.mjs +2 -1
- package/templates/vue/ui-request-state.mjs +2 -1
- package/templates/vue/vite.config.ts +9 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readBuiltPrivateOptions = readBuiltPrivateOptions;
|
|
4
|
+
exports.readBuiltModules = readBuiltModules;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const config_1 = require("../config");
|
|
8
|
+
const guards_1 = require("./guards");
|
|
9
|
+
const manifest_decoder_1 = require("./manifest-decoder");
|
|
10
|
+
const plain_object_1 = require("./plain-object");
|
|
11
|
+
function isOptionsById(value) {
|
|
12
|
+
return (0, plain_object_1.isPlainObject)(value) && Object.values(value).every(manifest_decoder_1.isModuleOptions);
|
|
13
|
+
}
|
|
14
|
+
function readBuiltPrivateOptions(workspaceDir) {
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceDir, config_1.SERVER_OPTIONS_FILE), "utf8"));
|
|
17
|
+
const modules = (0, plain_object_1.isPlainObject)(parsed) ? parsed.modules : undefined;
|
|
18
|
+
return isOptionsById(modules) ? modules : {};
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function readBuiltModules(workspaceDir) {
|
|
25
|
+
try {
|
|
26
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceDir, "generated-frontend-modules.json"), "utf8"));
|
|
27
|
+
const modules = (0, plain_object_1.isPlainObject)(parsed) ? parsed.modules : undefined;
|
|
28
|
+
if (!Array.isArray(modules))
|
|
29
|
+
return [];
|
|
30
|
+
const listed = modules;
|
|
31
|
+
return listed.flatMap((module) => (0, plain_object_1.isPlainObject)(module) && (0, guards_1.isText)(module.id)
|
|
32
|
+
? [
|
|
33
|
+
{
|
|
34
|
+
name: (0, guards_1.isText)(module.name) ? module.name : module.id,
|
|
35
|
+
version: (0, guards_1.isText)(module.version) ? module.version : undefined,
|
|
36
|
+
},
|
|
37
|
+
]
|
|
38
|
+
: []);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensure(condition: boolean, title: string, reason?: string): asserts condition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensure = ensure;
|
|
4
|
+
const cli_1 = require("@antelopejs/core/cli");
|
|
5
|
+
function ensure(condition, title, reason) {
|
|
6
|
+
if (!condition)
|
|
7
|
+
throw new cli_1.CliError({ title, reason });
|
|
8
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type LocaleValue = string | number | boolean | null | LocaleValue[] | LocaleMessages;
|
|
2
|
+
export interface LocaleMessages {
|
|
3
|
+
[key: string]: LocaleValue;
|
|
4
|
+
}
|
|
5
|
+
export declare function isLocaleValue(value: unknown): value is LocaleValue;
|
|
6
|
+
export declare function isMessageGroup(value: LocaleValue): value is LocaleMessages;
|
|
7
|
+
export declare function mergeLocaleMessages(source: LocaleMessages, existing: LocaleMessages): LocaleMessages;
|
|
3
8
|
export declare const FALLBACK_LOCALE = "en";
|
|
4
9
|
export declare const RENDERER_TRANSLATED_KEYS: string[];
|
|
5
|
-
export declare function withoutMessage(messages:
|
|
10
|
+
export declare function withoutMessage(messages: LocaleMessages, key: string): LocaleMessages;
|
|
6
11
|
export declare function localeModuleSource(supportedLocales: string[]): string;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RENDERER_TRANSLATED_KEYS = exports.FALLBACK_LOCALE = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.isLocaleValue = isLocaleValue;
|
|
5
|
+
exports.isMessageGroup = isMessageGroup;
|
|
5
6
|
exports.mergeLocaleMessages = mergeLocaleMessages;
|
|
6
7
|
exports.withoutMessage = withoutMessage;
|
|
7
8
|
exports.localeModuleSource = localeModuleSource;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const guards_1 = require("./guards");
|
|
10
|
+
function isLocaleValue(value) {
|
|
11
|
+
if (value === null || (0, guards_1.isText)(value) || (0, guards_1.isNumber)(value) || (0, guards_1.isFlag)(value)) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(value))
|
|
15
|
+
return value.every(isLocaleValue);
|
|
16
|
+
return (0, guards_1.isObjectLike)(value) && Object.values(value).every(isLocaleValue);
|
|
17
|
+
}
|
|
18
|
+
function isMessageGroup(value) {
|
|
19
|
+
return (0, guards_1.isObjectLike)(value) && !Array.isArray(value);
|
|
10
20
|
}
|
|
11
21
|
function mergeLocaleMessages(source, existing) {
|
|
12
22
|
const merged = { ...source };
|
|
13
23
|
for (const [key, value] of Object.entries(existing)) {
|
|
14
24
|
const sourceValue = merged[key];
|
|
15
25
|
merged[key] =
|
|
16
|
-
|
|
26
|
+
isMessageGroup(sourceValue) && isMessageGroup(value)
|
|
17
27
|
? mergeLocaleMessages(sourceValue, value)
|
|
18
28
|
: value;
|
|
19
29
|
}
|
|
@@ -23,12 +33,12 @@ exports.FALLBACK_LOCALE = "en";
|
|
|
23
33
|
exports.RENDERER_TRANSLATED_KEYS = ["error.network"];
|
|
24
34
|
function withoutMessage(messages, key) {
|
|
25
35
|
const [head, ...rest] = key.split(".");
|
|
26
|
-
if (!(head
|
|
36
|
+
if (!Object.prototype.hasOwnProperty.call(messages, head))
|
|
27
37
|
return messages;
|
|
28
38
|
const { [head]: value, ...others } = messages;
|
|
29
39
|
if (!rest.length)
|
|
30
40
|
return others;
|
|
31
|
-
if (!
|
|
41
|
+
if (!isMessageGroup(value))
|
|
32
42
|
return messages;
|
|
33
43
|
const remaining = withoutMessage(value, rest.join("."));
|
|
34
44
|
return Object.keys(remaining).length
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FrontendModuleOptions, Manifest, ManifestModule } from "../workspace";
|
|
2
|
+
export declare function isModuleOptions(value: unknown): value is FrontendModuleOptions;
|
|
3
|
+
export declare function isManifestModule(value: unknown): value is ManifestModule;
|
|
4
|
+
export declare function isManifest(value: unknown): value is Manifest;
|
|
5
|
+
export declare function hasManifestVersion(value: unknown): value is {
|
|
6
|
+
version: number;
|
|
7
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isModuleOptions = isModuleOptions;
|
|
4
|
+
exports.isManifestModule = isManifestModule;
|
|
5
|
+
exports.isManifest = isManifest;
|
|
6
|
+
exports.hasManifestVersion = hasManifestVersion;
|
|
7
|
+
const guards_1 = require("./guards");
|
|
8
|
+
const plain_object_1 = require("./plain-object");
|
|
9
|
+
function isList(value) {
|
|
10
|
+
return Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
function isTextList(value) {
|
|
13
|
+
return isList(value) && value.every(guards_1.isText);
|
|
14
|
+
}
|
|
15
|
+
function isModuleValue(value) {
|
|
16
|
+
if (value === null || (0, guards_1.isText)(value) || (0, guards_1.isNumber)(value) || (0, guards_1.isFlag)(value))
|
|
17
|
+
return true;
|
|
18
|
+
return isList(value) ? value.every(isModuleValue) : isModuleOptions(value);
|
|
19
|
+
}
|
|
20
|
+
function isModuleOptions(value) {
|
|
21
|
+
return (0, plain_object_1.isPlainObject)(value) && Object.values(value).every(isModuleValue);
|
|
22
|
+
}
|
|
23
|
+
function isPublicEndpoint(value) {
|
|
24
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
25
|
+
(0, guards_1.isText)(value.path) &&
|
|
26
|
+
(value.methods === undefined || isTextList(value.methods)) &&
|
|
27
|
+
(value.headers === undefined || isTextList(value.headers)));
|
|
28
|
+
}
|
|
29
|
+
function isBackendProxy(value) {
|
|
30
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
31
|
+
(0, guards_1.isText)(value.path) &&
|
|
32
|
+
(value.auth === undefined ||
|
|
33
|
+
value.auth === "session" ||
|
|
34
|
+
value.auth === "none") &&
|
|
35
|
+
(value.maxBodyBytes === undefined || (0, guards_1.isNumber)(value.maxBodyBytes)));
|
|
36
|
+
}
|
|
37
|
+
function isRenderer(value) {
|
|
38
|
+
return (0, plain_object_1.isPlainObject)(value) && (0, guards_1.isText)(value.name) && (0, guards_1.isText)(value.version);
|
|
39
|
+
}
|
|
40
|
+
function hasOptionalFields(value) {
|
|
41
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
42
|
+
(value.renderer === undefined || isRenderer(value.renderer)) &&
|
|
43
|
+
(value.path === undefined || (0, guards_1.isText)(value.path)) &&
|
|
44
|
+
(value.options === undefined || isModuleOptions(value.options)) &&
|
|
45
|
+
(value.privateOptions === undefined ||
|
|
46
|
+
isModuleOptions(value.privateOptions)) &&
|
|
47
|
+
(value.configKey === undefined || (0, guards_1.isText)(value.configKey)));
|
|
48
|
+
}
|
|
49
|
+
function hasOptionalLists(value) {
|
|
50
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
51
|
+
(value.authEstablishEndpoints === undefined ||
|
|
52
|
+
isTextList(value.authEstablishEndpoints)) &&
|
|
53
|
+
(value.publicEndpoints === undefined ||
|
|
54
|
+
(isList(value.publicEndpoints) &&
|
|
55
|
+
value.publicEndpoints.every(isPublicEndpoint))) &&
|
|
56
|
+
(value.backendProxies === undefined ||
|
|
57
|
+
(isList(value.backendProxies) &&
|
|
58
|
+
value.backendProxies.every(isBackendProxy))));
|
|
59
|
+
}
|
|
60
|
+
function isManifestModule(value) {
|
|
61
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
62
|
+
(0, guards_1.isText)(value.name) &&
|
|
63
|
+
(0, guards_1.isNumber)(value.priority) &&
|
|
64
|
+
hasOptionalFields(value) &&
|
|
65
|
+
hasOptionalLists(value));
|
|
66
|
+
}
|
|
67
|
+
function isOriginRewrite(value) {
|
|
68
|
+
return (0, plain_object_1.isPlainObject)(value) && (0, guards_1.isText)(value.from) && (0, guards_1.isText)(value.to);
|
|
69
|
+
}
|
|
70
|
+
function isManifest(value) {
|
|
71
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
72
|
+
isList(value.modules) &&
|
|
73
|
+
value.modules.every(isManifestModule) &&
|
|
74
|
+
(value.settling === undefined || (0, guards_1.isFlag)(value.settling)) &&
|
|
75
|
+
(value.originRewrites === undefined ||
|
|
76
|
+
(isList(value.originRewrites) &&
|
|
77
|
+
value.originRewrites.every(isOriginRewrite))));
|
|
78
|
+
}
|
|
79
|
+
function hasManifestVersion(value) {
|
|
80
|
+
return (0, plain_object_1.isPlainObject)(value) && (0, guards_1.isNumber)(value.version);
|
|
81
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ownRelease = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const guards_1 = require("./guards");
|
|
7
|
+
function isOwnRelease(value) {
|
|
8
|
+
return ((0, guards_1.isObjectLike)(value) &&
|
|
9
|
+
"name" in value &&
|
|
10
|
+
(0, guards_1.isText)(value.name) &&
|
|
11
|
+
"version" in value &&
|
|
12
|
+
(0, guards_1.isText)(value.version));
|
|
13
|
+
}
|
|
14
|
+
function readOwnRelease() {
|
|
15
|
+
const manifest = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, "..", "..", "package.json"), "utf8"));
|
|
16
|
+
if (!isOwnRelease(manifest))
|
|
17
|
+
throw new Error("The package.json of dms-frontend has no name or version");
|
|
18
|
+
return manifest;
|
|
19
|
+
}
|
|
20
|
+
exports.ownRelease = readOwnRelease();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedLayer } from "../workspace";
|
|
2
|
+
export type RecordedLayer = Pick<ResolvedLayer, "path" | "name" | "sourcePath" | "packageName">;
|
|
3
|
+
export type PreparedWorkspace = {
|
|
4
|
+
prepared: true;
|
|
5
|
+
layers: RecordedLayer[];
|
|
6
|
+
} | {
|
|
7
|
+
prepared: false;
|
|
8
|
+
reason: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function forgetPreparedLayers(workspaceDir: string): void;
|
|
11
|
+
export declare function recordPreparedLayers(workspaceDir: string, layers: readonly ResolvedLayer[]): void;
|
|
12
|
+
export declare function readPreparedWorkspace(workspaceDir: string): PreparedWorkspace;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forgetPreparedLayers = forgetPreparedLayers;
|
|
4
|
+
exports.recordPreparedLayers = recordPreparedLayers;
|
|
5
|
+
exports.readPreparedWorkspace = readPreparedWorkspace;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const config_1 = require("../config");
|
|
9
|
+
const workspace_setup_1 = require("../workspace-setup");
|
|
10
|
+
const guards_1 = require("./guards");
|
|
11
|
+
const plain_object_1 = require("./plain-object");
|
|
12
|
+
const PREPARED_LAYERS_FILE = ".dms-build-layers.json";
|
|
13
|
+
const OPTIONAL_TEXT_KEYS = ["name", "sourcePath", "packageName"];
|
|
14
|
+
function isRecordedLayer(value) {
|
|
15
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
16
|
+
Object.prototype.hasOwnProperty.call(value, "path") &&
|
|
17
|
+
(0, guards_1.isText)(value.path) &&
|
|
18
|
+
OPTIONAL_TEXT_KEYS.every((key) => !Object.prototype.hasOwnProperty.call(value, key) || (0, guards_1.isText)(value[key])));
|
|
19
|
+
}
|
|
20
|
+
function readRecord(workspaceDir) {
|
|
21
|
+
let parsed;
|
|
22
|
+
try {
|
|
23
|
+
parsed = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(workspaceDir, PREPARED_LAYERS_FILE), "utf8"));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
if (!(0, plain_object_1.isPlainObject)(parsed) ||
|
|
29
|
+
!Object.prototype.hasOwnProperty.call(parsed, "installed"))
|
|
30
|
+
return undefined;
|
|
31
|
+
const { installed } = parsed;
|
|
32
|
+
if (!(0, guards_1.isFlag)(installed) ||
|
|
33
|
+
!Object.prototype.hasOwnProperty.call(parsed, "layers"))
|
|
34
|
+
return undefined;
|
|
35
|
+
const { layers } = parsed;
|
|
36
|
+
if (!Array.isArray(layers))
|
|
37
|
+
return undefined;
|
|
38
|
+
const listed = layers;
|
|
39
|
+
return listed.every(isRecordedLayer)
|
|
40
|
+
? { installed, layers: listed }
|
|
41
|
+
: undefined;
|
|
42
|
+
}
|
|
43
|
+
function forgetPreparedLayers(workspaceDir) {
|
|
44
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(workspaceDir, PREPARED_LAYERS_FILE), { force: true });
|
|
45
|
+
}
|
|
46
|
+
function recordPreparedLayers(workspaceDir, layers) {
|
|
47
|
+
const record = {
|
|
48
|
+
installed: !(0, workspace_setup_1.needsInstall)(workspaceDir, layers.map((layer) => layer.path), false),
|
|
49
|
+
layers: layers.map(({ path, name, sourcePath, packageName }) => ({
|
|
50
|
+
path,
|
|
51
|
+
name,
|
|
52
|
+
sourcePath,
|
|
53
|
+
packageName,
|
|
54
|
+
})),
|
|
55
|
+
};
|
|
56
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(workspaceDir, PREPARED_LAYERS_FILE), `${JSON.stringify(record, null, 2)}\n`);
|
|
57
|
+
}
|
|
58
|
+
function readPreparedWorkspace(workspaceDir) {
|
|
59
|
+
const record = readRecord(workspaceDir);
|
|
60
|
+
if (!record)
|
|
61
|
+
return {
|
|
62
|
+
prepared: false,
|
|
63
|
+
reason: "No production setup finished in it.",
|
|
64
|
+
};
|
|
65
|
+
const installed = record.installed &&
|
|
66
|
+
(0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceDir, config_1.DEPS_HASH_FILE)) &&
|
|
67
|
+
(0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceDir, "node_modules"));
|
|
68
|
+
if (!installed)
|
|
69
|
+
return {
|
|
70
|
+
prepared: false,
|
|
71
|
+
reason: "Its dependencies are not installed, or changed since they were.",
|
|
72
|
+
};
|
|
73
|
+
return { prepared: true, layers: record.layers };
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isTextList(value: unknown): value is string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTextList = isTextList;
|
|
4
|
+
const guards_1 = require("./guards");
|
|
5
|
+
function isTextList(value) {
|
|
6
|
+
if (!Array.isArray(value))
|
|
7
|
+
return false;
|
|
8
|
+
const items = value;
|
|
9
|
+
return items.every(guards_1.isText);
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseViteManifest = parseViteManifest;
|
|
4
|
+
const cli_1 = require("@antelopejs/core/cli");
|
|
5
|
+
const guards_1 = require("./guards");
|
|
6
|
+
const plain_object_1 = require("./plain-object");
|
|
7
|
+
function isViteChunk(value) {
|
|
8
|
+
return ((0, plain_object_1.isPlainObject)(value) &&
|
|
9
|
+
(0, guards_1.isText)(value.file) &&
|
|
10
|
+
(value.src === undefined || (0, guards_1.isText)(value.src)) &&
|
|
11
|
+
(value.isEntry === undefined || (0, guards_1.isFlag)(value.isEntry)));
|
|
12
|
+
}
|
|
13
|
+
function parseViteManifest(content, label) {
|
|
14
|
+
const manifest = JSON.parse(content);
|
|
15
|
+
const chunks = (0, plain_object_1.isPlainObject)(manifest)
|
|
16
|
+
? Object.values(manifest)
|
|
17
|
+
: [];
|
|
18
|
+
if (!(0, plain_object_1.isPlainObject)(manifest) || !chunks.every(isViteChunk))
|
|
19
|
+
throw new cli_1.CliError({
|
|
20
|
+
title: `The ${label} is not a Vite manifest`,
|
|
21
|
+
reason: "Every entry of it must name the chunk's file.",
|
|
22
|
+
});
|
|
23
|
+
return chunks;
|
|
24
|
+
}
|
package/dist/layer-watch.js
CHANGED
|
@@ -24,11 +24,11 @@ function createSyncFailures(src, reporter) {
|
|
|
24
24
|
const failed = new Set();
|
|
25
25
|
const show = (rel) => reporter.show((0, node_path_1.join)(src, rel));
|
|
26
26
|
return {
|
|
27
|
-
fail(rel,
|
|
27
|
+
fail(rel, errorLines) {
|
|
28
28
|
failed.add(rel);
|
|
29
29
|
reporter.warn(`${show(rel)} not copied to the workspace`, {
|
|
30
30
|
details: [
|
|
31
|
-
...
|
|
31
|
+
...errorLines,
|
|
32
32
|
"The dev server keeps its previous version until the next save.",
|
|
33
33
|
],
|
|
34
34
|
});
|
|
@@ -73,7 +73,7 @@ function createLayerSync(src, dest, reporter, onStaged) {
|
|
|
73
73
|
failures.applied(rel);
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
|
-
failures.fail(rel, err);
|
|
76
|
+
failures.fail(rel, reporter.describe((0, output_1.classifyFailure)(err)));
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
const remove = (rel, recursive) => {
|
|
@@ -86,7 +86,7 @@ function createLayerSync(src, dest, reporter, onStaged) {
|
|
|
86
86
|
failures.applied(rel);
|
|
87
87
|
}
|
|
88
88
|
catch (err) {
|
|
89
|
-
failures.fail(rel, err);
|
|
89
|
+
failures.fail(rel, reporter.describe((0, output_1.classifyFailure)(err)));
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
const stage = (p, add, cancel) => {
|
|
@@ -113,7 +113,7 @@ function createLayerSync(src, dest, reporter, onStaged) {
|
|
|
113
113
|
failures.applied(rel);
|
|
114
114
|
}
|
|
115
115
|
catch (err) {
|
|
116
|
-
failures.fail(rel, err);
|
|
116
|
+
failures.fail(rel, reporter.describe((0, output_1.classifyFailure)(err)));
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
},
|
|
@@ -127,22 +127,6 @@ function createLayerSync(src, dest, reporter, onStaged) {
|
|
|
127
127
|
},
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
function describeOutputFailure(output, err, reporter) {
|
|
131
|
-
const kept = `The dev server keeps the previous ${output.name} until the file is fixed.`;
|
|
132
|
-
if (err instanceof locale_files_1.InvalidLocaleFileError) {
|
|
133
|
-
const file = reporter.show(err.path);
|
|
134
|
-
return {
|
|
135
|
-
text: `${file} is not a valid locale file`,
|
|
136
|
-
options: { details: [...err.reason.split("\n"), kept] },
|
|
137
|
-
fixed: [`${file} fixed`, `${output.name} regenerated`].join((0, cli_1.getProcessUi)().symbols.separator),
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
text: `${capitalize(output.name)} not regenerated`,
|
|
142
|
-
options: { details: [...reporter.describe(err), kept] },
|
|
143
|
-
fixed: `${capitalize(output.name)} regenerated`,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
130
|
function describeLayerDirectories(paths, reporter) {
|
|
147
131
|
const layers = [...new Set(paths)].filter((path) => !paths.some((other) => other.startsWith(`${path}${node_path_1.sep}`)));
|
|
148
132
|
const shown = layers.map((path) => reporter.show(path));
|
|
@@ -183,7 +167,24 @@ function createDerivedOutputRefresher(workspaceDir, layers, reporter) {
|
|
|
183
167
|
return isChanged;
|
|
184
168
|
}
|
|
185
169
|
catch (err) {
|
|
186
|
-
|
|
170
|
+
const kept = `The dev server keeps the previous ${output.name} until the file is fixed.`;
|
|
171
|
+
if (err instanceof locale_files_1.InvalidLocaleFileError) {
|
|
172
|
+
const file = reporter.show(err.path);
|
|
173
|
+
fail(output, {
|
|
174
|
+
text: `${file} is not a valid locale file`,
|
|
175
|
+
options: { details: [err.reason, ...err.details, kept] },
|
|
176
|
+
fixed: [`${file} fixed`, `${output.name} regenerated`].join((0, cli_1.getProcessUi)().symbols.separator),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
fail(output, {
|
|
181
|
+
text: `${capitalize(output.name)} not regenerated`,
|
|
182
|
+
options: {
|
|
183
|
+
details: [...reporter.describe((0, output_1.classifyFailure)(err)), kept],
|
|
184
|
+
},
|
|
185
|
+
fixed: `${capitalize(output.name)} regenerated`,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
187
188
|
return false;
|
|
188
189
|
}
|
|
189
190
|
};
|
|
@@ -198,7 +199,7 @@ function createDerivedOutputRefresher(workspaceDir, layers, reporter) {
|
|
|
198
199
|
text: "Derived files not regenerated",
|
|
199
200
|
options: {
|
|
200
201
|
details: [
|
|
201
|
-
...reporter.describe(err),
|
|
202
|
+
...reporter.describe((0, output_1.classifyFailure)(err)),
|
|
202
203
|
"The dev server keeps the previous ones until the module is fixed.",
|
|
203
204
|
],
|
|
204
205
|
},
|
|
@@ -278,7 +279,7 @@ function startLayerWatchers(workspaceDir, layers, ui = (0, cli_1.getProcessUi)()
|
|
|
278
279
|
if (!isQuiet)
|
|
279
280
|
write((0, output_1.formatTimedMessage)("success", text, {}, ui));
|
|
280
281
|
},
|
|
281
|
-
describe: (
|
|
282
|
+
describe: (failure) => (0, output_1.failureDetails)(failure, ui).map((line) => mapPath(line)),
|
|
282
283
|
show: (path) => {
|
|
283
284
|
const mapped = mapPath(path);
|
|
284
285
|
return mapped === path ? (0, output_1.showPath)(path) : mapped;
|
package/dist/layers.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ interface PathlessManifestSource {
|
|
|
9
9
|
export declare function assertLayerPathsServed(modules: ManifestModule[], backendUrl: string, { bootstrapSecret, cache }?: PathlessManifestSource): asserts modules is ServedWithPath[];
|
|
10
10
|
export interface LayerPackage {
|
|
11
11
|
name?: unknown;
|
|
12
|
-
engines?:
|
|
12
|
+
engines?: unknown;
|
|
13
13
|
dmsFrontend?: unknown;
|
|
14
14
|
antelopeJs?: unknown;
|
|
15
15
|
}
|
package/dist/layers.js
CHANGED
|
@@ -12,6 +12,7 @@ const manifest_1 = require("./manifest");
|
|
|
12
12
|
const config_1 = require("./config");
|
|
13
13
|
const output_1 = require("./output");
|
|
14
14
|
const guards_1 = require("./internal/guards");
|
|
15
|
+
const plain_object_1 = require("./internal/plain-object");
|
|
15
16
|
const BUILD_FIX = "A remote or production backend never sends them: build the frontend from the project instead, with `ajs dms build`";
|
|
16
17
|
function assertLayerPathsServed(modules, backendUrl, { bootstrapSecret, cache } = {}) {
|
|
17
18
|
const pathless = modules.filter((mod) => !mod.path);
|
|
@@ -56,7 +57,8 @@ function readLayerPackage(layerPath) {
|
|
|
56
57
|
if (!(0, node_fs_1.existsSync)(pkgPath))
|
|
57
58
|
return undefined;
|
|
58
59
|
try {
|
|
59
|
-
|
|
60
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(pkgPath, "utf-8"));
|
|
61
|
+
return (0, plain_object_1.isPlainObject)(parsed) ? parsed : undefined;
|
|
60
62
|
}
|
|
61
63
|
catch {
|
|
62
64
|
return undefined;
|
package/dist/locale-files.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { CliError } from "@antelopejs/core/cli";
|
|
2
|
+
import { type LocaleMessages } from "./internal/locale-catalogs";
|
|
3
|
+
export declare class InvalidLocaleFileError extends CliError {
|
|
2
4
|
readonly path: string;
|
|
3
5
|
readonly reason: string;
|
|
4
|
-
|
|
6
|
+
readonly details: readonly string[];
|
|
7
|
+
constructor(path: string, reason: string, details?: readonly string[]);
|
|
5
8
|
}
|
|
6
|
-
export declare function readLocaleFile(path: string):
|
|
9
|
+
export declare function readLocaleFile(path: string): LocaleMessages;
|
package/dist/locale-files.js
CHANGED
|
@@ -3,17 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InvalidLocaleFileError = void 0;
|
|
4
4
|
exports.readLocaleFile = readLocaleFile;
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
|
+
const cli_1 = require("@antelopejs/core/cli");
|
|
6
7
|
const message_compiler_1 = require("@intlify/message-compiler");
|
|
7
8
|
const guards_1 = require("./internal/guards");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const locale_catalogs_1 = require("./internal/locale-catalogs");
|
|
10
|
+
class InvalidLocaleFileError extends cli_1.CliError {
|
|
11
|
+
constructor(path, reason, details = []) {
|
|
12
|
+
super({
|
|
13
|
+
title: `Invalid locale file ${path}: ${reason}`,
|
|
14
|
+
details: [...details],
|
|
15
|
+
});
|
|
11
16
|
this.path = path;
|
|
12
17
|
this.reason = reason;
|
|
18
|
+
this.details = details;
|
|
13
19
|
this.name = "InvalidLocaleFileError";
|
|
14
20
|
}
|
|
15
21
|
}
|
|
16
22
|
exports.InvalidLocaleFileError = InvalidLocaleFileError;
|
|
23
|
+
const LINE_BREAKS = /\r?\n/g;
|
|
17
24
|
const LITERAL_ESCAPES = {
|
|
18
25
|
"@": "{'@'}",
|
|
19
26
|
"{": "{'{'}",
|
|
@@ -66,15 +73,14 @@ function readLocaleFile(path) {
|
|
|
66
73
|
}
|
|
67
74
|
catch (error) {
|
|
68
75
|
const reason = error instanceof Error ? error.message : String(error);
|
|
69
|
-
throw new InvalidLocaleFileError(path, reason);
|
|
76
|
+
throw new InvalidLocaleFileError(path, reason.replace(LINE_BREAKS, "\\n"));
|
|
77
|
+
}
|
|
78
|
+
if (!(0, locale_catalogs_1.isLocaleValue)(value) || !(0, locale_catalogs_1.isMessageGroup)(value)) {
|
|
79
|
+
throw new InvalidLocaleFileError(path, "a locale file must hold a JSON object of messages");
|
|
70
80
|
}
|
|
71
81
|
const problems = messageProblems(value, "");
|
|
72
82
|
if (problems.length) {
|
|
73
|
-
|
|
74
|
-
`${problems.length} message(s) vue-i18n cannot compile:`,
|
|
75
|
-
...problems.map(describeProblem),
|
|
76
|
-
].join("\n");
|
|
77
|
-
throw new InvalidLocaleFileError(path, reason);
|
|
83
|
+
throw new InvalidLocaleFileError(path, `${problems.length} message(s) vue-i18n cannot compile:`, problems.map(describeProblem));
|
|
78
84
|
}
|
|
79
85
|
return value;
|
|
80
86
|
}
|
package/dist/manifest.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function fetchFromBackend(backendUrl: string, url: URL, bootstrap
|
|
|
16
16
|
export declare class ManifestRefusedError extends CliError {
|
|
17
17
|
constructor(problem: string | CliProblem);
|
|
18
18
|
}
|
|
19
|
-
export declare function describeManifestVersion(version:
|
|
19
|
+
export declare function describeManifestVersion(version: number | undefined): CliProblem;
|
|
20
20
|
export declare class BackendResponseError extends CliError {
|
|
21
21
|
readonly status: number;
|
|
22
22
|
constructor(subject: string, url: string | URL, response: Pick<Response, "status" | "statusText">);
|