@astryxdesign/cli 0.6.5 → 0.6.6
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/CHANGELOG.md +87 -0
- package/README.md +16 -15
- package/api/build/_adapter.d.mts +50 -2
- package/api/build/_adapter.mjs +98 -10
- package/api/build/build.doc.mjs +2 -2
- package/api/build/build.test.mjs +111 -2
- package/api/build/kit/kit.mjs +98 -22
- package/api/build/kit/rank.d.mts +32 -8
- package/api/build/kit/rank.mjs +291 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/build/kit/weights.d.mts +82 -0
- package/api/build/kit/weights.json +1 -0
- package/api/build/kit/weights.mjs +305 -0
- package/api/build/kit/weights.test.mjs +190 -0
- package/api/docs/docs.d.mts +6 -0
- package/api/docs/docs.depth.test.mjs +132 -0
- package/api/docs/docs.doc.mjs +31 -2
- package/api/docs/docs.mjs +44 -1
- package/api/docs/docs.test.mjs +279 -0
- package/api/docs/docs.type.d.mts +38 -1
- package/api/docs/docs.type.mjs +18 -1
- package/api/docs/integration-tree.test.mjs +572 -0
- package/api/docs/integrationDocs.test.mjs +336 -0
- package/api/docs/node/node.d.mts +28 -3
- package/api/docs/node/node.mjs +146 -23
- package/api/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.d.mts +3 -1
- package/api/gap-report/gap-report.mjs +12 -2
- package/api/gap-report/gap-report.test.mjs +106 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/add-contribution.test.mjs +3 -3
- package/api/integration/add-theme.mjs +338 -26
- package/api/integration/add-theme.test.mjs +314 -1
- package/api/integration/authoring-checks.mjs +10 -7
- package/api/integration/authoring-checks.type.d.mts +8 -0
- package/api/integration/authoring-checks.type.mjs +7 -3
- package/api/integration/integration-authoring.type.d.mts +4 -1
- package/api/integration/integration-authoring.type.mjs +6 -1
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddTheme.doc.mjs +10 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +12 -3
- package/api/integration/pack-check.test.mjs +52 -3
- package/api/integration/validate-integration.d.mts +4 -2
- package/api/integration/validate-integration.mjs +7 -2
- package/api/integration/validate-integration.test.mjs +55 -0
- package/api/integration/validate-integration.type.d.mts +5 -0
- package/api/integration/validate-integration.type.mjs +5 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/layout/expand/expand.mjs +12 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search.d.mts +36 -5
- package/api/search/search.doc.mjs +4 -4
- package/api/search/search.mjs +194 -54
- package/api/search/search.test.mjs +825 -0
- package/api/search/search.type.d.mts +5 -5
- package/api/search/search.type.mjs +5 -5
- package/api/swizzle/copy/copy.mjs +66 -3
- package/api/swizzle/swizzle.doc.mjs +4 -0
- package/api/template/copy/copy.mjs +14 -8
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/show/show.mjs +15 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +6 -2
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +2 -0
- package/api/template/template.type.mjs +2 -0
- package/api/theme/build/build.d.mts +24 -0
- package/api/theme/build/build.icon-lineage.test.mjs +117 -0
- package/api/theme/build/build.icon-preservation.test.mjs +639 -0
- package/api/theme/build/build.mjs +381 -77
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.test.mjs +190 -1
- package/api/theme/build/icon-imports.d.mts +47 -0
- package/api/theme/build/icon-imports.mjs +691 -0
- package/api/theme/themeBuild.doc.d.mts +4 -1
- package/api/theme/themeBuild.doc.mjs +14 -3
- package/api/upgrade/run/run.mjs +20 -3
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.type.d.mts +1 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/docs/icons.doc.mjs +1 -0
- package/assets/docs/theme.doc.mjs +3 -2
- package/assets/docs/tokens.doc.mjs +3 -3
- package/assets/docs/tree/add-a-theme.doc.mjs +4 -0
- package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +1 -1
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
- package/assets/docs/tree/template-doc-overview.doc.mjs +13 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +9 -5
- package/assets/docs/tree/versioning.doc.mjs +7 -6
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
- package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
- package/assets/templates/pages/blank/template.doc.mjs +3 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
- package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
- package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
- package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
- package/assets/templates/pages/documentation/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
- package/assets/templates/pages/editor/template.doc.mjs +9 -1
- package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
- package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
- package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
- package/assets/templates/pages/ide/template.doc.mjs +9 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
- package/assets/templates/pages/library/template.doc.mjs +15 -1
- package/assets/templates/pages/login/template.doc.mjs +10 -1
- package/assets/templates/pages/login-card/template.doc.mjs +11 -1
- package/assets/templates/pages/login-split/template.doc.mjs +10 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
- package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
- package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/settings/template.doc.mjs +3 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/table/template.doc.mjs +11 -1
- package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
- package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
- package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
- package/assets/templates/pages/table-page/template.doc.mjs +20 -1
- package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
- package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +1 -0
- package/authoring/doctypes/template/parse.test.mjs +21 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +10 -0
- package/clients/cli/commands/build-theme.mjs +8 -2
- package/clients/cli/commands/discover.mjs +29 -1
- package/clients/cli/commands/discover.no-source.test.mjs +75 -0
- package/clients/cli/commands/docs.depth.test.mjs +219 -0
- package/clients/cli/commands/docs.doc.mjs +15 -2
- package/clients/cli/commands/docs.mjs +222 -5
- package/clients/cli/commands/docs.test.mjs +383 -0
- package/clients/cli/commands/doctor.mjs +4 -4
- package/clients/cli/commands/gap-report.mjs +12 -0
- package/clients/cli/commands/gap-report.test.mjs +63 -0
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration-authoring.test.mjs +12 -2
- package/clients/cli/commands/integration.mjs +3 -1
- package/clients/cli/commands/layout-expand.doc.mjs +3 -1
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +16 -0
- package/clients/cli/commands/search.doc.mjs +5 -4
- package/clients/cli/commands/search.mjs +30 -6
- package/clients/cli/commands/search.test.mjs +60 -16
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.mjs +19 -5
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +41 -0
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/lib/manifest.mjs +44 -165
- package/clients/cli/lib/manifest.test.mjs +98 -7
- package/foundation/agent-docs/agent-docs.mjs +2 -1
- package/foundation/agent-docs/agent-docs.test.mjs +1168 -0
- package/foundation/discovery/template-adapter.d.mts +14 -0
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
- package/foundation/discovery/template-adapter.mjs +21 -1
- package/foundation/discovery/theme-discovery.d.mts +6 -0
- package/foundation/discovery/theme-discovery.mjs +9 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +3 -3
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/tree.test.mjs +649 -0
- package/foundation/integrations/cli-requirement.d.mts +57 -13
- package/foundation/integrations/cli-requirement.mjs +84 -22
- package/foundation/integrations/cli-requirement.test.mjs +135 -8
- package/foundation/response/response-types.doc.d.mts +5 -5
- package/foundation/response/response-types.doc.mjs +13 -13
- package/package.json +1 -1
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Regression coverage for icon registry preservation in theme builds.
|
|
5
|
+
* @input Real themeBuild calls, imported React icon registries, and source or
|
|
6
|
+
* built themes supplied to defineTheme's extends option.
|
|
7
|
+
* @output Checks generated ESM with Node's native loader, retained React
|
|
8
|
+
* elements, inherited paths and precedence, TypeScript binding provenance,
|
|
9
|
+
* and rejection before output writes.
|
|
10
|
+
* @position Direct API regression suite for the icon import bug in #5058.
|
|
11
|
+
* The node project's global setup supplies the compiled core package.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {afterEach, beforeEach, describe, expect, it} from 'vitest';
|
|
15
|
+
import {execFileSync} from 'node:child_process';
|
|
16
|
+
import * as fs from 'node:fs';
|
|
17
|
+
import * as path from 'node:path';
|
|
18
|
+
import {themeBuild} from './build.mjs';
|
|
19
|
+
|
|
20
|
+
let tmpDir;
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
// Keeping fixtures under the CLI package makes real core/React imports
|
|
23
|
+
// resolve in both the theme loader and the native Node artifact check.
|
|
24
|
+
tmpDir = fs.mkdtempSync(
|
|
25
|
+
path.resolve(import.meta.dirname, '../../..', '.tmp-icon-preservation-'),
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function write(file, source) {
|
|
33
|
+
fs.writeFileSync(path.join(tmpDir, file), source);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function writeRegistry(file, exportName, icons) {
|
|
37
|
+
write(
|
|
38
|
+
file,
|
|
39
|
+
`import {createElement} from 'react';
|
|
40
|
+
const registry = {
|
|
41
|
+
${Object.entries(icons)
|
|
42
|
+
.map(
|
|
43
|
+
([key, label]) =>
|
|
44
|
+
` ${JSON.stringify(key)}: createElement('svg', {'data-icon': ${JSON.stringify(label)}}, createElement('path', {d: 'M0 0h1'})),`,
|
|
45
|
+
)
|
|
46
|
+
.join('\n')}
|
|
47
|
+
};
|
|
48
|
+
${exportName === 'default' ? 'export default registry;' : `export {registry as ${exportName}};`}
|
|
49
|
+
`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Load the artifact with native Node, without jiti/Vite resolving nonexistent
|
|
55
|
+
* imports or transforming its syntax. Valid React elements prove symbols and
|
|
56
|
+
* element contents survived, which JSON-only registry assertions cannot do.
|
|
57
|
+
*/
|
|
58
|
+
function readBuiltIcons(name, registryExport) {
|
|
59
|
+
const output = execFileSync(
|
|
60
|
+
process.execPath,
|
|
61
|
+
[
|
|
62
|
+
'--input-type=module',
|
|
63
|
+
'--eval',
|
|
64
|
+
`import assert from 'node:assert/strict';
|
|
65
|
+
import {isValidElement} from 'react';
|
|
66
|
+
const mod = await import(${JSON.stringify(`./${name}.js`)});
|
|
67
|
+
const theme = Object.values(mod).find(value => value?.name === ${JSON.stringify(name)});
|
|
68
|
+
assert.ok(theme?.icons, 'generated theme must retain its icons');
|
|
69
|
+
${registryExport ? `assert.equal(mod[${JSON.stringify(registryExport)}], theme.icons, 'registry re-export must match the theme');` : ''}
|
|
70
|
+
const icons = Object.fromEntries(Object.entries(theme.icons).map(([key, icon]) => {
|
|
71
|
+
assert.ok(isValidElement(icon), key + ' must remain a React element');
|
|
72
|
+
assert.equal(icon.type, 'svg');
|
|
73
|
+
assert.ok(isValidElement(icon.props.children));
|
|
74
|
+
assert.equal(icon.props.children.props.d, 'M0 0h1');
|
|
75
|
+
return [key, icon.props['data-icon']];
|
|
76
|
+
}));
|
|
77
|
+
process.stdout.write(JSON.stringify(icons));`,
|
|
78
|
+
],
|
|
79
|
+
{cwd: tmpDir, encoding: 'utf8', timeout: 10000},
|
|
80
|
+
);
|
|
81
|
+
return JSON.parse(output);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function buildAndCheck(file) {
|
|
85
|
+
const built = await themeBuild(file, {}, {cwd: tmpDir});
|
|
86
|
+
expect(built?.type).toBe('theme.build');
|
|
87
|
+
const checked = await themeBuild(file, {check: true}, {cwd: tmpDir});
|
|
88
|
+
expect(checked?.type).toBe('theme.build.check');
|
|
89
|
+
expect(checked?.data.upToDate).toBe(true);
|
|
90
|
+
expect(checked?.data.stale).toEqual([]);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
describe('themeBuild() — actual icon imports', () => {
|
|
94
|
+
it.each([
|
|
95
|
+
['named', 'liveIcons', "import {liveIcons} from './icons.mjs';"],
|
|
96
|
+
['default', 'default', "import liveIcons from './icons.mjs';"],
|
|
97
|
+
[
|
|
98
|
+
'aliased named',
|
|
99
|
+
'originalIcons',
|
|
100
|
+
"import {originalIcons as liveIcons} from './icons.mjs';",
|
|
101
|
+
],
|
|
102
|
+
])(
|
|
103
|
+
'preserves a %s registry import and its re-export',
|
|
104
|
+
async (_label, exportName, statement) => {
|
|
105
|
+
writeRegistry('icons.mjs', exportName, {close: 'close'});
|
|
106
|
+
write(
|
|
107
|
+
'live.mjs',
|
|
108
|
+
`${statement}
|
|
109
|
+
export default {name: 'live', tokens: {'--color-bg': '#fff'}, icons: liveIcons};
|
|
110
|
+
`,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
await buildAndCheck('live.mjs');
|
|
114
|
+
|
|
115
|
+
expect(readBuiltIcons('live', 'liveIcons')).toEqual({close: 'close'});
|
|
116
|
+
if (exportName === 'liveIcons') {
|
|
117
|
+
const generated = fs.readFileSync(path.join(tmpDir, 'live.js'), 'utf8');
|
|
118
|
+
expect(generated).toContain("import { liveIcons } from './icons.mjs';");
|
|
119
|
+
expect(generated).toContain('icons: liveIcons,');
|
|
120
|
+
expect(generated).toContain('export { liveIcons };');
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
it('preserves a namespace used directly as the icon registry', async () => {
|
|
126
|
+
write(
|
|
127
|
+
'icons.mjs',
|
|
128
|
+
`import {createElement} from 'react';
|
|
129
|
+
export const close = createElement('svg', {'data-icon': 'close'}, createElement('path', {d: 'M0 0h1'}));
|
|
130
|
+
`,
|
|
131
|
+
);
|
|
132
|
+
write(
|
|
133
|
+
'live.mjs',
|
|
134
|
+
`import * as liveIcons from './icons.mjs';
|
|
135
|
+
export default {name: 'live', tokens: {'--color-bg': '#fff'}, icons: liveIcons};
|
|
136
|
+
`,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
await buildAndCheck('live.mjs');
|
|
140
|
+
|
|
141
|
+
expect(readBuiltIcons('live', 'liveIcons')).toEqual({close: 'close'});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('uses the selected export instead of an unrelated earlier icons field', async () => {
|
|
145
|
+
writeRegistry('icons.mjs', 'liveIcons', {close: 'selected'});
|
|
146
|
+
write(
|
|
147
|
+
'selected.mjs',
|
|
148
|
+
`import {liveIcons} from './icons.mjs';
|
|
149
|
+
const inlineIcons = {close: 'unrelated'};
|
|
150
|
+
const metadata = {icons: inlineIcons};
|
|
151
|
+
export const otherTheme = {name: 'other', tokens: {}, icons: inlineIcons};
|
|
152
|
+
export default {name: 'selected', tokens: {'--color-bg': '#fff'}, icons: liveIcons};
|
|
153
|
+
`,
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
await buildAndCheck('selected.mjs');
|
|
157
|
+
|
|
158
|
+
expect(readBuiltIcons('selected', 'liveIcons')).toEqual({
|
|
159
|
+
close: 'selected',
|
|
160
|
+
});
|
|
161
|
+
expect(fs.existsSync(path.join(tmpDir, 'other.js'))).toBe(false);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('rejects the selected inline registry even when another theme imports icons', async () => {
|
|
165
|
+
writeRegistry('icons.mjs', 'liveIcons', {close: 'unselected'});
|
|
166
|
+
write(
|
|
167
|
+
'selected.mjs',
|
|
168
|
+
`import {liveIcons} from './icons.mjs';
|
|
169
|
+
export const otherTheme = {name: 'other', tokens: {}, icons: liveIcons};
|
|
170
|
+
const inlineIcons = {close: 'selected'};
|
|
171
|
+
export default {name: 'selected', tokens: {'--color-bg': '#fff'}, icons: inlineIcons};
|
|
172
|
+
`,
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
await expect(
|
|
176
|
+
themeBuild('selected.mjs', {}, {cwd: tmpDir}),
|
|
177
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
178
|
+
expect(fs.readdirSync(tmpDir).sort()).toEqual([
|
|
179
|
+
'icons.mjs',
|
|
180
|
+
'selected.mjs',
|
|
181
|
+
]);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('unwraps TypeScript assertions around an aliased defineTheme call', async () => {
|
|
185
|
+
writeRegistry('icons.mjs', 'liveIcons', {close: 'wrapped-close'});
|
|
186
|
+
write(
|
|
187
|
+
'wrapped.ts',
|
|
188
|
+
`import {defineTheme as createTheme} from '@astryxdesign/core/theme';
|
|
189
|
+
import {liveIcons} from './icons.mjs';
|
|
190
|
+
export default createTheme(({
|
|
191
|
+
name: 'wrapped', tokens: {'--color-bg': '#fff'}, icons: liveIcons,
|
|
192
|
+
} as const) satisfies Parameters<typeof createTheme>[0]);
|
|
193
|
+
`,
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
await buildAndCheck('wrapped.ts');
|
|
197
|
+
|
|
198
|
+
expect(readBuiltIcons('wrapped', 'liveIcons')).toEqual({
|
|
199
|
+
close: 'wrapped-close',
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('ignores an icons field mentioned only in a string', async () => {
|
|
204
|
+
write(
|
|
205
|
+
'plain.mjs',
|
|
206
|
+
`const note = 'icons: retired';
|
|
207
|
+
export default {name: 'plain', tokens: {'--color-bg': '#fff'}};
|
|
208
|
+
`,
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
await buildAndCheck('plain.mjs');
|
|
212
|
+
|
|
213
|
+
const generated = fs.readFileSync(path.join(tmpDir, 'plain.js'), 'utf8');
|
|
214
|
+
expect(generated).not.toMatch(/^import /m);
|
|
215
|
+
expect(generated).not.toContain('icons:');
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('avoids collisions between the icon binding and the generated theme export', async () => {
|
|
219
|
+
writeRegistry('icons.mjs', 'collisionTheme', {close: 'collision-close'});
|
|
220
|
+
write(
|
|
221
|
+
'collision.mjs',
|
|
222
|
+
`import {collisionTheme} from './icons.mjs';
|
|
223
|
+
export default {name: 'collision', tokens: {'--color-bg': '#fff'}, icons: collisionTheme};
|
|
224
|
+
`,
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
await buildAndCheck('collision.mjs');
|
|
228
|
+
|
|
229
|
+
expect(readBuiltIcons('collision')).toEqual({close: 'collision-close'});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('does not treat a type-only import as a runtime icon binding', async () => {
|
|
233
|
+
writeRegistry('icons.mjs', 'inlineIcons', {close: 'type-only'});
|
|
234
|
+
write(
|
|
235
|
+
'inline.ts',
|
|
236
|
+
`import type {inlineIcons} from './icons.mjs';
|
|
237
|
+
const inlineIcons = {close: 'inline'};
|
|
238
|
+
export default {name: 'inline', tokens: {'--color-bg': '#fff'}, icons: inlineIcons};
|
|
239
|
+
`,
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
for (const check of [false, true]) {
|
|
243
|
+
await expect(
|
|
244
|
+
themeBuild('inline.ts', {check}, {cwd: tmpDir}),
|
|
245
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
246
|
+
}
|
|
247
|
+
expect(fs.readdirSync(tmpDir).sort()).toEqual(['icons.mjs', 'inline.ts']);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it.each([
|
|
251
|
+
['an empty object', '{}'],
|
|
252
|
+
['only empty spreads', '{...null, ...undefined}'],
|
|
253
|
+
])(
|
|
254
|
+
'builds a root theme whose registry is %s without an icon import or field',
|
|
255
|
+
async (_label, registry) => {
|
|
256
|
+
write(
|
|
257
|
+
'empty.mjs',
|
|
258
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
259
|
+
export default defineTheme({
|
|
260
|
+
name: 'empty', tokens: {'--color-bg': '#fff'}, icons: ${registry},
|
|
261
|
+
});
|
|
262
|
+
`,
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
const fresh = await themeBuild('empty.mjs', {check: true}, {cwd: tmpDir});
|
|
266
|
+
expect(fresh?.data.upToDate).toBe(false);
|
|
267
|
+
await buildAndCheck('empty.mjs');
|
|
268
|
+
|
|
269
|
+
const generated = fs.readFileSync(path.join(tmpDir, 'empty.js'), 'utf8');
|
|
270
|
+
expect(generated).not.toMatch(/^import /m);
|
|
271
|
+
expect(generated).not.toContain('icons');
|
|
272
|
+
expect(
|
|
273
|
+
fs.readFileSync(path.join(tmpDir, 'empty.d.ts'), 'utf8'),
|
|
274
|
+
).not.toContain('IconRegistry');
|
|
275
|
+
},
|
|
276
|
+
);
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
describe.each([false, true])('fake icon imports (check: %s)', check => {
|
|
280
|
+
it.each([
|
|
281
|
+
[
|
|
282
|
+
'string',
|
|
283
|
+
`const note = "import { inlineIcons } from './ghost-icons.mjs'";`,
|
|
284
|
+
],
|
|
285
|
+
[
|
|
286
|
+
'template',
|
|
287
|
+
"const note = `import { inlineIcons } from './ghost-icons.mjs'`;",
|
|
288
|
+
],
|
|
289
|
+
[
|
|
290
|
+
'regular expression',
|
|
291
|
+
"const note = /import { inlineIcons } from 'ghost-icons.mjs'/;",
|
|
292
|
+
],
|
|
293
|
+
])(
|
|
294
|
+
'rejects an import inside a %s before creating or replacing outputs',
|
|
295
|
+
async (_label, decoy) => {
|
|
296
|
+
write(
|
|
297
|
+
'inline.mjs',
|
|
298
|
+
`${decoy}
|
|
299
|
+
const inlineIcons = {close: 'inline'};
|
|
300
|
+
export default {name: 'inline', tokens: {'--color-bg': '#fff'}, icons: inlineIcons};
|
|
301
|
+
`,
|
|
302
|
+
);
|
|
303
|
+
const originalFiles = fs.readdirSync(tmpDir);
|
|
304
|
+
await expect(
|
|
305
|
+
themeBuild(
|
|
306
|
+
'inline.mjs',
|
|
307
|
+
{check, out: 'dist/inline.css'},
|
|
308
|
+
{cwd: tmpDir},
|
|
309
|
+
),
|
|
310
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
311
|
+
expect(fs.readdirSync(tmpDir)).toEqual(originalFiles);
|
|
312
|
+
|
|
313
|
+
fs.mkdirSync(path.join(tmpDir, 'dist'));
|
|
314
|
+
const outputs = ['inline.css', 'inline.js', 'inline.d.ts'];
|
|
315
|
+
for (const file of outputs) write(`dist/${file}`, `previous ${file}\n`);
|
|
316
|
+
await expect(
|
|
317
|
+
themeBuild(
|
|
318
|
+
'inline.mjs',
|
|
319
|
+
{check, out: 'dist/inline.css'},
|
|
320
|
+
{cwd: tmpDir},
|
|
321
|
+
),
|
|
322
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
323
|
+
expect(fs.readdirSync(path.join(tmpDir, 'dist')).sort()).toEqual(
|
|
324
|
+
outputs.sort(),
|
|
325
|
+
);
|
|
326
|
+
for (const file of outputs) {
|
|
327
|
+
expect(fs.readFileSync(path.join(tmpDir, 'dist', file), 'utf8')).toBe(
|
|
328
|
+
`previous ${file}\n`,
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
describe.each(['source', 'built'])(
|
|
336
|
+
'icons inherited from an imported %s base',
|
|
337
|
+
baseKind => {
|
|
338
|
+
async function writeBase() {
|
|
339
|
+
writeRegistry('base-icons.mjs', 'baseIcons', {
|
|
340
|
+
close: 'base-close',
|
|
341
|
+
check: 'base-check',
|
|
342
|
+
});
|
|
343
|
+
write(
|
|
344
|
+
'base.mjs',
|
|
345
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
346
|
+
import {baseIcons} from './base-icons.mjs';
|
|
347
|
+
export const baseTheme = defineTheme({
|
|
348
|
+
name: 'base', tokens: {'--color-bg': '#fff'}, icons: baseIcons,
|
|
349
|
+
});
|
|
350
|
+
`,
|
|
351
|
+
);
|
|
352
|
+
if (baseKind === 'built') await buildAndCheck('base.mjs');
|
|
353
|
+
return `./base.${baseKind === 'built' ? 'js' : 'mjs'}`;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
it('retains all base icons when the child has no local registry', async () => {
|
|
357
|
+
const baseSpecifier = await writeBase();
|
|
358
|
+
write(
|
|
359
|
+
'child.mjs',
|
|
360
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
361
|
+
import {baseTheme} from '${baseSpecifier}';
|
|
362
|
+
export default defineTheme({name: 'child', extends: baseTheme, tokens: {}});
|
|
363
|
+
`,
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
await buildAndCheck('child.mjs');
|
|
367
|
+
|
|
368
|
+
expect(readBuiltIcons('child')).toEqual({
|
|
369
|
+
close: 'base-close',
|
|
370
|
+
check: 'base-check',
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
it('keeps all base icons when the child sets an empty registry', async () => {
|
|
375
|
+
const baseSpecifier = await writeBase();
|
|
376
|
+
write(
|
|
377
|
+
'child.mjs',
|
|
378
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
379
|
+
import {baseTheme} from '${baseSpecifier}';
|
|
380
|
+
export default defineTheme({
|
|
381
|
+
name: 'child', extends: baseTheme, tokens: {}, icons: {},
|
|
382
|
+
});
|
|
383
|
+
`,
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
const fresh = await themeBuild('child.mjs', {check: true}, {cwd: tmpDir});
|
|
387
|
+
expect(fresh?.data.upToDate).toBe(false);
|
|
388
|
+
await buildAndCheck('child.mjs');
|
|
389
|
+
|
|
390
|
+
expect(readBuiltIcons('child')).toEqual({
|
|
391
|
+
close: 'base-close',
|
|
392
|
+
check: 'base-check',
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it('merges imported child icons over the base without dropping untouched keys', async () => {
|
|
397
|
+
const baseSpecifier = await writeBase();
|
|
398
|
+
writeRegistry('child-icons.mjs', 'childIcons', {
|
|
399
|
+
close: 'child-close',
|
|
400
|
+
add: 'child-add',
|
|
401
|
+
});
|
|
402
|
+
write(
|
|
403
|
+
'child.mjs',
|
|
404
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
405
|
+
import {baseTheme} from '${baseSpecifier}';
|
|
406
|
+
import {childIcons} from './child-icons.mjs';
|
|
407
|
+
export default defineTheme({
|
|
408
|
+
name: 'child', extends: baseTheme, tokens: {}, icons: childIcons,
|
|
409
|
+
});
|
|
410
|
+
`,
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
await buildAndCheck('child.mjs');
|
|
414
|
+
|
|
415
|
+
expect(readBuiltIcons('child')).toEqual({
|
|
416
|
+
close: 'child-close',
|
|
417
|
+
check: 'base-check',
|
|
418
|
+
add: 'child-add',
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
},
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
describe('themeBuild() — inherited icon module resolution', () => {
|
|
425
|
+
it.each(['named', 'namespace'])(
|
|
426
|
+
'redirects only the child registry when %s imports share a module',
|
|
427
|
+
async importKind => {
|
|
428
|
+
writeRegistry('base-icons.mjs', 'baseIcons', {
|
|
429
|
+
close: 'base-close',
|
|
430
|
+
check: 'base-check',
|
|
431
|
+
});
|
|
432
|
+
writeRegistry('child-icons.mjs', 'childIcons', {
|
|
433
|
+
close: 'child-close',
|
|
434
|
+
add: 'child-add',
|
|
435
|
+
});
|
|
436
|
+
write(
|
|
437
|
+
'icons.mjs',
|
|
438
|
+
`export {baseIcons} from './base-icons.mjs';
|
|
439
|
+
export {childIcons} from './child-icons.mjs';
|
|
440
|
+
`,
|
|
441
|
+
);
|
|
442
|
+
// The emitted child sidecar deliberately has no baseIcons export.
|
|
443
|
+
writeRegistry('built-icons.mjs', 'childIcons', {
|
|
444
|
+
close: 'child-close',
|
|
445
|
+
add: 'child-add',
|
|
446
|
+
});
|
|
447
|
+
write(
|
|
448
|
+
'child.mjs',
|
|
449
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
450
|
+
${importKind === 'named' ? "import {baseIcons, childIcons} from './icons.mjs';" : "import * as registries from './icons.mjs';"}
|
|
451
|
+
const baseTheme = defineTheme({
|
|
452
|
+
name: 'base', tokens: {'--color-bg': '#fff'}, icons: ${importKind === 'named' ? 'baseIcons' : 'registries.baseIcons'},
|
|
453
|
+
});
|
|
454
|
+
export default defineTheme({
|
|
455
|
+
name: 'child', extends: baseTheme, tokens: {}, icons: ${importKind === 'named' ? 'childIcons' : 'registries.childIcons'},
|
|
456
|
+
});
|
|
457
|
+
`,
|
|
458
|
+
);
|
|
459
|
+
|
|
460
|
+
const options = {iconsSpecifier: './built-icons.mjs'};
|
|
461
|
+
const built = await themeBuild('child.mjs', options, {cwd: tmpDir});
|
|
462
|
+
expect(built?.type).toBe('theme.build');
|
|
463
|
+
const checked = await themeBuild(
|
|
464
|
+
'child.mjs',
|
|
465
|
+
{...options, check: true},
|
|
466
|
+
{cwd: tmpDir},
|
|
467
|
+
);
|
|
468
|
+
expect(checked?.data.upToDate).toBe(true);
|
|
469
|
+
expect(readBuiltIcons('child')).toEqual({
|
|
470
|
+
close: 'child-close',
|
|
471
|
+
check: 'base-check',
|
|
472
|
+
add: 'child-add',
|
|
473
|
+
});
|
|
474
|
+
},
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
it('rebases a source base registry from its subdirectory to the child output', async () => {
|
|
478
|
+
fs.mkdirSync(path.join(tmpDir, 'brand'));
|
|
479
|
+
writeRegistry('brand/icons.mjs', 'brandIcons', {close: 'brand-close'});
|
|
480
|
+
write(
|
|
481
|
+
'brand/source.mjs',
|
|
482
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
483
|
+
import {brandIcons} from './icons.mjs';
|
|
484
|
+
export const brandTheme = defineTheme({
|
|
485
|
+
name: 'brand', tokens: {'--color-bg': '#fff'}, icons: brandIcons,
|
|
486
|
+
});
|
|
487
|
+
`,
|
|
488
|
+
);
|
|
489
|
+
write(
|
|
490
|
+
'child.mjs',
|
|
491
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
492
|
+
import {brandTheme} from './brand/source.mjs';
|
|
493
|
+
export default defineTheme({name: 'child', extends: brandTheme, tokens: {}});
|
|
494
|
+
`,
|
|
495
|
+
);
|
|
496
|
+
|
|
497
|
+
await buildAndCheck('child.mjs');
|
|
498
|
+
|
|
499
|
+
expect(readBuiltIcons('child')).toEqual({close: 'brand-close'});
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
it('resolves an extensionless TypeScript base before its generated JS sibling', async () => {
|
|
503
|
+
writeRegistry('icons.mjs', 'brandIcons', {close: 'source-close'});
|
|
504
|
+
write(
|
|
505
|
+
'base.ts',
|
|
506
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
507
|
+
import {brandIcons} from './icons.mjs';
|
|
508
|
+
export const brandTheme = defineTheme({
|
|
509
|
+
name: 'base', tokens: {'--color-bg': '#fff'}, icons: brandIcons,
|
|
510
|
+
});
|
|
511
|
+
`,
|
|
512
|
+
);
|
|
513
|
+
// The generated sibling exports baseTheme, while the source's public
|
|
514
|
+
// export is brandTheme. Selecting base.js would erase the child base.
|
|
515
|
+
await buildAndCheck('base.ts');
|
|
516
|
+
write(
|
|
517
|
+
'child.ts',
|
|
518
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
519
|
+
import {brandTheme} from './base';
|
|
520
|
+
export default defineTheme({name: 'child', extends: brandTheme, tokens: {}});
|
|
521
|
+
`,
|
|
522
|
+
);
|
|
523
|
+
|
|
524
|
+
await buildAndCheck('child.ts');
|
|
525
|
+
|
|
526
|
+
expect(readBuiltIcons('child')).toEqual({close: 'source-close'});
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
describe.each([false, true])(
|
|
531
|
+
'unsupported icon provenance (check: %s)',
|
|
532
|
+
check => {
|
|
533
|
+
it('fails to load a missing registry import instead of dropping its icons', async () => {
|
|
534
|
+
write(
|
|
535
|
+
'missing.mjs',
|
|
536
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
537
|
+
import {missingIcons} from './missing-icons.mjs';
|
|
538
|
+
export default defineTheme({
|
|
539
|
+
name: 'missing', tokens: {'--color-bg': '#fff'}, icons: missingIcons,
|
|
540
|
+
});
|
|
541
|
+
`,
|
|
542
|
+
);
|
|
543
|
+
|
|
544
|
+
await expect(
|
|
545
|
+
themeBuild(
|
|
546
|
+
'missing.mjs',
|
|
547
|
+
{check, out: 'dist/missing.css'},
|
|
548
|
+
{cwd: tmpDir},
|
|
549
|
+
),
|
|
550
|
+
).rejects.toMatchObject({code: 'ERR_THEME_LOAD'});
|
|
551
|
+
expect(fs.readdirSync(tmpDir)).toEqual(['missing.mjs']);
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
it('rejects a registry mutated through a destructured theme alias before writing', async () => {
|
|
555
|
+
writeRegistry('icons.mjs', 'importedIcons', {
|
|
556
|
+
close: 'original-close',
|
|
557
|
+
check: 'retained-check',
|
|
558
|
+
});
|
|
559
|
+
write(
|
|
560
|
+
'mutated.mjs',
|
|
561
|
+
`import {importedIcons} from './icons.mjs';
|
|
562
|
+
const config = {
|
|
563
|
+
name: 'mutated', tokens: {'--color-bg': '#fff'}, icons: importedIcons,
|
|
564
|
+
};
|
|
565
|
+
const {icons} = config;
|
|
566
|
+
delete icons.close;
|
|
567
|
+
export default config;
|
|
568
|
+
`,
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
await expect(
|
|
572
|
+
themeBuild(
|
|
573
|
+
'mutated.mjs',
|
|
574
|
+
{check, out: 'dist/mutated.css'},
|
|
575
|
+
{cwd: tmpDir},
|
|
576
|
+
),
|
|
577
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
578
|
+
expect(fs.readdirSync(tmpDir).sort()).toEqual([
|
|
579
|
+
'icons.mjs',
|
|
580
|
+
'mutated.mjs',
|
|
581
|
+
]);
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
it.each([
|
|
585
|
+
[
|
|
586
|
+
'a defineTheme argument',
|
|
587
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
588
|
+
import {config} from '@fixture/raw-theme';
|
|
589
|
+
export default defineTheme(config);
|
|
590
|
+
`,
|
|
591
|
+
],
|
|
592
|
+
[
|
|
593
|
+
'the selected re-export',
|
|
594
|
+
`export {config as default} from '@fixture/raw-theme';
|
|
595
|
+
`,
|
|
596
|
+
],
|
|
597
|
+
])(
|
|
598
|
+
'rejects an opaque package raw config used as %s before writing',
|
|
599
|
+
async (_label, source) => {
|
|
600
|
+
const packageDirectory = 'node_modules/@fixture/raw-theme';
|
|
601
|
+
fs.mkdirSync(path.join(tmpDir, packageDirectory), {recursive: true});
|
|
602
|
+
write(
|
|
603
|
+
`${packageDirectory}/package.json`,
|
|
604
|
+
JSON.stringify({
|
|
605
|
+
name: '@fixture/raw-theme',
|
|
606
|
+
type: 'module',
|
|
607
|
+
exports: './index.mjs',
|
|
608
|
+
}),
|
|
609
|
+
);
|
|
610
|
+
writeRegistry(`${packageDirectory}/icons.mjs`, 'baseIcons', {
|
|
611
|
+
close: 'inherited-close',
|
|
612
|
+
});
|
|
613
|
+
write(
|
|
614
|
+
`${packageDirectory}/index.mjs`,
|
|
615
|
+
`import {defineTheme} from '@astryxdesign/core/theme';
|
|
616
|
+
import {baseIcons} from './icons.mjs';
|
|
617
|
+
const baseTheme = defineTheme({
|
|
618
|
+
name: 'package-base', tokens: {'--color-bg': '#fff'}, icons: baseIcons,
|
|
619
|
+
});
|
|
620
|
+
export const config = {name: 'raw-package', extends: baseTheme, tokens: {}};
|
|
621
|
+
`,
|
|
622
|
+
);
|
|
623
|
+
write('package-config.mjs', source);
|
|
624
|
+
|
|
625
|
+
await expect(
|
|
626
|
+
themeBuild(
|
|
627
|
+
'package-config.mjs',
|
|
628
|
+
{check, out: 'dist/raw-package.css'},
|
|
629
|
+
{cwd: tmpDir},
|
|
630
|
+
),
|
|
631
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
632
|
+
expect(fs.readdirSync(tmpDir).sort()).toEqual([
|
|
633
|
+
'node_modules',
|
|
634
|
+
'package-config.mjs',
|
|
635
|
+
]);
|
|
636
|
+
},
|
|
637
|
+
);
|
|
638
|
+
},
|
|
639
|
+
);
|