@astryxdesign/cli 0.7.15 → 0.7.16-canary.g56680f6
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 +5 -3
- package/api/component/_adapter.d.mts +1 -1
- package/api/component/_adapter.mjs +28 -1
- package/api/doctor/_adapter.d.mts +17 -0
- package/api/doctor/_adapter.mjs +35 -0
- package/api/doctor/doctor.mjs +18 -4
- package/api/integration/validate-integration.mjs +1 -1
- package/api/theme/_adapter.d.mts +5 -2
- package/api/theme/_adapter.mjs +43 -12
- package/api/theme/build/build.d.mts +15 -23
- package/api/theme/build/build.mjs +185 -39
- package/api/theme/eject/eject.mjs +22 -1
- package/api/theme/template/template.d.mts +19 -0
- package/api/theme/template/template.mjs +91 -19
- package/api/theme/theme.type.d.mts +5 -1
- package/api/theme/theme.type.mjs +2 -1
- package/api/theme/themeBuild.doc.mjs +3 -3
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +9 -3
- package/api/theme-edit/_adapter.d.mts +21 -0
- package/api/theme-edit/_adapter.mjs +176 -22
- package/api/theme-edit/_check.d.mts +7 -0
- package/api/theme-edit/_check.mjs +1050 -173
- package/api/theme-edit/_color.d.mts +2 -8
- package/api/theme-edit/_color.mjs +292 -219
- package/api/theme-edit/_compiler.d.mts +1 -0
- package/api/theme-edit/_compiler.mjs +20 -1
- package/api/theme-edit/_context.d.mts +21 -0
- package/api/theme-edit/_context.mjs +235 -12
- package/api/theme-edit/_css.d.mts +50 -1
- package/api/theme-edit/_css.mjs +310 -28
- package/api/theme-edit/_edit.d.mts +9 -0
- package/api/theme-edit/_edit.mjs +907 -123
- package/api/theme-edit/_how-commands.d.mts +11 -26
- package/api/theme-edit/_how-commands.mjs +30 -2
- package/api/theme-edit/_how-question.d.mts +7 -0
- package/api/theme-edit/_how-question.mjs +1304 -176
- package/api/theme-edit/_how.mjs +144 -30
- package/api/theme-edit/_palette.d.mts +6 -0
- package/api/theme-edit/_palette.mjs +164 -62
- package/api/theme-edit/_parts.d.mts +16 -0
- package/api/theme-edit/_parts.mjs +49 -1
- package/api/theme-edit/_png.mjs +19 -14
- package/api/theme-edit/_preview-app.mjs +514 -27
- package/api/theme-edit/_preview.d.mts +11 -0
- package/api/theme-edit/_preview.mjs +245 -24
- package/api/theme-edit/_project.d.mts +11 -0
- package/api/theme-edit/_project.mjs +35 -9
- package/api/theme-edit/_settings.d.mts +122 -5
- package/api/theme-edit/_settings.mjs +1363 -71
- package/api/theme-edit/_tables.d.mts +19 -0
- package/api/theme-edit/_tables.mjs +205 -149
- package/api/theme-edit/_vet.d.mts +42 -0
- package/api/theme-edit/_vet.mjs +144 -0
- package/api/theme-edit/theme-edit.type.d.mts +2 -1
- package/api/theme-edit/theme-edit.type.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- package/api/theme-edit/themeEditShow.doc.mjs +11 -3
- package/assets/docs/tree/single-component.doc.mjs +11 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
- package/assets/docs.generated.json +2 -2
- package/assets/preview-app/next.config.mjs +7 -1
- package/assets/preview-app/src/app/globals.css +1 -0
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
- package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/dashboard/page.tsx +1 -1
- package/authoring/doctypes/_schema.d.mts +52 -5
- package/authoring/doctypes/_schema.mjs +62 -7
- package/authoring/doctypes/base/type.ts +10 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/function/function.doc.mjs +6 -0
- package/authoring/doctypes/function/type.ts +3 -0
- package/authoring/doctypes/legacy.mjs +5 -1
- package/authoring/index.d.ts +1 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/doctor.doc.mjs +2 -2
- package/clients/cli/commands/experimental/theme.mjs +188 -37
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/commands/theme-eject.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +3 -1
- package/clients/cli/commands/theme.mjs +93 -10
- package/clients/cli/formatters/index.mjs +7 -4
- package/clients/cli/lib/cli-error.mjs +9 -3
- package/clients/cli/lib/component-format.mjs +27 -9
- package/clients/cli/lib/json-shim.mjs +40 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/config/project.mjs +50 -14
- package/foundation/discovery/theme-discovery.d.mts +5 -1
- package/foundation/discovery/theme-discovery.mjs +24 -3
- package/foundation/fs/gather-cache.d.mts +9 -2
- package/foundation/fs/gather-cache.mjs +36 -10
- package/foundation/fs/paths.d.mts +16 -0
- package/foundation/fs/paths.mjs +25 -0
- package/foundation/render/host-exit.d.mts +8 -0
- package/foundation/render/host-exit.mjs +11 -0
- package/foundation/render/page-host.mjs +56 -10
- package/foundation/render/page-worker.mjs +14 -0
- package/foundation/render/render-page.mjs +37 -2
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +5 -0
- package/foundation/response/error-codes.mjs +3 -0
- package/foundation/response/json.d.mts +15 -0
- package/foundation/response/json.mjs +52 -1
- package/foundation/response/response-types.doc.mjs +1 -1
- package/package.json +7 -6
|
@@ -84,6 +84,7 @@ import {
|
|
|
84
84
|
PathSafetyError,
|
|
85
85
|
} from '../../../foundation/fs/path-safety.mjs';
|
|
86
86
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
87
|
+
import {editorThemeRecord} from '../../../foundation/config/theme-state.mjs';
|
|
87
88
|
import {validatePrivateVars} from '../../../foundation/config/theme-private-vars.mjs';
|
|
88
89
|
import {AstryxError} from '../../error.mjs';
|
|
89
90
|
import {applyWrites} from '../../integration/add-helpers.mjs';
|
|
@@ -710,16 +711,21 @@ export function normalizeThemeBuildForCompare(content) {
|
|
|
710
711
|
.join('\n');
|
|
711
712
|
}
|
|
712
713
|
|
|
713
|
-
/**
|
|
714
|
+
/**
|
|
715
|
+
* The outputs that are missing or differ from what the build would write. A
|
|
716
|
+
* missing `.css.d.ts` stylesheet type stub (a write marked `warnWhenMissing`)
|
|
717
|
+
* is not stale: projects that ignore it in version control run the check in
|
|
718
|
+
* CI, so the check warns about it instead (missingDeclarations). Every other
|
|
719
|
+
* missing output, the module's `.d.ts` too, is stale.
|
|
720
|
+
* @param {Array<{dest: string, content: string, warnWhenMissing?: boolean}>} writes @param {string} cwd @returns {Array<{path: string, reason: 'missing' | 'outdated'}>}
|
|
721
|
+
*/
|
|
714
722
|
function staleBuildOutputs(writes, cwd) {
|
|
715
723
|
/** @type {Array<{path: string, reason: 'missing' | 'outdated'}>} */
|
|
716
724
|
const stale = [];
|
|
717
725
|
for (const write of writes) {
|
|
718
726
|
const rel = path.relative(cwd, write.dest);
|
|
719
727
|
if (!fs.existsSync(write.dest)) {
|
|
720
|
-
if (!write.
|
|
721
|
-
stale.push({path: rel, reason: 'missing'});
|
|
722
|
-
}
|
|
728
|
+
if (!write.warnWhenMissing) stale.push({path: rel, reason: 'missing'});
|
|
723
729
|
continue;
|
|
724
730
|
}
|
|
725
731
|
const onDisk = fs.readFileSync(write.dest, 'utf8');
|
|
@@ -733,13 +739,42 @@ function staleBuildOutputs(writes, cwd) {
|
|
|
733
739
|
return stale;
|
|
734
740
|
}
|
|
735
741
|
|
|
736
|
-
/**
|
|
742
|
+
/**
|
|
743
|
+
* Every output the build writes, from the same write list the build and the
|
|
744
|
+
* stale comparison use. A missing output makes the check stale, except the
|
|
745
|
+
* `.css.d.ts` stub, which it warns about (missingDeclarations).
|
|
746
|
+
* @param {Array<{dest: string}>} writes @param {string} cwd
|
|
747
|
+
*/
|
|
737
748
|
function checkedBuildOutputs(writes, cwd) {
|
|
749
|
+
return writes.map(write => path.relative(cwd, write.dest));
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* The `.css.d.ts` stylesheet type stubs the build writes that are missing,
|
|
754
|
+
* which the check names as checked and warns about in text mode without
|
|
755
|
+
* failing.
|
|
756
|
+
* @param {Array<{dest: string, warnWhenMissing?: boolean}>} writes @param {string} cwd
|
|
757
|
+
* @returns {string[]}
|
|
758
|
+
*/
|
|
759
|
+
function missingDeclarations(writes, cwd) {
|
|
738
760
|
return writes
|
|
739
|
-
.filter(write =>
|
|
761
|
+
.filter(write => write.warnWhenMissing && !fs.existsSync(write.dest))
|
|
740
762
|
.map(write => path.relative(cwd, write.dest));
|
|
741
763
|
}
|
|
742
764
|
|
|
765
|
+
/**
|
|
766
|
+
* The one text-mode warning line for missing stylesheet type stubs, or
|
|
767
|
+
* nothing when none is missing. The logger is silent under --json.
|
|
768
|
+
* @param {Array<{dest: string, warnWhenMissing?: boolean}>} writes @param {string} cwd
|
|
769
|
+
*/
|
|
770
|
+
function warnMissingDeclarations(writes, cwd) {
|
|
771
|
+
const missing = missingDeclarations(writes, cwd);
|
|
772
|
+
if (missing.length === 0) return;
|
|
773
|
+
logger.warn(
|
|
774
|
+
` Warning: stylesheet type declaration file${missing.length === 1 ? '' : 's'} not found: ${missing.join(', ')}. The check does not fail on ${missing.length === 1 ? 'it' : 'them'}; a build writes ${missing.length === 1 ? 'it' : 'them'}.`,
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
|
|
743
778
|
/** Remedies that end a confinement error, by where the output path came from. */
|
|
744
779
|
const OUT_REMEDY = 'Pass an --out path inside it.';
|
|
745
780
|
const SOURCE_REMEDY =
|
|
@@ -1059,6 +1094,41 @@ function assertThemeSourceFile(filePath, cwd) {
|
|
|
1059
1094
|
}
|
|
1060
1095
|
}
|
|
1061
1096
|
|
|
1097
|
+
/**
|
|
1098
|
+
* Who takes the editor-folder warning instead of the logger: the watcher's
|
|
1099
|
+
* child build hands it to its parent, which warns once per session. Set
|
|
1100
|
+
* only by the CLI (not part of the public API), and never by an option of
|
|
1101
|
+
* themeBuild.
|
|
1102
|
+
* @type {((warning: string) => void) | null}
|
|
1103
|
+
*/
|
|
1104
|
+
let editorFolderListener = null;
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* Hand the editor-folder warning of the builds in this process to
|
|
1108
|
+
* `listener` instead of the logger. CLI-internal: the watch child's
|
|
1109
|
+
* hand-off to its parent.
|
|
1110
|
+
* @param {((warning: string) => void) | null} listener
|
|
1111
|
+
*/
|
|
1112
|
+
export function setEditorFolderListener(listener) {
|
|
1113
|
+
editorFolderListener = listener;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Who is told a build found private var errors (the CLI, to exit 1). Set
|
|
1118
|
+
* only by the CLI, never by an option of themeBuild.
|
|
1119
|
+
* @type {(() => void) | null}
|
|
1120
|
+
*/
|
|
1121
|
+
let privateVarErrorListener = null;
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* Tell `listener` when a build in this process finds private var errors.
|
|
1125
|
+
* CLI-internal.
|
|
1126
|
+
* @param {(() => void) | null} listener
|
|
1127
|
+
*/
|
|
1128
|
+
export function setPrivateVarErrorListener(listener) {
|
|
1129
|
+
privateVarErrorListener = listener;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1062
1132
|
/**
|
|
1063
1133
|
* Refuse a build that would replace a file it does not own. A build never
|
|
1064
1134
|
* writes over its input, two of its own outputs at one path, or an output
|
|
@@ -1069,21 +1139,48 @@ function assertThemeSourceFile(filePath, cwd) {
|
|
|
1069
1139
|
* @param {Array<{dest: string}>} writes
|
|
1070
1140
|
* @param {string} filePath the theme source
|
|
1071
1141
|
* @param {string} cwd
|
|
1072
|
-
* @param {{claimed?: Map<string, string>, rerun?: string, refuseUnmarked?: boolean, elsewhere?: string}} [options]
|
|
1142
|
+
* @param {{claimed?: Map<string, string>, rerun?: (out: string | null) => string, refuseUnmarked?: boolean, elsewhere?: string, onEditorFolder?: (warning: string) => void}} [options]
|
|
1073
1143
|
* `claimed`: outputs written earlier in this run, by the source that wrote
|
|
1074
|
-
* them; `rerun`: this build's command
|
|
1075
|
-
* `elsewhere`: the option that moves the outputs
|
|
1144
|
+
* them; `rerun`: this build's command with another --out, or without one;
|
|
1145
|
+
* `elsewhere`: the option that moves the outputs; `onEditorFolder`: takes
|
|
1146
|
+
* the editor-folder warning instead of the logger (a watcher prints it once)
|
|
1076
1147
|
*/
|
|
1077
1148
|
function assertOutputsReplaceable(
|
|
1078
1149
|
writes,
|
|
1079
1150
|
filePath,
|
|
1080
1151
|
cwd,
|
|
1081
|
-
{
|
|
1152
|
+
{
|
|
1153
|
+
claimed,
|
|
1154
|
+
rerun,
|
|
1155
|
+
refuseUnmarked = false,
|
|
1156
|
+
elsewhere = '--out',
|
|
1157
|
+
onEditorFolder,
|
|
1158
|
+
} = {},
|
|
1082
1159
|
) {
|
|
1083
1160
|
const rel = (/** @type {string} */ file) => path.relative(cwd, file);
|
|
1084
1161
|
const sourceKey = outputKey(filePath);
|
|
1085
1162
|
const seen = new Set();
|
|
1086
1163
|
let warnedOtherSource = false;
|
|
1164
|
+
// The same build without --out, with its other options.
|
|
1165
|
+
const beside = {
|
|
1166
|
+
name: rerun
|
|
1167
|
+
? rerun(null)
|
|
1168
|
+
: formatCliCommand(`theme build ${shellWord(rel(filePath))}`, cwd),
|
|
1169
|
+
reason: 'write the outputs beside this source',
|
|
1170
|
+
};
|
|
1171
|
+
// A folder the theme editor made holds that theme's outputs only: another
|
|
1172
|
+
// source's outputs there would sit beside its settings as if they were
|
|
1173
|
+
// its own. A source inside the folder builds there as always; one outside
|
|
1174
|
+
// it writes there too, with a warning.
|
|
1175
|
+
let editorFolder = false;
|
|
1176
|
+
if (refuseUnmarked && writes.length) {
|
|
1177
|
+
const dir = path.resolve(path.dirname(writes[0].dest));
|
|
1178
|
+
const record = editorThemeRecord(dir);
|
|
1179
|
+
const fromDir = path.relative(dir, path.resolve(filePath));
|
|
1180
|
+
// On Windows a source on another drive has an absolute relative path.
|
|
1181
|
+
const inside = !fromDir.startsWith('..') && !path.isAbsolute(fromDir);
|
|
1182
|
+
if (record && !inside) editorFolder = true;
|
|
1183
|
+
}
|
|
1087
1184
|
for (const write of writes) {
|
|
1088
1185
|
const key = outputKey(write.dest);
|
|
1089
1186
|
if (key === sourceKey) {
|
|
@@ -1147,15 +1244,7 @@ function assertOutputsReplaceable(
|
|
|
1147
1244
|
} else if (otherSource) {
|
|
1148
1245
|
throw new AstryxError(
|
|
1149
1246
|
`${rel(write.dest)} is the build output of another theme source, ${otherSource}, so this build does not replace it. Pick another ${elsewhere}.`,
|
|
1150
|
-
[
|
|
1151
|
-
{
|
|
1152
|
-
name: formatCliCommand(
|
|
1153
|
-
`theme build ${shellWord(rel(filePath))}`,
|
|
1154
|
-
cwd,
|
|
1155
|
-
),
|
|
1156
|
-
reason: 'write the outputs beside this source',
|
|
1157
|
-
},
|
|
1158
|
-
],
|
|
1247
|
+
[beside],
|
|
1159
1248
|
ERROR_CODES.ERR_FILE_EXISTS,
|
|
1160
1249
|
);
|
|
1161
1250
|
}
|
|
@@ -1166,20 +1255,70 @@ function assertOutputsReplaceable(
|
|
|
1166
1255
|
stat.size > 0 &&
|
|
1167
1256
|
!fileHead(write.dest).includes(GENERATED_MARKER)
|
|
1168
1257
|
) {
|
|
1258
|
+
// Never advice to delete it: it may be the person's file (a settings
|
|
1259
|
+
// file, app source). A path that takes every output instead.
|
|
1260
|
+
const free = freeOutPath(writes);
|
|
1169
1261
|
throw new AstryxError(
|
|
1170
|
-
`${rel(write.dest)}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1262
|
+
`${rel(write.dest)} is a file this build did not write (it has no build header: your own file, another tool's, or an output from a CLI before 0.6.7), so the build does not replace it. Pick another ${elsewhere}.`,
|
|
1263
|
+
[
|
|
1264
|
+
...(free && rerun
|
|
1265
|
+
? [
|
|
1266
|
+
{
|
|
1267
|
+
name: rerun(rel(free)),
|
|
1268
|
+
reason: 'a path where no output of this build exists yet',
|
|
1269
|
+
},
|
|
1270
|
+
]
|
|
1271
|
+
: []),
|
|
1272
|
+
beside,
|
|
1273
|
+
],
|
|
1179
1274
|
ERROR_CODES.ERR_FILE_EXISTS,
|
|
1180
1275
|
);
|
|
1181
1276
|
}
|
|
1182
1277
|
}
|
|
1278
|
+
// Warned only once nothing refuses the build, so it names a write that
|
|
1279
|
+
// happens.
|
|
1280
|
+
if (editorFolder) {
|
|
1281
|
+
const dir = path.dirname(writes[0].dest);
|
|
1282
|
+
const warning = `Warning: ${rel(dir) || '.'} is a folder the theme editor made, and ${rel(filePath)} is outside it; the build writes there anyway. Build beside the source, or pick another ${elsewhere}, to keep the editor's folder to its own theme.`;
|
|
1283
|
+
if (onEditorFolder) onEditorFolder(warning);
|
|
1284
|
+
else logger.warn(warning);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* An --out path where no output of this build exists yet, or null. The
|
|
1290
|
+
* stylesheet and its `.css.d.ts` follow the name --out gives; the module and
|
|
1291
|
+
* its types are named after the theme, so a new name beside them (`brand-2.css`)
|
|
1292
|
+
* helps only when those are free, else a new folder (`brand-2/brand.css`).
|
|
1293
|
+
* @param {Array<{dest: string}>} writes the stylesheet first
|
|
1294
|
+
* @returns {string | null}
|
|
1295
|
+
*/
|
|
1296
|
+
function freeOutPath(writes) {
|
|
1297
|
+
const css = writes[0]?.dest;
|
|
1298
|
+
if (!css) return null;
|
|
1299
|
+
const dir = path.dirname(css);
|
|
1300
|
+
const stem = path.basename(css).replace(/\.css$/i, '');
|
|
1301
|
+
/** Whether a write set (each output moved by `move`) touches any file. */
|
|
1302
|
+
const blocked = (/** @type {(dest: string) => string} */ move) =>
|
|
1303
|
+
writes.some(w => fs.existsSync(move(w.dest)));
|
|
1304
|
+
for (let n = 2; n < 100; n += 1) {
|
|
1305
|
+
const next = `${stem}-${n}`;
|
|
1306
|
+
// Only the stylesheet and its types follow --out's name.
|
|
1307
|
+
// The exact names a build with `--out <next>.css` writes, also when
|
|
1308
|
+
// --out did not end in .css (`o.txt` suggests `o.txt-2.css`).
|
|
1309
|
+
const renamed = (/** @type {string} */ dest) =>
|
|
1310
|
+
dest === css
|
|
1311
|
+
? path.join(dir, `${next}.css`)
|
|
1312
|
+
: dest === `${css}.d.ts`
|
|
1313
|
+
? path.join(dir, `${next}.css.d.ts`)
|
|
1314
|
+
: dest;
|
|
1315
|
+
if (!blocked(renamed)) return path.join(dir, `${next}.css`);
|
|
1316
|
+
const folder = (/** @type {string} */ dest) =>
|
|
1317
|
+
path.join(dir, next, path.basename(dest));
|
|
1318
|
+
if (!fs.existsSync(path.join(dir, next)) && !blocked(folder))
|
|
1319
|
+
return path.join(dir, next, path.basename(css));
|
|
1320
|
+
}
|
|
1321
|
+
return null;
|
|
1183
1322
|
}
|
|
1184
1323
|
|
|
1185
1324
|
/**
|
|
@@ -3504,7 +3643,7 @@ function validateHeadingTypeAugmentationSupport(themeDef) {
|
|
|
3504
3643
|
* `logger` (silent by default).
|
|
3505
3644
|
*
|
|
3506
3645
|
* @param {string} file - Theme file path, resolved against `cwd`.
|
|
3507
|
-
* @param {{out?: string, check?: boolean, iconsSpecifier?: string, __prepareFamily?: boolean, __familyLoader?: any, __familyInterception?: any,
|
|
3646
|
+
* @param {{out?: string, check?: boolean, iconsSpecifier?: string, __prepareFamily?: boolean, __familyLoader?: any, __familyInterception?: any, __writeRoot?: string, __claimedOutputs?: Map<string, string>, __deferredWrites?: Array<Array<{dest: string, content: string}>>, __commandWords?: {group: string, build: string}}} [options] -
|
|
3508
3647
|
* `out` overrides the output CSS path, or names the folder for it; `check` compares against on-disk outputs
|
|
3509
3648
|
* instead of writing. `__claimedOutputs` records the outputs earlier builds
|
|
3510
3649
|
* in one run wrote, so a later theme cannot replace them; with
|
|
@@ -3750,7 +3889,7 @@ async function themeBuildInternal(
|
|
|
3750
3889
|
logger.error(` [error] ${source}${e}`);
|
|
3751
3890
|
}
|
|
3752
3891
|
if (privateVarErrors.length > 0) {
|
|
3753
|
-
|
|
3892
|
+
privateVarErrorListener?.();
|
|
3754
3893
|
logger.error(
|
|
3755
3894
|
`\n ${source}${privateVarErrors.length} private var error(s). Use standard CSS properties instead.`,
|
|
3756
3895
|
);
|
|
@@ -4209,7 +4348,7 @@ async function themeBuildInternal(
|
|
|
4209
4348
|
|
|
4210
4349
|
const writes = [
|
|
4211
4350
|
{dest: outPath, content: cssContent},
|
|
4212
|
-
{dest: cssDtsPath, content: cssDtsContent,
|
|
4351
|
+
{dest: cssDtsPath, content: cssDtsContent, warnWhenMissing: true},
|
|
4213
4352
|
{dest: jsPath, content: jsContent},
|
|
4214
4353
|
{dest: dtsPath, content: dtsContent},
|
|
4215
4354
|
];
|
|
@@ -4223,7 +4362,7 @@ async function themeBuildInternal(
|
|
|
4223
4362
|
if (!options.check) {
|
|
4224
4363
|
confineOutputs(writes, writeRoot, options.out ? OUT_REMEDY : SOURCE_REMEDY);
|
|
4225
4364
|
// prettier-ignore
|
|
4226
|
-
const rerun = formatCliCommand(['theme', 'build', path.relative(cwd, filePath), ...(
|
|
4365
|
+
const rerun = (/** @type {string | null} */ out) => formatCliCommand(['theme', 'build', path.relative(cwd, filePath), ...(out == null ? [] : ['--out', out]), ...(options.iconsSpecifier ? ['--icons-specifier', options.iconsSpecifier] : [])].map(shellWord).join(' '), cwd);
|
|
4227
4366
|
// A header-less file at the default paths beside the source is an output
|
|
4228
4367
|
// of a CLI before 0.6.7, which the build has always replaced. A path that
|
|
4229
4368
|
// --out names may hold anything, so there only build outputs are replaced.
|
|
@@ -4231,6 +4370,7 @@ async function themeBuildInternal(
|
|
|
4231
4370
|
claimed: options.__claimedOutputs,
|
|
4232
4371
|
rerun,
|
|
4233
4372
|
refuseUnmarked: Boolean(options.out),
|
|
4373
|
+
onEditorFolder: editorFolderListener ?? undefined,
|
|
4234
4374
|
});
|
|
4235
4375
|
}
|
|
4236
4376
|
|
|
@@ -4263,15 +4403,18 @@ async function themeBuildInternal(
|
|
|
4263
4403
|
`\n Rebuild with: ${rebuildLine(rebuildCommand, options.__commandWords)}`,
|
|
4264
4404
|
);
|
|
4265
4405
|
}
|
|
4266
|
-
|
|
4406
|
+
warnMissingDeclarations(writes, cwd);
|
|
4407
|
+
return /** @type {import('../theme.type.mjs').ThemeBuildCheckResponse} */ ({
|
|
4267
4408
|
type: 'theme.build.check',
|
|
4268
4409
|
data: {
|
|
4269
4410
|
name: themeDef.name,
|
|
4270
4411
|
upToDate,
|
|
4271
4412
|
stale,
|
|
4272
4413
|
checked: checkedBuildOutputs(writes, cwd),
|
|
4414
|
+
// The code a stale check exits 1 with, for --json callers.
|
|
4415
|
+
...(upToDate ? {} : {code: ERROR_CODES.ERR_THEME_STALE}),
|
|
4273
4416
|
},
|
|
4274
|
-
};
|
|
4417
|
+
});
|
|
4275
4418
|
}
|
|
4276
4419
|
|
|
4277
4420
|
// A batch publishes every theme's outputs after all of them are built, so
|
|
@@ -4660,7 +4803,7 @@ async function preloadFamilySource(filePath, loader, interception) {
|
|
|
4660
4803
|
finally { patch.undo(); }
|
|
4661
4804
|
}
|
|
4662
4805
|
|
|
4663
|
-
/** @param {string[]} files @param {{familyKey: string, check?: boolean, iconsSpecifier?: string,
|
|
4806
|
+
/** @param {string[]} files @param {{familyKey: string, check?: boolean, iconsSpecifier?: string, __commandWords?: {group: string, build: string}}} options @param {{cwd?: string}} [ctx] */
|
|
4664
4807
|
export async function themeBuildFamily(
|
|
4665
4808
|
files,
|
|
4666
4809
|
options,
|
|
@@ -4697,7 +4840,7 @@ export async function themeBuildFamily(
|
|
|
4697
4840
|
}
|
|
4698
4841
|
const file = source.file;
|
|
4699
4842
|
// prettier-ignore
|
|
4700
|
-
const member = await themeBuildInternal(file, {iconsSpecifier: options.iconsSpecifier, __prepareFamily: true, __familyLoader: familyLoader, __familyInterception: familyInterception
|
|
4843
|
+
const member = await themeBuildInternal(file, {iconsSpecifier: options.iconsSpecifier, __prepareFamily: true, __familyLoader: familyLoader, __familyInterception: familyInterception}, {cwd});
|
|
4701
4844
|
if (!member || member.type) {
|
|
4702
4845
|
throw new AstryxError(
|
|
4703
4846
|
`Theme family member "${file}" did not produce a complete build plan.`,
|
|
@@ -4871,7 +5014,7 @@ export async function themeBuildFamily(
|
|
|
4871
5014
|
},
|
|
4872
5015
|
{
|
|
4873
5016
|
dest: cssDtsPath,
|
|
4874
|
-
|
|
5017
|
+
warnWhenMissing: true,
|
|
4875
5018
|
content:
|
|
4876
5019
|
generatedHeader(headerSource, 'ts', buildCommand, root.versions) +
|
|
4877
5020
|
'export {};\n',
|
|
@@ -4931,15 +5074,18 @@ export async function themeBuildFamily(
|
|
|
4931
5074
|
`\n Rebuild with: ${rebuildLine(rebuildCommand, options.__commandWords)}`,
|
|
4932
5075
|
);
|
|
4933
5076
|
}
|
|
4934
|
-
|
|
5077
|
+
warnMissingDeclarations(writes, cwd);
|
|
5078
|
+
return /** @type {import('../theme.type.mjs').ThemeBuildCheckResponse} */ ({
|
|
4935
5079
|
type: 'theme.build.check',
|
|
4936
5080
|
data: {
|
|
4937
5081
|
name: root.theme.name,
|
|
4938
5082
|
upToDate,
|
|
4939
5083
|
stale,
|
|
4940
5084
|
checked: checkedBuildOutputs(writes, cwd),
|
|
5085
|
+
// The code a stale check exits 1 with, for --json callers.
|
|
5086
|
+
...(upToDate ? {} : {code: ERROR_CODES.ERR_THEME_STALE}),
|
|
4941
5087
|
},
|
|
4942
|
-
};
|
|
5088
|
+
});
|
|
4943
5089
|
}
|
|
4944
5090
|
writeBuildOutputs(writes);
|
|
4945
5091
|
for (const output of Object.values(outputs)) logger.log(`[ok] ${output}`);
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import * as path from 'node:path';
|
|
9
9
|
import {AstryxError} from '../../error.mjs';
|
|
10
|
+
import {logger} from '../../logger.mjs';
|
|
10
11
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
12
|
+
import {
|
|
13
|
+
formatCliCommand,
|
|
14
|
+
quoteCommandArgument,
|
|
15
|
+
} from '../../../foundation/env/package-manager.mjs';
|
|
11
16
|
import {
|
|
12
17
|
ejectThemeFiles,
|
|
13
18
|
findTheme,
|
|
@@ -54,12 +59,28 @@ export async function themeEject(slug, options = {}) {
|
|
|
54
59
|
);
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
const {outputDir, files} = ejectThemeFiles(match, {
|
|
62
|
+
const {outputDir, files, editorFolder} = ejectThemeFiles(match, {
|
|
58
63
|
cwd,
|
|
59
64
|
targetPath,
|
|
60
65
|
overwrite,
|
|
61
66
|
takenSlugs: await availableSlugs(cwd),
|
|
62
67
|
});
|
|
68
|
+
// A folder the theme editor made holds that theme only, but a subfolder of
|
|
69
|
+
// it was always writable, so the fork is written there with one warning.
|
|
70
|
+
if (editorFolder != null) {
|
|
71
|
+
const fork = formatCliCommand(
|
|
72
|
+
[
|
|
73
|
+
'theme eject',
|
|
74
|
+
match.slug,
|
|
75
|
+
...(packageName
|
|
76
|
+
? ['--package', quoteCommandArgument(packageName)]
|
|
77
|
+
: []),
|
|
78
|
+
].join(' '),
|
|
79
|
+
cwd,
|
|
80
|
+
);
|
|
81
|
+
const warning = `Warning: ${editorFolder} is a folder the theme editor made, and the fork in ${outputDir} is inside it; eject writes there anyway. Fork into the project's local themes folder (${fork}), or pick a path outside ${editorFolder}, to keep the editor's folder to its own theme.`;
|
|
82
|
+
logger.warn(warning);
|
|
83
|
+
}
|
|
63
84
|
const {missingPackages, installCommand} = forkNeeds(outputDir, files, cwd);
|
|
64
85
|
return {
|
|
65
86
|
type: 'theme.eject',
|
|
@@ -15,7 +15,26 @@ export function themeTemplate(options?: {
|
|
|
15
15
|
overwrite?: boolean;
|
|
16
16
|
cwd?: string;
|
|
17
17
|
}): import("../theme.type.mjs").ThemeTemplateResponse;
|
|
18
|
+
/**
|
|
19
|
+
* The template write behind `themeTemplate`, with the experimental editor's
|
|
20
|
+
* one difference: with `editorFilesOnly`, in a folder the theme editor made
|
|
21
|
+
* only the editor's own files (`<folder>.*`) are protected, so an earlier
|
|
22
|
+
* template there is the person's. Internal: the experimental `template`
|
|
23
|
+
* command reaches it through `editorThemeTemplate` (api/theme-edit), and it
|
|
24
|
+
* is not part of the public API.
|
|
25
|
+
* @internal
|
|
26
|
+
* @param {{targetPath?: string, overwrite?: boolean, cwd?: string}} options
|
|
27
|
+
* @param {boolean} editorFilesOnly
|
|
28
|
+
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
29
|
+
*/
|
|
30
|
+
export function writeThemeTemplate(options: {
|
|
31
|
+
targetPath?: string;
|
|
32
|
+
overwrite?: boolean;
|
|
33
|
+
cwd?: string;
|
|
34
|
+
}, editorFilesOnly: boolean): import("../theme.type.mjs").ThemeTemplateResponse;
|
|
18
35
|
/** The annotated `defineTheme` reference that ships with the CLI. */
|
|
19
36
|
export const THEME_TEMPLATE_SRC: string;
|
|
37
|
+
/** The warning the CLI prints when it writes the template outside a project. */
|
|
38
|
+
export const OUTSIDE_PROJECT_WARNING: "Warning: no package.json is in this folder or above it, so the template is written here. Run it inside a project, or run `npm init -y` here first, to write it at a project root.";
|
|
20
39
|
/** Where it lands when the caller does not say. */
|
|
21
40
|
export const THEME_TEMPLATE_DEFAULT_PATH: "theme.template.ts";
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
import * as fs from 'node:fs';
|
|
17
17
|
import * as path from 'node:path';
|
|
18
|
-
import {CLI_ROOT} from '../../../foundation/fs/paths.mjs';
|
|
19
|
-
import {
|
|
18
|
+
import {CLI_ROOT, projectWritePath} from '../../../foundation/fs/paths.mjs';
|
|
19
|
+
import {
|
|
20
|
+
assertWithin,
|
|
21
|
+
PathSafetyError,
|
|
22
|
+
} from '../../../foundation/fs/path-safety.mjs';
|
|
20
23
|
import {stripCopyrightHeader} from '../../../foundation/text/copyright-header.mjs';
|
|
21
24
|
import {formatCliCommand} from '../../../foundation/env/package-manager.mjs';
|
|
22
25
|
import {fsErrorMessage} from '../../../foundation/fs/fs-error.mjs';
|
|
@@ -25,7 +28,15 @@ import {AstryxError} from '../../error.mjs';
|
|
|
25
28
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
26
29
|
|
|
27
30
|
/** The annotated `defineTheme` reference that ships with the CLI. */
|
|
28
|
-
export const THEME_TEMPLATE_SRC = path.join(
|
|
31
|
+
export const THEME_TEMPLATE_SRC = path.join(
|
|
32
|
+
CLI_ROOT,
|
|
33
|
+
'assets',
|
|
34
|
+
'theme.template.ts',
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/** The warning the CLI prints when it writes the template outside a project. */
|
|
38
|
+
export const OUTSIDE_PROJECT_WARNING =
|
|
39
|
+
'Warning: no package.json is in this folder or above it, so the template is written here. Run it inside a project, or run `npm init -y` here first, to write it at a project root.';
|
|
29
40
|
|
|
30
41
|
/** Where it lands when the caller does not say. */
|
|
31
42
|
export const THEME_TEMPLATE_DEFAULT_PATH = 'theme.template.ts';
|
|
@@ -72,6 +83,22 @@ function isReplaceableThemeFile(file) {
|
|
|
72
83
|
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
73
84
|
*/
|
|
74
85
|
export function themeTemplate(options = {}) {
|
|
86
|
+
return writeThemeTemplate(options, false);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The template write behind `themeTemplate`, with the experimental editor's
|
|
91
|
+
* one difference: with `editorFilesOnly`, in a folder the theme editor made
|
|
92
|
+
* only the editor's own files (`<folder>.*`) are protected, so an earlier
|
|
93
|
+
* template there is the person's. Internal: the experimental `template`
|
|
94
|
+
* command reaches it through `editorThemeTemplate` (api/theme-edit), and it
|
|
95
|
+
* is not part of the public API.
|
|
96
|
+
* @internal
|
|
97
|
+
* @param {{targetPath?: string, overwrite?: boolean, cwd?: string}} options
|
|
98
|
+
* @param {boolean} editorFilesOnly
|
|
99
|
+
* @returns {import('../theme.type.mjs').ThemeTemplateResponse}
|
|
100
|
+
*/
|
|
101
|
+
export function writeThemeTemplate(options, editorFilesOnly) {
|
|
75
102
|
const {
|
|
76
103
|
targetPath = THEME_TEMPLATE_DEFAULT_PATH,
|
|
77
104
|
overwrite = false,
|
|
@@ -100,20 +127,33 @@ export function themeTemplate(options = {}) {
|
|
|
100
127
|
);
|
|
101
128
|
}
|
|
102
129
|
|
|
130
|
+
// The project the folder belongs to bounds the path, as for other theme
|
|
131
|
+
// commands: a path given is read from the current folder, and no path
|
|
132
|
+
// means the project root.
|
|
133
|
+
// With no package.json at or above the folder it writes here, and the CLI
|
|
134
|
+
// prints OUTSIDE_PROJECT_WARNING.
|
|
135
|
+
// Read as every theme command reads a path it writes; a backslash
|
|
136
|
+
// separates folders on every platform.
|
|
137
|
+
const {projectDir, relative: fromRoot} = projectWritePath(
|
|
138
|
+
cwd,
|
|
139
|
+
options.targetPath == null ? undefined : String(targetPath),
|
|
140
|
+
THEME_TEMPLATE_DEFAULT_PATH,
|
|
141
|
+
);
|
|
103
142
|
let resolved;
|
|
104
143
|
try {
|
|
105
|
-
resolved = assertWithin(
|
|
144
|
+
resolved = assertWithin(fromRoot, projectDir, {
|
|
145
|
+
label: 'theme template path',
|
|
146
|
+
});
|
|
106
147
|
} catch (err) {
|
|
107
148
|
if (err instanceof PathSafetyError) {
|
|
108
149
|
throw new AstryxError(
|
|
109
|
-
|
|
150
|
+
// The path as typed, not as read from the project root.
|
|
151
|
+
err.message.replace(`"${fromRoot}"`, `"${targetPath}"`),
|
|
110
152
|
[
|
|
111
153
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
),
|
|
116
|
-
reason: 'write the template in this project',
|
|
154
|
+
// No path: the template at the project root.
|
|
155
|
+
name: formatCliCommand('theme template', cwd),
|
|
156
|
+
reason: 'write the template at the project root',
|
|
117
157
|
},
|
|
118
158
|
],
|
|
119
159
|
ERROR_CODES.ERR_PATH_TRAVERSAL,
|
|
@@ -153,10 +193,39 @@ export function themeTemplate(options = {}) {
|
|
|
153
193
|
);
|
|
154
194
|
}
|
|
155
195
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
196
|
+
// The folder as it is on disk (`themes/T` is `themes/t` on a
|
|
197
|
+
// case-insensitive disk, or through a link).
|
|
198
|
+
const realDir = fs.existsSync(resolved)
|
|
199
|
+
? fs.realpathSync(path.dirname(resolved))
|
|
200
|
+
: path.dirname(resolved);
|
|
201
|
+
const record = fs.existsSync(resolved) ? editorThemeRecord(realDir) : null;
|
|
202
|
+
// The editor's own files are `<folder>.*` beside its settings; with
|
|
203
|
+
// editorFilesOnly any other file there (an earlier template) is the
|
|
204
|
+
// person's.
|
|
205
|
+
// On a case-insensitive disk `T.theme.ts` is `t.theme.ts`: names are
|
|
206
|
+
// compared in any case, and an existing file by what it is on disk.
|
|
207
|
+
const folder = path.basename(realDir).toLowerCase();
|
|
208
|
+
const sameFile = (/** @type {string} */ other) => {
|
|
209
|
+
try {
|
|
210
|
+
const a = fs.statSync(resolved);
|
|
211
|
+
const b = fs.statSync(other);
|
|
212
|
+
return a.ino === b.ino && a.dev === b.dev;
|
|
213
|
+
} catch {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const editorFile =
|
|
218
|
+
record != null &&
|
|
219
|
+
(!editorFilesOnly ||
|
|
220
|
+
path.basename(resolved).toLowerCase().startsWith(`${folder}.`) ||
|
|
221
|
+
fs
|
|
222
|
+
.readdirSync(realDir)
|
|
223
|
+
.some(
|
|
224
|
+
f =>
|
|
225
|
+
f.toLowerCase().startsWith(`${folder}.`) &&
|
|
226
|
+
sameFile(path.join(realDir, f)),
|
|
227
|
+
));
|
|
228
|
+
const editorRecord = overwrite && editorFile ? record : null;
|
|
160
229
|
if (editorRecord) {
|
|
161
230
|
throw new AstryxError(
|
|
162
231
|
`${relative} belongs to a theme the theme editor made (${editorRecord} is beside it). Replacing it would cut the theme off from its settings, so --overwrite does not replace it.`,
|
|
@@ -196,9 +265,7 @@ export function themeTemplate(options = {}) {
|
|
|
196
265
|
if (fs.existsSync(resolved) && !overwrite) {
|
|
197
266
|
// Whether --overwrite would replace this file, and if not, a path that
|
|
198
267
|
// takes the template, so the hint never names a command that refuses.
|
|
199
|
-
const overwritable =
|
|
200
|
-
!editorThemeRecord(path.dirname(resolved)) &&
|
|
201
|
-
isReplaceableThemeFile(resolved);
|
|
268
|
+
const overwritable = !editorFile && isReplaceableThemeFile(resolved);
|
|
202
269
|
return {
|
|
203
270
|
type: 'theme.template',
|
|
204
271
|
data: {
|
|
@@ -212,7 +279,9 @@ export function themeTemplate(options = {}) {
|
|
|
212
279
|
}
|
|
213
280
|
|
|
214
281
|
// Our repo header has no business in someone else's source tree.
|
|
215
|
-
const contents = stripCopyrightHeader(
|
|
282
|
+
const contents = stripCopyrightHeader(
|
|
283
|
+
fs.readFileSync(THEME_TEMPLATE_SRC, 'utf-8'),
|
|
284
|
+
);
|
|
216
285
|
try {
|
|
217
286
|
fs.mkdirSync(path.dirname(resolved), {recursive: true});
|
|
218
287
|
fs.writeFileSync(resolved, contents);
|
|
@@ -223,7 +292,10 @@ export function themeTemplate(options = {}) {
|
|
|
223
292
|
throw new AstryxError(message, undefined, ERROR_CODES.ERR_WRITE_FAILED);
|
|
224
293
|
}
|
|
225
294
|
|
|
226
|
-
return {
|
|
295
|
+
return {
|
|
296
|
+
type: 'theme.template',
|
|
297
|
+
data: {path: relative, written: true, reason: null},
|
|
298
|
+
};
|
|
227
299
|
}
|
|
228
300
|
|
|
229
301
|
/** @param {string} file */
|
|
@@ -32,6 +32,9 @@ export type ThemeBuildResponse = {
|
|
|
32
32
|
*/
|
|
33
33
|
export type ThemeBuildCheckResponse = {
|
|
34
34
|
type: "theme.build.check";
|
|
35
|
+
/**
|
|
36
|
+
* `code` is set when the outputs are stale or missing (exit 1).
|
|
37
|
+
*/
|
|
35
38
|
data: {
|
|
36
39
|
name: string;
|
|
37
40
|
upToDate: boolean;
|
|
@@ -40,6 +43,7 @@ export type ThemeBuildCheckResponse = {
|
|
|
40
43
|
reason: "missing" | "outdated";
|
|
41
44
|
}>;
|
|
42
45
|
checked: string[];
|
|
46
|
+
code?: "ERR_THEME_STALE";
|
|
43
47
|
};
|
|
44
48
|
};
|
|
45
49
|
/**
|
|
@@ -281,7 +285,7 @@ export type TonalPaletteFamilyInput = {
|
|
|
281
285
|
* `neutral` derives the ramp from
|
|
282
286
|
* `neutralProfile` instead of the seed hue; defaults to `chromatic`.
|
|
283
287
|
*/
|
|
284
|
-
kind?: "
|
|
288
|
+
kind?: "chromatic" | "neutral" | undefined;
|
|
285
289
|
/**
|
|
286
290
|
* Colors pinned at specific stops.
|
|
287
291
|
*/
|
package/api/theme/theme.type.mjs
CHANGED
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
* astryx --json theme build <file> --check
|
|
39
39
|
* @typedef {object} ThemeBuildCheckResponse
|
|
40
40
|
* @property {'theme.build.check'} type
|
|
41
|
-
* @property {{name: string, upToDate: boolean, stale: Array<{path: string, reason: 'missing' | 'outdated'}>, checked: string[]}} data
|
|
41
|
+
* @property {{name: string, upToDate: boolean, stale: Array<{path: string, reason: 'missing' | 'outdated'}>, checked: string[], code?: 'ERR_THEME_STALE'}} data
|
|
42
|
+
* `code` is set when the outputs are stale or missing (exit 1).
|
|
42
43
|
*/
|
|
43
44
|
|
|
44
45
|
/**
|