@antelopejs/dms-frontend 0.3.9 → 0.3.10
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 +9 -4
- package/dist/help.js +1 -0
- package/dist/index.js +35 -4
- package/dist/layers.d.ts +8 -1
- package/dist/layers.js +16 -5
- package/dist/output.d.ts +3 -1
- package/dist/output.js +24 -7
- package/dist/server-process.js +6 -1
- package/dist/update-check.js +2 -0
- package/dist/workspace-setup.js +4 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ pnpm add -g @antelopejs/core @antelopejs/dms-frontend
|
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
The plugin prints through the output module of `@antelopejs/core`
|
|
75
|
-
(`@antelopejs/core/cli`), so it needs `@antelopejs/core` 1.13.
|
|
75
|
+
(`@antelopejs/core/cli`), so it needs `@antelopejs/core` 1.13.1 or later.
|
|
76
76
|
`npm install -g` works too; this repository and every generated workspace use
|
|
77
77
|
pnpm. Inside a package script, `ajs` resolves from `node_modules/.bin`, and the
|
|
78
78
|
`dms` command it delegates to resolves the project-local plugin, so a script
|
|
@@ -134,9 +134,14 @@ missing configuration value) and 130 when stopped with Ctrl+C. `--no-color` or
|
|
|
134
134
|
`NO_COLOR=1` turns colors off, and terminals that cannot draw Unicode, such as
|
|
135
135
|
`TERM=dumb`, get ASCII symbols. `--verbose` or `ANTELOPEJS_VERBOSE` streams
|
|
136
136
|
the full `pnpm` and Vite output, each line behind the name of the step, and adds
|
|
137
|
-
the stack trace of the underlying error to a failure
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
the stack trace of the underlying error to a failure; `--verbose=<channels>`
|
|
138
|
+
turns all of it on too, whatever the channels. `-q`, `--quiet` or
|
|
139
|
+
`ANTELOPEJS_QUIET=1` prints only results, warnings and errors: no command
|
|
140
|
+
header, progress, summary or update notice, and of the block a ready `dev` or
|
|
141
|
+
`start` server prints, only its Local URL. `ajs --no-color dms …`,
|
|
142
|
+
`ajs --verbose dms …`, `ajs --verbose=<channels> dms …` and `ajs -q dms …` set
|
|
143
|
+
those variables for the plugin; the same flags are also accepted after the
|
|
144
|
+
command, as in `ajs dms build -q`.
|
|
140
145
|
|
|
141
146
|
The CLI checks npm for a newer release at most once a day and prints a one-line
|
|
142
147
|
notice on stderr, only to a terminal: as the last line of a command that
|
package/dist/help.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.ENVIRONMENT_VARIABLES = [
|
|
|
40
40
|
["DMS_CLIENT_BASE_URL", "Public frontend URL used in links and e-mails"],
|
|
41
41
|
["NO_COLOR", "Same as --no-color"],
|
|
42
42
|
["ANTELOPEJS_VERBOSE", "Same as --verbose"],
|
|
43
|
+
["ANTELOPEJS_QUIET", "Same as -q, unless 0 or false"],
|
|
43
44
|
["NO_UPDATE_NOTIFIER, CI", "Either one turns the update check off"],
|
|
44
45
|
];
|
|
45
46
|
const ENVIRONMENT_NOTES = [
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,12 @@ const help_1 = require("./help");
|
|
|
16
16
|
const output_1 = require("./output");
|
|
17
17
|
const update_check_1 = require("./update-check");
|
|
18
18
|
const { version } = require("../package.json");
|
|
19
|
-
const
|
|
19
|
+
const QUIET_FLAGS = ["-q", "--quiet"];
|
|
20
|
+
const GLOBAL_FLAGS = ["--no-color", ...QUIET_FLAGS];
|
|
21
|
+
const VERBOSE_FLAG = "--verbose";
|
|
22
|
+
const VERBOSE_ASSIGNMENT = `${VERBOSE_FLAG}=`;
|
|
23
|
+
const ALL_CHANNELS = "*";
|
|
24
|
+
const END_OF_OPTIONS = "--";
|
|
20
25
|
const ROOT_EXAMPLES = [
|
|
21
26
|
{
|
|
22
27
|
description: "Inside a project started with ajs project dev",
|
|
@@ -51,8 +56,32 @@ function describeHelpFooter(width) {
|
|
|
51
56
|
...(0, cli_1.wrapText)(pointer, width),
|
|
52
57
|
].join("\n");
|
|
53
58
|
}
|
|
59
|
+
function isGlobalFlag(arg) {
|
|
60
|
+
return GLOBAL_FLAGS.includes(arg) || arg.startsWith(VERBOSE_ASSIGNMENT);
|
|
61
|
+
}
|
|
54
62
|
function ownArguments(args) {
|
|
55
|
-
return args.filter((arg) => !
|
|
63
|
+
return args.filter((arg) => !isGlobalFlag(arg));
|
|
64
|
+
}
|
|
65
|
+
function optionArguments(args) {
|
|
66
|
+
const end = args.indexOf(END_OF_OPTIONS);
|
|
67
|
+
return end === -1 ? args : args.slice(0, end);
|
|
68
|
+
}
|
|
69
|
+
function normalizeVerboseArguments(args) {
|
|
70
|
+
const optionCount = optionArguments(args).length;
|
|
71
|
+
return args.map((arg, index) => index < optionCount && arg === VERBOSE_FLAG
|
|
72
|
+
? `${VERBOSE_ASSIGNMENT}${ALL_CHANNELS}`
|
|
73
|
+
: arg);
|
|
74
|
+
}
|
|
75
|
+
function exportOutputFlags(args) {
|
|
76
|
+
const options = optionArguments(args);
|
|
77
|
+
if (options.some((arg) => QUIET_FLAGS.includes(arg))) {
|
|
78
|
+
process.env.ANTELOPEJS_QUIET = "1";
|
|
79
|
+
}
|
|
80
|
+
const verbose = options.filter((arg) => arg.startsWith(VERBOSE_ASSIGNMENT));
|
|
81
|
+
if (verbose.length > 0) {
|
|
82
|
+
const channels = verbose[verbose.length - 1].slice(VERBOSE_ASSIGNMENT.length);
|
|
83
|
+
process.env.ANTELOPEJS_VERBOSE = channels || ALL_CHANNELS;
|
|
84
|
+
}
|
|
56
85
|
}
|
|
57
86
|
function isInvocation(args, rest) {
|
|
58
87
|
const own = ownArguments(args);
|
|
@@ -79,7 +108,8 @@ const runCLI = async () => {
|
|
|
79
108
|
.name("ajs dms")
|
|
80
109
|
.version(version, "-v, --version", "Print the version")
|
|
81
110
|
.option("--no-color", "Disable colors (also NO_COLOR=1)")
|
|
82
|
-
.option(
|
|
111
|
+
.option(`${VERBOSE_FLAG} [=channels]`, "Show full output and stack traces (also ANTELOPEJS_VERBOSE); any channels turn all of it on")
|
|
112
|
+
.option("-q, --quiet", "Print only results, warnings and errors (also ANTELOPEJS_QUIET=1)")
|
|
83
113
|
.option("--no-update-check", "Skip the daily update check (also NO_UPDATE_NOTIFIER=1)")
|
|
84
114
|
.addHelpText("before", (context) => describeVersion(version, (0, cli_1.helpTextWidth)(context)))
|
|
85
115
|
.addHelpText("after", (context) => describeHelpFooter((0, cli_1.helpTextWidth)(context)));
|
|
@@ -92,7 +122,8 @@ const runCLI = async () => {
|
|
|
92
122
|
program.addCommand((0, verify_source_1.cmdVerifySource)());
|
|
93
123
|
(0, help_1.applyDmsHelp)(program);
|
|
94
124
|
(0, cli_1.formatUsageErrors)(program);
|
|
95
|
-
const args = (0, update_check_1.stripUpdateCheckFlag)(argv);
|
|
125
|
+
const args = normalizeVerboseArguments((0, update_check_1.stripUpdateCheckFlag)(argv));
|
|
126
|
+
exportOutputFlags(args);
|
|
96
127
|
if (isInvocation(args, [])) {
|
|
97
128
|
program.outputHelp();
|
|
98
129
|
return;
|
package/dist/layers.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { ServedWithPath } from "./manifest";
|
|
2
2
|
import { ManifestModule, ResolvedLayer } from "./workspace";
|
|
3
|
-
|
|
3
|
+
interface PathlessManifestSource {
|
|
4
|
+
bootstrapSecret?: string;
|
|
5
|
+
cache?: {
|
|
6
|
+
fetchedAt?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function assertLayerPathsServed(modules: ManifestModule[], backendUrl: string, { bootstrapSecret, cache }?: PathlessManifestSource): asserts modules is ServedWithPath[];
|
|
4
10
|
export declare function assertCachedArchivesExist(modules: ManifestModule[], cacheDir: string, fetchedAt?: string): void;
|
|
5
11
|
export interface LayerPackage {
|
|
6
12
|
name?: unknown;
|
|
@@ -12,3 +18,4 @@ export declare function downloadAndExtractLayers(backendUrl: string, packUrl: st
|
|
|
12
18
|
export declare function buildLayersFromCache(modules: ManifestModule[], cacheDir: string): Promise<ResolvedLayer[]>;
|
|
13
19
|
export declare function getLayerSafeName(layer: ResolvedLayer): string;
|
|
14
20
|
export declare function getLayerWorkspacePath(workspaceDir: string, layer: ResolvedLayer): string;
|
|
21
|
+
export {};
|
package/dist/layers.js
CHANGED
|
@@ -51,11 +51,25 @@ const manifest_1 = require("./manifest");
|
|
|
51
51
|
const fs_sync_1 = require("./fs-sync");
|
|
52
52
|
const config_1 = require("./config");
|
|
53
53
|
const output_1 = require("./output");
|
|
54
|
-
|
|
54
|
+
const BUILD_FIX = "A remote or production backend never sends them: use `ajs dms build` against it";
|
|
55
|
+
function assertLayerPathsServed(modules, backendUrl, { bootstrapSecret, cache } = {}) {
|
|
55
56
|
const pathless = modules.filter((mod) => !mod.path);
|
|
56
57
|
if (pathless.length === 0)
|
|
57
58
|
return;
|
|
58
59
|
const count = `${pathless.length} of ${modules.length} module${modules.length === 1 ? "" : "s"}`;
|
|
60
|
+
if (cache) {
|
|
61
|
+
const fetched = cache.fetchedAt
|
|
62
|
+
? ` (fetched ${(0, output_1.formatAge)(cache.fetchedAt)})`
|
|
63
|
+
: "";
|
|
64
|
+
throw new cli_1.CliError({
|
|
65
|
+
title: `The cached manifest of ${(0, manifest_1.displayUrl)(backendUrl)}${fetched} has no layer source paths (${count})`,
|
|
66
|
+
reason: "This run did not fetch it. The backend sends the paths only to callers presenting its development credential, and did not send them to the run that cached this manifest.",
|
|
67
|
+
fixes: [
|
|
68
|
+
"Run once without --offline, with the backend reachable, from the project started with `ajs project dev` or with DMS_BOOTSTRAP_SECRET set",
|
|
69
|
+
BUILD_FIX,
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
}
|
|
59
73
|
const { reason, fix } = bootstrapSecret
|
|
60
74
|
? {
|
|
61
75
|
reason: "It sends them only to callers presenting its development credential, and did not accept the one this run sent.",
|
|
@@ -70,10 +84,7 @@ function assertLayerPathsServed(modules, backendUrl, bootstrapSecret) {
|
|
|
70
84
|
throw new cli_1.CliError({
|
|
71
85
|
title: `The backend at ${(0, manifest_1.displayUrl)(backendUrl)} did not send layer source paths (${count})`,
|
|
72
86
|
reason,
|
|
73
|
-
fixes: [
|
|
74
|
-
fix,
|
|
75
|
-
"A remote or production backend never sends them: use `ajs dms build` against it",
|
|
76
|
-
],
|
|
87
|
+
fixes: [fix, BUILD_FIX],
|
|
77
88
|
});
|
|
78
89
|
}
|
|
79
90
|
function assertCachedArchivesExist(modules, cacheDir, fetchedAt) {
|
package/dist/output.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function exitOnBrokenPipe(stream?: NodeJS.WriteStream): void;
|
|
|
4
4
|
export declare function isTerminalFeedback(): boolean;
|
|
5
5
|
export declare function isTerminalResult(): boolean;
|
|
6
6
|
export declare function writeFeedback(line: string): void;
|
|
7
|
+
export declare function writeInfo(line: string): void;
|
|
7
8
|
export declare function writeHeader(command: string, context: string[], ui?: Ui): void;
|
|
8
9
|
export declare function writeBlankLine(): void;
|
|
9
10
|
export declare function showPath(target: string, home?: string): string;
|
|
@@ -19,13 +20,14 @@ export interface ReadyLine {
|
|
|
19
20
|
label: string;
|
|
20
21
|
value: string;
|
|
21
22
|
isLink?: boolean;
|
|
23
|
+
isEssential?: boolean;
|
|
22
24
|
}
|
|
23
25
|
export interface ReadyBlock {
|
|
24
26
|
title: string;
|
|
25
27
|
lines: ReadyLine[];
|
|
26
28
|
footer: string;
|
|
27
29
|
}
|
|
28
|
-
export declare function formatReadyBlock(block: ReadyBlock, ui?: Ui): string[];
|
|
30
|
+
export declare function formatReadyBlock(block: ReadyBlock, ui?: Ui, isQuiet?: boolean): string[];
|
|
29
31
|
export declare function writeReadyBlock(block: ReadyBlock, ui?: Ui): void;
|
|
30
32
|
declare const TIMED_LEVEL_COLORS: {
|
|
31
33
|
readonly success: "green";
|
package/dist/output.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.exitOnBrokenPipe = exitOnBrokenPipe;
|
|
|
4
4
|
exports.isTerminalFeedback = isTerminalFeedback;
|
|
5
5
|
exports.isTerminalResult = isTerminalResult;
|
|
6
6
|
exports.writeFeedback = writeFeedback;
|
|
7
|
+
exports.writeInfo = writeInfo;
|
|
7
8
|
exports.writeHeader = writeHeader;
|
|
8
9
|
exports.writeBlankLine = writeBlankLine;
|
|
9
10
|
exports.showPath = showPath;
|
|
@@ -58,12 +59,16 @@ function isTerminalResult() {
|
|
|
58
59
|
function writeFeedback(line) {
|
|
59
60
|
(0, cli_1.getProcessTasks)().write(process.stderr, `${line}\n`);
|
|
60
61
|
}
|
|
62
|
+
function writeInfo(line) {
|
|
63
|
+
if (!(0, cli_1.isQuietRun)())
|
|
64
|
+
writeFeedback(line);
|
|
65
|
+
}
|
|
61
66
|
function writeHeader(command, context, ui = (0, cli_1.getProcessUi)()) {
|
|
62
67
|
const title = ui.palette().bold(`ajs dms ${command}`);
|
|
63
|
-
|
|
68
|
+
writeInfo(`${title} ${context.join(ui.symbols.separator)}`);
|
|
64
69
|
}
|
|
65
70
|
function writeBlankLine() {
|
|
66
|
-
|
|
71
|
+
writeInfo("");
|
|
67
72
|
}
|
|
68
73
|
function showPath(target, home = (0, node_os_1.homedir)()) {
|
|
69
74
|
if ((0, node_path_1.resolve)(target) === process.cwd())
|
|
@@ -148,22 +153,33 @@ function endInterruptedTask(task, error, stopped) {
|
|
|
148
153
|
task.skip(stopped);
|
|
149
154
|
}
|
|
150
155
|
function reportStopped(stop, ui = (0, cli_1.getProcessUi)()) {
|
|
156
|
+
const lineStart = lineStartAfter(stop.signal);
|
|
157
|
+
if ((0, cli_1.isQuietRun)()) {
|
|
158
|
+
if (lineStart)
|
|
159
|
+
writeFeedback("");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
151
162
|
const symbol = isUnicode(ui)
|
|
152
163
|
? STOPPED_SYMBOLS.unicode
|
|
153
164
|
: STOPPED_SYMBOLS.ascii;
|
|
154
165
|
const text = [stop.stopped, ...stop.context].join(ui.symbols.separator);
|
|
155
|
-
writeFeedback(`${
|
|
166
|
+
writeFeedback(`${lineStart}${ui.palette().red(symbol)} ${text}`);
|
|
156
167
|
}
|
|
157
|
-
function formatReadyBlock(block, ui = (0, cli_1.getProcessUi)()) {
|
|
168
|
+
function formatReadyBlock(block, ui = (0, cli_1.getProcessUi)(), isQuiet = (0, cli_1.isQuietRun)()) {
|
|
158
169
|
const palette = ui.palette();
|
|
159
170
|
const arrow = isUnicode(ui) ? LINK_SYMBOLS.unicode : LINK_SYMBOLS.ascii;
|
|
160
|
-
const
|
|
171
|
+
const shown = isQuiet
|
|
172
|
+
? block.lines.filter(({ isEssential }) => isEssential)
|
|
173
|
+
: block.lines;
|
|
174
|
+
const width = Math.max(...shown.map(({ label }) => label.length + LABEL_SUFFIX.length));
|
|
161
175
|
const lead = (isLink) => `${BLOCK_INDENT}${isLink ? palette.cyan(arrow) : " ".repeat(arrow.length)}${LINK_GAP}`;
|
|
162
|
-
const lines =
|
|
176
|
+
const lines = shown.map(({ label, value, isLink }) => {
|
|
163
177
|
const shownLabel = `${label}${LABEL_SUFFIX}`.padEnd(width);
|
|
164
178
|
const shownValue = isLink ? palette.cyan(value) : value;
|
|
165
179
|
return `${lead(isLink)}${palette.dim(shownLabel)} ${shownValue}`;
|
|
166
180
|
});
|
|
181
|
+
if (isQuiet)
|
|
182
|
+
return lines;
|
|
167
183
|
return [
|
|
168
184
|
`${palette.green(ui.symbols.levels.success)} ${block.title}`,
|
|
169
185
|
"",
|
|
@@ -172,8 +188,9 @@ function formatReadyBlock(block, ui = (0, cli_1.getProcessUi)()) {
|
|
|
172
188
|
];
|
|
173
189
|
}
|
|
174
190
|
function writeReadyBlock(block, ui = (0, cli_1.getProcessUi)()) {
|
|
175
|
-
for (const line of
|
|
191
|
+
for (const line of formatReadyBlock(block, ui))
|
|
176
192
|
writeFeedback(line);
|
|
193
|
+
writeInfo("");
|
|
177
194
|
}
|
|
178
195
|
const TIMED_LEVEL_COLORS = {
|
|
179
196
|
success: "green",
|
package/dist/server-process.js
CHANGED
|
@@ -165,7 +165,12 @@ function readyLines(address, settings, interfaces, isGuestInterface) {
|
|
|
165
165
|
const network = networkUrls(address, interfaces, isGuestInterface);
|
|
166
166
|
const hidden = network.length - MAX_NETWORK_URLS;
|
|
167
167
|
return [
|
|
168
|
-
{
|
|
168
|
+
{
|
|
169
|
+
label: "Local",
|
|
170
|
+
value: localUrl(address),
|
|
171
|
+
isLink: true,
|
|
172
|
+
isEssential: true,
|
|
173
|
+
},
|
|
169
174
|
...network.slice(0, MAX_NETWORK_URLS).map((value) => ({
|
|
170
175
|
label: "Network",
|
|
171
176
|
value,
|
package/dist/update-check.js
CHANGED
|
@@ -89,6 +89,8 @@ function stripUpdateCheckFlag(argv) {
|
|
|
89
89
|
function isUpdateCheckEnabled(argv, env) {
|
|
90
90
|
if (env.CI)
|
|
91
91
|
return false;
|
|
92
|
+
if ((0, cli_1.isQuietRun)({ argv: [...argv], env }))
|
|
93
|
+
return false;
|
|
92
94
|
if (env.NO_UPDATE_NOTIFIER)
|
|
93
95
|
return false;
|
|
94
96
|
if (env.TERM === DUMB_TERMINAL)
|
package/dist/workspace-setup.js
CHANGED
|
@@ -228,7 +228,10 @@ async function setupWorkspace(opts) {
|
|
|
228
228
|
const { manifest, fromCache, fetchedAt } = resolved;
|
|
229
229
|
let layers;
|
|
230
230
|
if (mode === "dev") {
|
|
231
|
-
(0, layers_1.assertLayerPathsServed)(manifest.modules, backendUrl,
|
|
231
|
+
(0, layers_1.assertLayerPathsServed)(manifest.modules, backendUrl, {
|
|
232
|
+
bootstrapSecret,
|
|
233
|
+
cache: fromCache ? { fetchedAt } : undefined,
|
|
234
|
+
});
|
|
232
235
|
if (fromCache) {
|
|
233
236
|
(0, manifest_1.assertCachedLayerPathsExist)(manifest.modules, fetchedAt);
|
|
234
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-frontend",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "Frontend-agnostic loader for AntelopeJS DMS, shipping the Vue 3 renderer (Vite, Inertia, SSR)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelope",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"unzipper": "^0.12.3"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@antelopejs/core": "^1.13.
|
|
76
|
+
"@antelopejs/core": "^1.13.1",
|
|
77
77
|
"@antelopejs/tooling-configs": ">=0.0.7 <1.0.0",
|
|
78
78
|
"@iconify/utils": "^3.1.0",
|
|
79
79
|
"@iconify/vue": "^5.0.1",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"vue-i18n": "^11.2.7"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@antelopejs/core": ">=1.13.
|
|
104
|
+
"@antelopejs/core": ">=1.13.1 <2"
|
|
105
105
|
},
|
|
106
106
|
"optionalDependencies": {
|
|
107
107
|
"@oxc-parser/binding-darwin-arm64": "^0.95.0",
|