@astryxdesign/cli 0.7.15 → 0.7.16-canary.g22213fd
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 +6 -4
- package/api/build/_adapter.d.mts +10 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/blocks/blocks.d.mts +1 -0
- package/api/build/blocks/blocks.mjs +18 -1
- package/api/build/kit/shell.weights.json +1 -0
- package/api/build/kit/shellcall.d.mts +26 -0
- package/api/build/kit/shellcall.mjs +87 -0
- package/api/build/kit/start.mjs +67 -4
- package/api/build/kit/weights.d.mts +15 -0
- package/api/build/kit/weights.mjs +27 -0
- package/api/component/__fixtures__/resolutions/modules.txt +1 -1
- package/api/component/_adapter.d.mts +1 -1
- package/api/component/_adapter.mjs +28 -1
- package/api/doctor/_adapter.d.mts +38 -2
- package/api/doctor/_adapter.mjs +76 -1
- package/api/doctor/built-checks.mjs +1 -1
- package/api/doctor/doctor.d.mts +26 -0
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.mjs +156 -11
- package/api/doctor/theme-checks.mjs +163 -18
- package/api/icon/_adapter.d.mts +7 -3
- package/api/icon/_adapter.mjs +12 -3
- package/api/icon/icon.type.d.mts +15 -0
- package/api/icon/icon.type.mjs +10 -3
- package/api/icon/iconUse.doc.mjs +19 -5
- package/api/icon/list/list.mjs +7 -1
- package/api/icon/use/use.d.mts +8 -5
- package/api/icon/use/use.mjs +95 -13
- package/api/init/run/run.mjs +1 -0
- package/api/integration/add-contribution.mjs +3 -3
- package/api/integration/pack-check.mjs +14 -8
- package/api/integration/validate-integration.mjs +1 -1
- package/api/search/_adapter.mjs +15 -16
- package/api/search/_entries.d.mts +2 -1
- package/api/search/_entries.mjs +28 -1
- package/api/swizzle/_moduleGraph.mjs +1 -1
- package/api/template/template.type.d.mts +6 -2
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +5 -2
- package/api/theme/_adapter.mjs +59 -14
- package/api/theme/_fork.mjs +1 -1
- package/api/theme/build/build.d.mts +120 -32
- package/api/theme/build/build.mjs +471 -111
- package/api/theme/eject/eject.mjs +22 -1
- package/api/theme/generateTonalPalette.doc.mjs +2 -2
- package/api/theme/palette/generate/generator.mjs +141 -2
- package/api/theme/template/template.d.mts +19 -0
- package/api/theme/template/template.mjs +102 -25
- package/api/theme/theme.type.d.mts +44 -1
- package/api/theme/theme.type.mjs +23 -1
- package/api/theme/themeBuild.doc.mjs +4 -4
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +9 -3
- package/api/theme-edit/_adapter.d.mts +33 -2
- package/api/theme-edit/_adapter.mjs +276 -41
- package/api/theme-edit/_check.d.mts +93 -4
- package/api/theme-edit/_check.mjs +1712 -223
- 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 +31 -1
- package/api/theme-edit/_context.mjs +445 -41
- package/api/theme-edit/_css.d.mts +60 -1
- package/api/theme-edit/_css.mjs +404 -28
- package/api/theme-edit/_edit.d.mts +25 -0
- package/api/theme-edit/_edit.mjs +1620 -154
- 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 +15 -0
- package/api/theme-edit/_how-question.mjs +1469 -194
- package/api/theme-edit/_how.mjs +144 -30
- package/api/theme-edit/_marks.d.mts +13 -0
- package/api/theme-edit/_marks.mjs +15 -0
- package/api/theme-edit/_overview.mjs +2 -0
- package/api/theme-edit/_palette.d.mts +38 -0
- package/api/theme-edit/_palette.mjs +306 -73
- package/api/theme-edit/_parts.d.mts +33 -0
- package/api/theme-edit/_parts.mjs +138 -9
- package/api/theme-edit/_png.d.mts +18 -0
- package/api/theme-edit/_png.mjs +95 -14
- package/api/theme-edit/_preview-app.d.mts +55 -1
- package/api/theme-edit/_preview-app.mjs +1552 -101
- package/api/theme-edit/_preview.d.mts +71 -3
- package/api/theme-edit/_preview.mjs +565 -35
- package/api/theme-edit/_project.d.mts +15 -0
- package/api/theme-edit/_project.mjs +68 -13
- package/api/theme-edit/_settings.d.mts +299 -5
- package/api/theme-edit/_settings.mjs +2806 -158
- package/api/theme-edit/_tables.d.mts +24 -0
- package/api/theme-edit/_tables.mjs +212 -150
- 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 +31 -2
- package/api/theme-edit/theme-edit.type.mjs +10 -2
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
- package/api/theme-edit/themeEditShow.doc.mjs +11 -3
- package/api/upgrade/registry/registry.mjs +6 -1
- package/assets/codemods/parse.mjs +2 -2
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.zh.mjs +4 -3
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +63 -8
- 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/package.json +1 -0
- package/assets/preview-app/src/app/globals.css +1 -0
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs +21 -0
- package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx +62 -0
- 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/ai-chat/page.tsx +20 -2
- package/assets/templates/pages/dashboard/page.tsx +1 -1
- package/assets/templates/themes/neutral/neutralPalettes.generated.receipt.json +2 -0
- package/authoring/config/config.doc.mjs +8 -0
- package/authoring/config/parse.d.mts +1 -0
- package/authoring/config/parse.mjs +12 -0
- package/authoring/config/type.ts +8 -0
- 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/icon-set/icon-set-data.doc.mjs +3 -3
- package/authoring/doctypes/legacy.mjs +5 -1
- package/authoring/index.d.ts +1 -0
- package/authoring/shadcn/source-variants.d.mts +1 -1
- package/authoring/shadcn/source-variants.mjs +32 -10
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/doctor.doc.mjs +2 -2
- package/clients/cli/commands/experimental/icon.mjs +61 -6
- package/clients/cli/commands/experimental/theme.mjs +244 -45
- package/clients/cli/commands/experimental-icon-use.doc.mjs +12 -5
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- 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-preview-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.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.doc.mjs +7 -2
- package/clients/cli/commands/theme.mjs +222 -55
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +7 -4
- package/clients/cli/index.mjs +25 -5
- 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 +72 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +49 -0
- package/foundation/agent-docs/agent-docs-target.d.mts +2 -6
- package/foundation/agent-docs/agent-docs-target.mjs +9 -17
- package/foundation/agent-docs/agent-docs.mjs +4 -3
- package/foundation/config/config-writer.d.mts +23 -0
- package/foundation/config/config-writer.mjs +152 -58
- package/foundation/config/project.mjs +103 -16
- package/foundation/discovery/component-discovery.mjs +11 -22
- package/foundation/discovery/icon-set-checks.mjs +164 -48
- package/foundation/discovery/icon-set-discovery.d.mts +38 -5
- package/foundation/discovery/icon-set-discovery.mjs +50 -6
- package/foundation/discovery/icon-set-theme-maps.d.mts +59 -0
- package/foundation/discovery/icon-set-theme-maps.mjs +95 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -3
- package/foundation/discovery/icon-set-writer.mjs +58 -17
- package/foundation/discovery/module-exports.mjs +1 -15
- package/foundation/discovery/template-adapter.mjs +44 -19
- package/foundation/discovery/template-icons.d.mts +27 -10
- package/foundation/discovery/template-icons.mjs +142 -26
- package/foundation/discovery/template-source-tree.mjs +3 -16
- package/foundation/discovery/theme-discovery.d.mts +30 -1
- package/foundation/discovery/theme-discovery.mjs +109 -50
- package/foundation/fs/exact-codec.d.mts +35 -0
- package/foundation/fs/exact-codec.mjs +148 -0
- package/foundation/fs/gather-cache.d.mts +15 -5
- package/foundation/fs/gather-cache.mjs +129 -31
- package/foundation/fs/paths.d.mts +39 -0
- package/foundation/fs/paths.mjs +44 -11
- package/foundation/fs/read-record.mjs +11 -1
- package/foundation/integrations/autolink.d.mts +4 -2
- package/foundation/integrations/autolink.mjs +4 -2
- package/foundation/integrations/cli-requirement.d.mts +16 -5
- package/foundation/integrations/cli-requirement.mjs +27 -6
- package/foundation/integrations/contribution-fixes.mjs +1 -16
- package/foundation/integrations/may-have-integrations.mjs +7 -3
- package/foundation/integrations/missing-dependency.d.mts +9 -0
- package/foundation/integrations/missing-dependency.mjs +100 -0
- package/foundation/integrations/public-imports.mjs +1 -1
- package/foundation/render/embedded-imports.mjs +1 -1
- 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/foundation/runtime/lazy-dependencies.d.mts +14 -0
- package/foundation/runtime/lazy-dependencies.mjs +82 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
package/api/icon/use/use.mjs
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file `icon.use` leaf (AST-084 FR8): choose the project's main icon set,
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* any backup sets in order, and the look its icons draw, by writing
|
|
6
|
+
* `experimental.iconSet` and `experimental.iconVariant` in astryx.config in
|
|
7
|
+
* one write. With no backup it writes the set name as a string; with backups
|
|
8
|
+
* it writes a list, the main set first. With no variant it removes
|
|
9
|
+
* `experimental.iconVariant`, so the sets draw their default looks.
|
|
8
10
|
*
|
|
9
11
|
* @output the `icon.use` envelope
|
|
10
12
|
* @position api/icon/use — dispatched by the `experimental icon use` command
|
|
@@ -17,9 +19,12 @@ import {
|
|
|
17
19
|
iconSetConfigCliWarning,
|
|
18
20
|
iconSetKey,
|
|
19
21
|
loadIconProject,
|
|
22
|
+
lookThemeMap,
|
|
20
23
|
ICON_USE_ORDER_COMMAND,
|
|
21
24
|
refuseOutsideProject,
|
|
22
|
-
|
|
25
|
+
setConfigValues,
|
|
26
|
+
iconSetLook,
|
|
27
|
+
iconUseCommand,
|
|
23
28
|
unlistedIconSets,
|
|
24
29
|
} from '../_adapter.mjs';
|
|
25
30
|
import {setsNamed, unusableSet} from '../_records.mjs';
|
|
@@ -46,21 +51,69 @@ function oneSet(sets, withdrawn, selector) {
|
|
|
46
51
|
return named[0];
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Refuse a variant the main set does not declare: the look a project picks
|
|
56
|
+
* is one of its main set's looks.
|
|
57
|
+
* @param {import('../../../foundation/discovery/icon-set-discovery.mjs').DiscoveredIconSet} main
|
|
58
|
+
* @param {string} selector
|
|
59
|
+
* @param {string[]} backups
|
|
60
|
+
* @param {unknown} variant
|
|
61
|
+
*/
|
|
62
|
+
function checkVariant(main, selector, backups, variant) {
|
|
63
|
+
if (typeof variant !== 'string' || variant.trim() === '') {
|
|
64
|
+
throw new AstryxError(
|
|
65
|
+
'Name the variant every icon draws, or leave out --variant',
|
|
66
|
+
[
|
|
67
|
+
{
|
|
68
|
+
name: `astryx experimental icon --list`,
|
|
69
|
+
reason: "each installed set's variants",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
const declared = main.data.variants ?? [];
|
|
76
|
+
if (declared.includes(variant)) return;
|
|
77
|
+
const fallback = main.data.default?.variant;
|
|
78
|
+
throw new AstryxError(
|
|
79
|
+
declared.length === 0
|
|
80
|
+
? `Icon set "${iconSetKey(main)}" declares no variants: it draws one look, so it takes no --variant.`
|
|
81
|
+
: `Icon set "${iconSetKey(main)}" declares no "${variant}" variant. Its variants: ${declared.join(', ')}.`,
|
|
82
|
+
declared.length === 0
|
|
83
|
+
? [
|
|
84
|
+
{
|
|
85
|
+
name: iconUseCommand(selector, backups),
|
|
86
|
+
reason: 'use it in its one look',
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
|
+
: declared.map(each => ({
|
|
90
|
+
name: iconUseCommand(selector, backups, each),
|
|
91
|
+
reason:
|
|
92
|
+
each === fallback
|
|
93
|
+
? `its default look, ${each}`
|
|
94
|
+
: `its ${each} look`,
|
|
95
|
+
})),
|
|
96
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
49
100
|
/**
|
|
50
101
|
* Make an installed set the project's main icon set, with backup sets in
|
|
51
|
-
* order
|
|
52
|
-
* that has its meaning
|
|
102
|
+
* order, and choose the look its icons draw. A copied template takes each
|
|
103
|
+
* icon from the first set in the list that has its meaning, in the project's
|
|
104
|
+
* variant when that set's icon has it.
|
|
53
105
|
* Experimental (spec:AST-017 FR27): may change or be removed in a patch
|
|
54
106
|
* release.
|
|
55
107
|
* @experimental
|
|
56
108
|
* @param {string} selector a set name, or `<package>/<set>`
|
|
57
|
-
* @param {{cwd?: string, backups?: string[]}} [options]
|
|
58
|
-
* backup sets, in order
|
|
109
|
+
* @param {{cwd?: string, backups?: string[], variant?: string}} [options]
|
|
110
|
+
* `backups`: the backup sets, in order; `variant`: the look every icon
|
|
111
|
+
* draws, one of the main set's variants
|
|
59
112
|
* @returns {Promise<import('../icon.type.mjs').IconUseResponse>}
|
|
60
113
|
*/
|
|
61
114
|
export async function iconUse(
|
|
62
115
|
selector,
|
|
63
|
-
{cwd = process.cwd(), backups = []} = {},
|
|
116
|
+
{cwd = process.cwd(), backups = [], variant} = {},
|
|
64
117
|
) {
|
|
65
118
|
if (typeof selector !== 'string' || selector.trim() === '') {
|
|
66
119
|
throw new AstryxError(
|
|
@@ -79,7 +132,12 @@ export async function iconUse(
|
|
|
79
132
|
);
|
|
80
133
|
}
|
|
81
134
|
refuseOutsideProject(cwd, 'experimental icon use', 'the app project');
|
|
82
|
-
const {
|
|
135
|
+
const {
|
|
136
|
+
projectDir,
|
|
137
|
+
sets,
|
|
138
|
+
withdrawn,
|
|
139
|
+
variant: configured,
|
|
140
|
+
} = await loadIconProject(cwd);
|
|
83
141
|
const main = oneSet(sets, withdrawn, selector);
|
|
84
142
|
const backupSets = backups.map(each => oneSet(sets, withdrawn, each));
|
|
85
143
|
const listed = [main, ...backupSets];
|
|
@@ -91,10 +149,16 @@ export async function iconUse(
|
|
|
91
149
|
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
92
150
|
);
|
|
93
151
|
}
|
|
152
|
+
if (variant !== undefined) checkVariant(main, selector, backups, variant);
|
|
94
153
|
const value = backups.length > 0 ? [selector, ...backups] : selector;
|
|
154
|
+
// One write: the sets, and the look, which is removed when none is named.
|
|
155
|
+
/** @type {Array<[string, string | string[] | null]>} */
|
|
156
|
+
const fields = [['experimental.iconSet', value]];
|
|
157
|
+
if (variant !== undefined) fields.push(['experimental.iconVariant', variant]);
|
|
158
|
+
else if (configured != null) fields.push(['experimental.iconVariant', null]);
|
|
95
159
|
let written;
|
|
96
160
|
try {
|
|
97
|
-
written =
|
|
161
|
+
written = setConfigValues(projectDir, fields);
|
|
98
162
|
} catch (error) {
|
|
99
163
|
// A protected config, or an unreadable protection source, keeps the
|
|
100
164
|
// stable code every consumer-file writer uses (spec:AST-040 FR4, FR6).
|
|
@@ -109,17 +173,21 @@ export async function iconUse(
|
|
|
109
173
|
stable ?? ERROR_CODES.ERR_WRITE_FAILED,
|
|
110
174
|
);
|
|
111
175
|
}
|
|
176
|
+
const previousVariant = written.previous[1] ?? null;
|
|
112
177
|
// An older CLI the project may still run refuses the value just written.
|
|
113
178
|
const warning = iconSetConfigCliWarning(projectDir, {
|
|
114
179
|
list: Array.isArray(value),
|
|
180
|
+
variant: variant !== undefined,
|
|
115
181
|
});
|
|
116
182
|
// Doctor fails a project that installs several sets and leaves one out.
|
|
117
183
|
const unlistedSets = sets.filter(set => !listed.includes(set));
|
|
118
184
|
const unlisted = unlistedSets.map(iconSetKey);
|
|
119
185
|
const left =
|
|
120
186
|
unlistedSets.length > 0
|
|
121
|
-
? unlistedIconSets(sets, main, backupSets, unlistedSets)
|
|
187
|
+
? unlistedIconSets(sets, main, backupSets, unlistedSets, variant)
|
|
122
188
|
: null;
|
|
189
|
+
const themeMap =
|
|
190
|
+
variant === undefined ? null : lookThemeMap(main.data, variant);
|
|
123
191
|
return {
|
|
124
192
|
type: 'icon.use',
|
|
125
193
|
data: {
|
|
@@ -129,11 +197,25 @@ export async function iconUse(
|
|
|
129
197
|
iconSet: each,
|
|
130
198
|
set: iconSetKey(backupSets[index]),
|
|
131
199
|
})),
|
|
200
|
+
variant: variant ?? null,
|
|
132
201
|
config: path.relative(projectDir, written.file).split(path.sep).join('/'),
|
|
133
202
|
created: written.created,
|
|
134
|
-
previous: written.previous,
|
|
203
|
+
previous: written.previous[0] ?? null,
|
|
204
|
+
previousVariant:
|
|
205
|
+
typeof previousVariant === 'string' ? previousVariant : null,
|
|
135
206
|
changed: written.changed,
|
|
136
207
|
unlisted,
|
|
208
|
+
...(variant !== undefined
|
|
209
|
+
? {
|
|
210
|
+
looks: listed.map(set => ({
|
|
211
|
+
set: iconSetKey(set),
|
|
212
|
+
variant: iconSetLook(set, variant),
|
|
213
|
+
})),
|
|
214
|
+
}
|
|
215
|
+
: {}),
|
|
216
|
+
...(themeMap
|
|
217
|
+
? {themeMap: {module: main.data.module, export: themeMap}}
|
|
218
|
+
: {}),
|
|
137
219
|
...(left ? {next: `${left.problem}. ${left.fix}`} : {}),
|
|
138
220
|
...(warning ? {warning} : {}),
|
|
139
221
|
},
|
package/api/init/run/run.mjs
CHANGED
|
@@ -64,6 +64,7 @@ export function getNextSteps(invocation) {
|
|
|
64
64
|
" import { themes, defaultThemeSlug } from './astryx-themes'",
|
|
65
65
|
' <Theme theme={themes[defaultThemeSlug]}>...</Theme>',
|
|
66
66
|
` Extend an imported theme to customize it. Run \`${invocation} theme eject <slug>\` only to fork source.`,
|
|
67
|
+
` To make or change a theme: the experimental theme editor, \`${invocation} experimental theme editor new <name> --like neutral\` (then editor set / editor how).`,
|
|
67
68
|
` 5. ${invocation} --help for all commands`,
|
|
68
69
|
'',
|
|
69
70
|
];
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import * as fs from 'node:fs';
|
|
15
15
|
import * as path from 'node:path';
|
|
16
|
-
import jscodeshift from '
|
|
16
|
+
import {jscodeshift as loadJscodeshift} from '../../foundation/runtime/lazy-dependencies.mjs';
|
|
17
17
|
import {AstryxError} from '../error.mjs';
|
|
18
18
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
19
19
|
import {
|
|
@@ -928,8 +928,8 @@ async function addAgentDoc(line, options) {
|
|
|
928
928
|
const source = manifestExists
|
|
929
929
|
? fs.readFileSync(manifestFile, 'utf-8')
|
|
930
930
|
: 'export default {};\n';
|
|
931
|
-
const j =
|
|
932
|
-
/** @type {ReturnType<ReturnType<typeof
|
|
931
|
+
const j = loadJscodeshift().withParser('tsx');
|
|
932
|
+
/** @type {ReturnType<ReturnType<ReturnType<typeof loadJscodeshift>['withParser']>>} */
|
|
933
933
|
let ast;
|
|
934
934
|
try {
|
|
935
935
|
ast = j(source);
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
} from '../../foundation/discovery/docs-discovery.mjs';
|
|
50
50
|
import {discoverIntegrationThemes} from '../../foundation/discovery/theme-discovery.mjs';
|
|
51
51
|
import {inspectPackageExport} from '../../foundation/discovery/package-exports.mjs';
|
|
52
|
-
import {
|
|
52
|
+
import {babelParse as parseModule} from '../../foundation/runtime/lazy-dependencies.mjs';
|
|
53
53
|
import {moduleExportsName} from '../../foundation/discovery/module-exports.mjs';
|
|
54
54
|
import {
|
|
55
55
|
ThemeImportError,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
} from '../../foundation/discovery/theme-imports.mjs';
|
|
58
58
|
import {
|
|
59
59
|
normalizeThemeBuildForCompare,
|
|
60
|
-
|
|
60
|
+
themeBuildWithHandOff,
|
|
61
61
|
} from '../theme/build/build.mjs';
|
|
62
62
|
import {
|
|
63
63
|
discoverIntegrationComponents,
|
|
@@ -641,8 +641,12 @@ async function validateIncompleteThemeExports(
|
|
|
641
641
|
if (outputs.some(output => output.kind !== 'font stylesheet')) {
|
|
642
642
|
// The scratch directory is the write root; the package stays the cwd,
|
|
643
643
|
// so the build selects the package's Core and its paths as before.
|
|
644
|
-
const
|
|
645
|
-
|
|
644
|
+
const receipt = await themeBuildWithHandOff(
|
|
645
|
+
source,
|
|
646
|
+
{out: expectedCss},
|
|
647
|
+
{cwd: packageDir},
|
|
648
|
+
{writeRoot: expectedDir},
|
|
649
|
+
);
|
|
646
650
|
if (receipt == null || receipt.type !== 'theme.build') {
|
|
647
651
|
throw new Error('the theme build produced no complete receipt');
|
|
648
652
|
}
|
|
@@ -1079,10 +1083,12 @@ async function validatePackedThemeExports(
|
|
|
1079
1083
|
try {
|
|
1080
1084
|
// The scratch directory is the write root; the package stays the cwd,
|
|
1081
1085
|
// so the build selects the package's Core and its paths as before.
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
+
const receipt = await themeBuildWithHandOff(
|
|
1087
|
+
source,
|
|
1088
|
+
{out: expectedCss},
|
|
1089
|
+
{cwd: localIntegration.__packageDir},
|
|
1090
|
+
{writeRoot: expectedDir},
|
|
1091
|
+
);
|
|
1086
1092
|
if (receipt == null || receipt.type !== 'theme.build') {
|
|
1087
1093
|
issues.push(
|
|
1088
1094
|
error(
|
|
@@ -293,7 +293,7 @@ async function findUnreachableContributionIssues(
|
|
|
293
293
|
issues.push(
|
|
294
294
|
warning(
|
|
295
295
|
'unreachable_contribution',
|
|
296
|
-
`Found contribution metadata "${path.relative(packageDir, full)}" outside every declared integration root, so it contributes nothing. ${unreachableFix(context, full, stamp)}`,
|
|
296
|
+
`Found contribution metadata "${path.relative(packageDir, full).split(path.sep).join('/')}" outside every declared integration root, so it contributes nothing. ${unreachableFix(context, full, stamp)}`,
|
|
297
297
|
),
|
|
298
298
|
);
|
|
299
299
|
}
|
package/api/search/_adapter.mjs
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* domain, _gather-*.mjs) and loads the tree's static data before it runs.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {readFileSync
|
|
9
|
+
import {readFileSync} from 'node:fs';
|
|
10
10
|
import * as path from 'node:path';
|
|
11
|
-
import {requireCoreDir} from '../../foundation/fs/paths.mjs';
|
|
11
|
+
import {realDir, requireCoreDir} from '../../foundation/fs/paths.mjs';
|
|
12
12
|
import {withListingCache} from '../../foundation/fs/listing-cache.mjs';
|
|
13
13
|
import {persistedGather} from '../../foundation/fs/gather-cache.mjs';
|
|
14
14
|
import {
|
|
@@ -130,19 +130,6 @@ async function gatherDomains(options) {
|
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* The folder's real path, so a link and its target share a kept gather.
|
|
135
|
-
* @param {string} dir
|
|
136
|
-
* @returns {string}
|
|
137
|
-
*/
|
|
138
|
-
function realFolder(dir) {
|
|
139
|
-
try {
|
|
140
|
-
return realpathSync(dir);
|
|
141
|
-
} catch {
|
|
142
|
-
return dir;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
133
|
/**
|
|
147
134
|
* A gathered catalog as plain JSON and back, for a gather kept between runs
|
|
148
135
|
* (persistedGather). A template's derived component names are read once and
|
|
@@ -150,6 +137,18 @@ function realFolder(dir) {
|
|
|
150
137
|
* objects it shares.
|
|
151
138
|
*/
|
|
152
139
|
const GATHER_CODEC = {
|
|
140
|
+
/**
|
|
141
|
+
* The shape a read-back gather needs: its candidates and components.
|
|
142
|
+
* @param {any} gathered
|
|
143
|
+
*/
|
|
144
|
+
valid: gathered =>
|
|
145
|
+
gathered != null &&
|
|
146
|
+
Array.isArray(gathered.all) &&
|
|
147
|
+
Array.isArray(gathered.components) &&
|
|
148
|
+
gathered.all.every(
|
|
149
|
+
(/** @type {any} */ c) => c != null && typeof c === 'object',
|
|
150
|
+
) &&
|
|
151
|
+
gathered.components.every((/** @type {any} */ c) => c != null),
|
|
153
152
|
/**
|
|
154
153
|
* @param {any} gathered
|
|
155
154
|
* @returns {any}
|
|
@@ -264,7 +263,7 @@ export function gatherCandidatesReused(options) {
|
|
|
264
263
|
gather = reusedWhileUnchanged(
|
|
265
264
|
() =>
|
|
266
265
|
persistedGather(
|
|
267
|
-
[
|
|
266
|
+
[realDir(cwd), type ?? null],
|
|
268
267
|
() => gatherCandidates({cwd, type}),
|
|
269
268
|
GATHER_CODEC,
|
|
270
269
|
// A gather that skipped Core (a failed install still in its
|
|
@@ -17,11 +17,12 @@ export function entryTable(all: any[], cards: Record<string, {
|
|
|
17
17
|
* A table's plain-JSON form and back. Candidates are kept as their place in
|
|
18
18
|
* `all`, maps as their entries in order, so the table reads back the same.
|
|
19
19
|
* @param {any[]} all
|
|
20
|
-
* @returns {{encode: (table: EntryTable) => any, decode: (stored: any) => EntryTable}}
|
|
20
|
+
* @returns {{encode: (table: EntryTable) => any, decode: (stored: any) => EntryTable, valid: (table: any) => boolean}}
|
|
21
21
|
*/
|
|
22
22
|
export function tableCodec(all: any[]): {
|
|
23
23
|
encode: (table: EntryTable) => any;
|
|
24
24
|
decode: (stored: any) => EntryTable;
|
|
25
|
+
valid: (table: any) => boolean;
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
28
|
* @param {any[]} all
|
package/api/search/_entries.mjs
CHANGED
|
@@ -97,10 +97,37 @@ let last = null;
|
|
|
97
97
|
* A table's plain-JSON form and back. Candidates are kept as their place in
|
|
98
98
|
* `all`, maps as their entries in order, so the table reads back the same.
|
|
99
99
|
* @param {any[]} all
|
|
100
|
-
* @returns {{encode: (table: EntryTable) => any, decode: (stored: any) => EntryTable}}
|
|
100
|
+
* @returns {{encode: (table: EntryTable) => any, decode: (stored: any) => EntryTable, valid: (table: any) => boolean}}
|
|
101
101
|
*/
|
|
102
102
|
export function tableCodec(all) {
|
|
103
103
|
return {
|
|
104
|
+
/**
|
|
105
|
+
* The shape a read-back table needs: a candidate for every id, and its
|
|
106
|
+
* fields.
|
|
107
|
+
* @param {any} table
|
|
108
|
+
*/
|
|
109
|
+
valid: table =>
|
|
110
|
+
table != null &&
|
|
111
|
+
Array.isArray(table.ids) &&
|
|
112
|
+
Array.isArray(table.candidate) &&
|
|
113
|
+
table.candidate.length === table.ids.length &&
|
|
114
|
+
table.candidate.every((/** @type {any} */ c) => c != null) &&
|
|
115
|
+
Array.isArray(table.domain) &&
|
|
116
|
+
table.domain.length === table.ids.length &&
|
|
117
|
+
Array.isArray(table.name) &&
|
|
118
|
+
table.name.length === table.ids.length &&
|
|
119
|
+
table.fields != null &&
|
|
120
|
+
['name', 'desc', 'card'].every(f => {
|
|
121
|
+
const field = table.fields[f];
|
|
122
|
+
return (
|
|
123
|
+
field != null &&
|
|
124
|
+
field.post instanceof Map &&
|
|
125
|
+
field.idf instanceof Map &&
|
|
126
|
+
Array.isArray(field.len) &&
|
|
127
|
+
field.len.length === table.ids.length &&
|
|
128
|
+
typeof field.avg === 'number'
|
|
129
|
+
);
|
|
130
|
+
}),
|
|
104
131
|
encode(table) {
|
|
105
132
|
const place = new Map(all.map((c, k) => [c, k]));
|
|
106
133
|
const t = /** @type {any} */ (table);
|
|
@@ -15,7 +15,7 @@ import * as path from 'node:path';
|
|
|
15
15
|
import {isBuiltin} from 'node:module';
|
|
16
16
|
import {packageOf} from '../../foundation/render/served-packages.mjs';
|
|
17
17
|
import {resolveInstalledPackageDir} from '../../foundation/integrations/installed-package.mjs';
|
|
18
|
-
import {parse} from '
|
|
18
|
+
import {babelParse as parse} from '../../foundation/runtime/lazy-dependencies.mjs';
|
|
19
19
|
import {
|
|
20
20
|
inspectPackageExport,
|
|
21
21
|
sourceExportTarget,
|
|
@@ -132,12 +132,16 @@ export type TemplateIconsReport = {
|
|
|
132
132
|
* The main set and each backup set as `<package>/<set>`, in the order icons are looked up; present when the project lists backups.
|
|
133
133
|
*/
|
|
134
134
|
order?: string[] | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* The look the project's icons draw, as `experimental.iconVariant` names it; present when it is set.
|
|
137
|
+
*/
|
|
138
|
+
variant?: string | undefined;
|
|
135
139
|
/**
|
|
136
140
|
* Why the project has that set, or none.
|
|
137
141
|
*/
|
|
138
142
|
reason: string;
|
|
139
143
|
/**
|
|
140
|
-
* Icons rewritten to the first set in the project's list that has them, and the rule that chose each one: a reviewed `exact` or `strong` match,
|
|
144
|
+
* Icons rewritten to the first set in the project's list that has them, and the rule that chose each one: a reviewed `exact` or `strong` match, the icon the set's `map` names for the icon definition the template declares, or `variant`, an icon the template already imports from a set in the list, moved to its export for the project's variant. `target.set` names the set used. `dropped` names the library's sizing props (`size`, `strokeWidth`, `absoluteStrokeWidth`) removed from the icon's elements: an icon set's icons take their size from CSS. `variant` is present when the look asked for, the project's variant or else the look the template's icon draws, is one the set's icon does not have: that look and the set's default look used instead.
|
|
141
145
|
*/
|
|
142
146
|
mapped: Array<{
|
|
143
147
|
source: {
|
|
@@ -151,7 +155,7 @@ export type TemplateIconsReport = {
|
|
|
151
155
|
module: string;
|
|
152
156
|
export: string;
|
|
153
157
|
};
|
|
154
|
-
by: "match" | "definition";
|
|
158
|
+
by: "match" | "definition" | "variant";
|
|
155
159
|
dropped?: string[];
|
|
156
160
|
variant?: {
|
|
157
161
|
asked: string;
|
|
@@ -98,8 +98,9 @@
|
|
|
98
98
|
* @property {'selected' | 'none' | 'ambiguous' | 'missing' | 'withdrawn'} status The project's icon-set state.
|
|
99
99
|
* @property {string | null} set The project's main icon set as `<package>/<set>`, when selected.
|
|
100
100
|
* @property {string[]} [order] The main set and each backup set as `<package>/<set>`, in the order icons are looked up; present when the project lists backups.
|
|
101
|
+
* @property {string} [variant] The look the project's icons draw, as `experimental.iconVariant` names it; present when it is set.
|
|
101
102
|
* @property {string} reason Why the project has that set, or none.
|
|
102
|
-
* @property {Array<{source: {module: string, export: string}, target: {set: string, package: string, id: string, module: string, export: string}, by: 'match' | 'definition', dropped?: string[], variant?: {asked: string, used: string | null}}>} mapped Icons rewritten to the first set in the project's list that has them, and the rule that chose each one: a reviewed `exact` or `strong` match,
|
|
103
|
+
* @property {Array<{source: {module: string, export: string}, target: {set: string, package: string, id: string, module: string, export: string}, by: 'match' | 'definition' | 'variant', dropped?: string[], variant?: {asked: string, used: string | null}}>} mapped Icons rewritten to the first set in the project's list that has them, and the rule that chose each one: a reviewed `exact` or `strong` match, the icon the set's `map` names for the icon definition the template declares, or `variant`, an icon the template already imports from a set in the list, moved to its export for the project's variant. `target.set` names the set used. `dropped` names the library's sizing props (`size`, `strokeWidth`, `absoluteStrokeWidth`) removed from the icon's elements: an icon set's icons take their size from CSS. `variant` is present when the look asked for, the project's variant or else the look the template's icon draws, is one the set's icon does not have: that look and the set's default look used instead.
|
|
103
104
|
* @property {Array<{source: {module: string, export: string}, target: {local: string}, definitions: string[], fixes: string[], dropped?: string[], suggestion?: {set: string, id: string, module: string, export: string, confidence: 'likely'}}>} placeholder Icons with a meaning that no set in the project's list has. The template's original import is removed. The written code declares a small placeholder component once (`target.local`, `MissingIcon` unless the file already uses that name), and each use of the icon renders it, with a comment that names the meaning. It needs no package. `fixes` are the commands that give it a real icon: map the definition in the main set, or add a backup set that has it.
|
|
104
105
|
* @property {Array<{module: string | null, export: string, reason: string, suggestion?: {set: string, id: string, module: string, export: string, confidence: 'likely'}}>} kept Icons left as the template wrote them, with why, and a `likely` reviewed match as a suggestion when the project set has one. Every declared key is mapped, a placeholder, or kept; `module` is null for a key the template does not import, and `export` is `default` for a default import and `*` for a namespace import.
|
|
105
106
|
* @property {Array<{set: string, license: string, icons: number}>} sets Each set the mapped icons come from, as `<package>/<set>`, with its license and how many icons it gave.
|
package/api/theme/_adapter.d.mts
CHANGED
|
@@ -78,8 +78,10 @@ export function listUnmigratedThemeCopies(cwd: string): import("../../foundation
|
|
|
78
78
|
* @param {{cwd: string, targetPath?: string, overwrite?: boolean, takenSlugs?: Set<string>}} options
|
|
79
79
|
* `takenSlugs`: the slugs of the themes the project can use, which a fork's
|
|
80
80
|
* new folder name may not take
|
|
81
|
-
* @returns {{outputDir: string, files: string[]
|
|
82
|
-
* directory
|
|
81
|
+
* @returns {{outputDir: string, files: string[], editorFolder: string | null}}
|
|
82
|
+
* the output directory relative to the working folder, the files written,
|
|
83
|
+
* named as the fork names them, and the folder the theme editor made that
|
|
84
|
+
* holds the fork, relative to the working folder, or null
|
|
83
85
|
*/
|
|
84
86
|
export function ejectThemeFiles(theme: import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme, { cwd, targetPath: typedPath, overwrite, takenSlugs }: {
|
|
85
87
|
cwd: string;
|
|
@@ -89,6 +91,7 @@ export function ejectThemeFiles(theme: import("../../foundation/discovery/theme-
|
|
|
89
91
|
}): {
|
|
90
92
|
outputDir: string;
|
|
91
93
|
files: string[];
|
|
94
|
+
editorFolder: string | null;
|
|
92
95
|
};
|
|
93
96
|
/**
|
|
94
97
|
* The packages the fork imports that the app does not declare. A fork that
|
package/api/theme/_adapter.mjs
CHANGED
|
@@ -16,10 +16,11 @@ import {createRequire} from 'node:module';
|
|
|
16
16
|
import {
|
|
17
17
|
findCarriedCoreDir,
|
|
18
18
|
findPackageRoot,
|
|
19
|
+
projectWritePath,
|
|
19
20
|
requireCoreDir,
|
|
20
21
|
} from '../../foundation/fs/paths.mjs';
|
|
21
22
|
import {tryLock, userCacheDir} from '../../foundation/release/cache.mjs';
|
|
22
|
-
import {Project} from '../../foundation/config/project.mjs';
|
|
23
|
+
import {Project, providerLedgerOf} from '../../foundation/config/project.mjs';
|
|
23
24
|
import {
|
|
24
25
|
BUNDLED_THEME_PACKAGE,
|
|
25
26
|
THEMES_DIR,
|
|
@@ -136,9 +137,23 @@ async function availableThemeState(cwd, {includeLocal = true} = {}) {
|
|
|
136
137
|
// One broken local folder must not hide every other theme: it is
|
|
137
138
|
// skipped with its reason, and only a lookup of that slug fails.
|
|
138
139
|
const themes = await project.themes({includeLocal, skipBrokenLocal: true});
|
|
140
|
+
// An installed dependency whose manifest could not load for want of a
|
|
141
|
+
// package it requires has an issue too (INV14), but nothing of it was
|
|
142
|
+
// ever discovered: a lookup in it stays an unknown theme, as before.
|
|
143
|
+
const unloaded = new Set(
|
|
144
|
+
[...providerLedgerOf(project).values()].flatMap(entry =>
|
|
145
|
+
entry.outcome === 'load-failed' &&
|
|
146
|
+
entry.candidate.source === 'autolinked'
|
|
147
|
+
? [entry.candidate.spec ?? entry.label]
|
|
148
|
+
: [],
|
|
149
|
+
),
|
|
150
|
+
);
|
|
139
151
|
return {
|
|
140
152
|
themes,
|
|
141
|
-
issues: await project.issues()
|
|
153
|
+
issues: (await project.issues()).filter(
|
|
154
|
+
issue =>
|
|
155
|
+
!(issue.code === 'integration_error' && unloaded.has(issue.package)),
|
|
156
|
+
),
|
|
142
157
|
skipped: project.skippedLocalThemes(),
|
|
143
158
|
};
|
|
144
159
|
} catch (error) {
|
|
@@ -645,8 +660,10 @@ function themeDescriptorName(file) {
|
|
|
645
660
|
* @param {{cwd: string, targetPath?: string, overwrite?: boolean, takenSlugs?: Set<string>}} options
|
|
646
661
|
* `takenSlugs`: the slugs of the themes the project can use, which a fork's
|
|
647
662
|
* new folder name may not take
|
|
648
|
-
* @returns {{outputDir: string, files: string[]
|
|
649
|
-
* directory
|
|
663
|
+
* @returns {{outputDir: string, files: string[], editorFolder: string | null}}
|
|
664
|
+
* the output directory relative to the working folder, the files written,
|
|
665
|
+
* named as the fork names them, and the folder the theme editor made that
|
|
666
|
+
* holds the fork, relative to the working folder, or null
|
|
650
667
|
*/
|
|
651
668
|
export function ejectThemeFiles(
|
|
652
669
|
theme,
|
|
@@ -655,15 +672,17 @@ export function ejectThemeFiles(
|
|
|
655
672
|
// The fork lands in the project, as list and add read it: the default root
|
|
656
673
|
// is the project's, and a relative [path] is read from the working folder
|
|
657
674
|
// but must stay inside the project.
|
|
658
|
-
|
|
659
|
-
//
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
675
|
+
// Read as every theme command reads a path it writes; a backslash
|
|
676
|
+
// separates folders on every platform.
|
|
677
|
+
const {
|
|
678
|
+
projectDir,
|
|
679
|
+
typed: targetPath,
|
|
680
|
+
relative: target,
|
|
681
|
+
} = projectWritePath(
|
|
682
|
+
cwd,
|
|
683
|
+
typedPath || undefined,
|
|
684
|
+
defaultEjectTarget(theme.slug),
|
|
685
|
+
);
|
|
667
686
|
let resolvedDir;
|
|
668
687
|
try {
|
|
669
688
|
resolvedDir = assertWithin(target, projectDir, {
|
|
@@ -830,7 +849,33 @@ export function ejectThemeFiles(
|
|
|
830
849
|
throw new AstryxError(message, undefined, ERROR_CODES.ERR_WRITE_FAILED);
|
|
831
850
|
}
|
|
832
851
|
|
|
833
|
-
|
|
852
|
+
const editorDir = enclosingEditorFolder(resolvedDir, projectDir);
|
|
853
|
+
return {
|
|
854
|
+
outputDir: path.relative(cwd, resolvedDir) || '.',
|
|
855
|
+
files: names,
|
|
856
|
+
editorFolder:
|
|
857
|
+
editorDir == null ? null : path.relative(cwd, editorDir) || '.',
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* The nearest folder above `dir`, up to the project root, that the theme
|
|
863
|
+
* editor made, or null. Eject refuses the editor's folder itself; a subfolder
|
|
864
|
+
* of it is written as released CLIs did, with a warning.
|
|
865
|
+
* @param {string} dir
|
|
866
|
+
* @param {string} projectDir
|
|
867
|
+
* @returns {string | null}
|
|
868
|
+
*/
|
|
869
|
+
function enclosingEditorFolder(dir, projectDir) {
|
|
870
|
+
const root = path.resolve(projectDir);
|
|
871
|
+
let current = path.resolve(dir);
|
|
872
|
+
while (current !== root) {
|
|
873
|
+
const parent = path.dirname(current);
|
|
874
|
+
if (parent === current) return null;
|
|
875
|
+
current = parent;
|
|
876
|
+
if (editorThemeRecord(current)) return current;
|
|
877
|
+
}
|
|
878
|
+
return null;
|
|
834
879
|
}
|
|
835
880
|
|
|
836
881
|
/**
|
package/api/theme/_fork.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import * as path from 'node:path';
|
|
14
|
-
import {parse} from '
|
|
14
|
+
import {babelParse as parse} from '../../foundation/runtime/lazy-dependencies.mjs';
|
|
15
15
|
import {AstryxError} from '../error.mjs';
|
|
16
16
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
17
17
|
import {
|