@orkestrel/scaffold 0.0.10 → 0.0.12
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/dist/bin/scaffold.js +63 -28
- package/dist/bin/scaffold.js.map +1 -1
- package/dist/host/guides/src/scaffold.md +64 -29
- package/dist/host/tests/setupPolicy.ts +87 -2
- package/dist/src/core/index.cjs +86 -61
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +56 -26
- package/dist/src/core/index.d.ts +56 -26
- package/dist/src/core/index.js +85 -62
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +21 -9
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +2 -1
- package/dist/src/server/index.d.ts +2 -1
- package/dist/src/server/index.js +23 -11
- package/dist/src/server/index.js.map +1 -1
- package/package.json +5 -5
package/dist/src/core/index.js
CHANGED
|
@@ -142,6 +142,8 @@ var HOST_PATHS = Object.freeze([
|
|
|
142
142
|
]);
|
|
143
143
|
/** The consumer-owned live-service provisioner expected only by service workspaces. */
|
|
144
144
|
var SERVICE_SCRIPT_PATH = "scripts/service.sh";
|
|
145
|
+
/** The consumer-owned Vitest global-setup module shared by its independently selected projects. */
|
|
146
|
+
var GLOBAL_SETUP_PATH = "tests/setupGlobal.ts";
|
|
145
147
|
/** The package-name RegExp — lowercase alphanumeric-with-hyphens, letter-first. */
|
|
146
148
|
var NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
147
149
|
/** Maximum bare workspace name length beneath the generated `@orkestrel/` scope. */
|
|
@@ -224,11 +226,11 @@ var DEFAULT_VERSION = "0.0.1";
|
|
|
224
226
|
/** The `engines.node` range the `blueprint` builder fills. */
|
|
225
227
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
226
228
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
227
|
-
var SCAFFOLD_RANGE = "^0.0.
|
|
229
|
+
var SCAFFOLD_RANGE = "^0.0.12";
|
|
228
230
|
/** Tooling versions shared by scaffold and every generated workspace. */
|
|
229
231
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
230
232
|
"@microsoft/api-extractor": "^7.58.12",
|
|
231
|
-
"@orkestrel/guide": "^0.0.
|
|
233
|
+
"@orkestrel/guide": "^0.0.8",
|
|
232
234
|
"@orkestrel/scaffold": SCAFFOLD_RANGE,
|
|
233
235
|
"@types/node": "^26.1.2",
|
|
234
236
|
oxfmt: "^0.61.0",
|
|
@@ -241,7 +243,7 @@ var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
|
241
243
|
/** Additional development dependency required by a published browser source environment. */
|
|
242
244
|
var SOURCE_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
243
245
|
"@vitest/browser-playwright": "^4.1.10",
|
|
244
|
-
playwright: "^1.
|
|
246
|
+
playwright: "^1.62.0"
|
|
245
247
|
});
|
|
246
248
|
/** Additional development dependencies required by a private Vue browser application. */
|
|
247
249
|
var APP_BROWSER_DEV_DEPENDENCIES = Object.freeze({
|
|
@@ -424,8 +426,8 @@ function member(name, category, summary, environment = "core") {
|
|
|
424
426
|
* `version` / `engines` default `DEFAULT_VERSION` / `DEFAULT_ENGINES`,
|
|
425
427
|
* `src` defaults `['core']`, and `app` / `keywords` / `dependencies` /
|
|
426
428
|
* `peers` / `extras` / `overrides` default `[]`, and `bin` / `integration` /
|
|
427
|
-
* `service` default `false`. `description` is OMITTED entirely
|
|
428
|
-
* the result round-trips the exact-record `Blueprint` guard.
|
|
429
|
+
* `service` / `global` default `false`. `description` is OMITTED entirely
|
|
430
|
+
* when absent, so the result round-trips the exact-record `Blueprint` guard.
|
|
429
431
|
* @returns A complete `Blueprint`.
|
|
430
432
|
*
|
|
431
433
|
* @example
|
|
@@ -449,7 +451,8 @@ function blueprint(name, options) {
|
|
|
449
451
|
overrides: options?.overrides ?? [],
|
|
450
452
|
bin: options?.bin ?? false,
|
|
451
453
|
integration: options?.integration ?? false,
|
|
452
|
-
service: options?.service ?? false
|
|
454
|
+
service: options?.service ?? false,
|
|
455
|
+
global: options?.global ?? false
|
|
453
456
|
};
|
|
454
457
|
return options?.description === void 0 ? base : {
|
|
455
458
|
...base,
|
|
@@ -606,7 +609,7 @@ function catalogNames(text) {
|
|
|
606
609
|
*
|
|
607
610
|
* @param header - The header cell strings, in column order.
|
|
608
611
|
* @param rows - The body rows, each a list of cell strings matching `header`'s column count.
|
|
609
|
-
* @param align - Optional per-column alignment; defaults every column to `
|
|
612
|
+
* @param align - Optional per-column alignment; defaults every column to `null` (no alignment).
|
|
610
613
|
* @remarks
|
|
611
614
|
* Builds a `TableNode` (each cell parsed with `parseInline`) and serializes it
|
|
612
615
|
* through `renderMarkdown`, which contributes the structure — `\|`-escaping any
|
|
@@ -625,13 +628,14 @@ function catalogNames(text) {
|
|
|
625
628
|
*/
|
|
626
629
|
function alignTable(header, rows, align) {
|
|
627
630
|
const columns = header.length;
|
|
628
|
-
const alignment = align ?? header.map(() =>
|
|
629
|
-
const
|
|
631
|
+
const alignment = align ?? header.map(() => null);
|
|
632
|
+
const node = {
|
|
630
633
|
element: "table",
|
|
631
634
|
header: header.map((cell) => parseInline(cell)),
|
|
632
635
|
rows: rows.map((row) => row.map((cell) => parseInline(cell))),
|
|
633
636
|
align: alignment
|
|
634
|
-
}
|
|
637
|
+
};
|
|
638
|
+
const lines = renderMarkdown(node).split("\n");
|
|
635
639
|
const headerCells = splitTableRow(lines[0] ?? "");
|
|
636
640
|
const bodyCells = lines.slice(2).map((line) => splitTableRow(line));
|
|
637
641
|
const widths = [];
|
|
@@ -694,11 +698,11 @@ function padCell(text, width) {
|
|
|
694
698
|
/**
|
|
695
699
|
* Build one delimiter-row cell for a GFM table column.
|
|
696
700
|
*
|
|
697
|
-
* @param columnAlign - The column's `TableAlign
|
|
701
|
+
* @param columnAlign - The column's `TableAlign`, or `null` for no alignment.
|
|
698
702
|
* @param width - The column's codepoint width.
|
|
699
703
|
* @remarks
|
|
700
704
|
* `'left'` prefixes `:`, `'right'` suffixes `:`, `'center'` wraps both ends,
|
|
701
|
-
* `
|
|
705
|
+
* `null` is plain dashes — one dash per width unit, `:` markers consuming
|
|
702
706
|
* a dash slot rather than adding to `width`.
|
|
703
707
|
* @returns The delimiter cell string for this column.
|
|
704
708
|
*
|
|
@@ -1598,6 +1602,22 @@ function computeColumnWidth(text) {
|
|
|
1598
1602
|
return width;
|
|
1599
1603
|
}
|
|
1600
1604
|
/**
|
|
1605
|
+
* Test whether a complete rendered line fits the fleet formatter's print width.
|
|
1606
|
+
*
|
|
1607
|
+
* @param text - The complete rendered line, including indentation and trailing punctuation.
|
|
1608
|
+
* @returns Whether the line fits within `JSON_PRINT_WIDTH`.
|
|
1609
|
+
*
|
|
1610
|
+
* @example
|
|
1611
|
+
* ```ts
|
|
1612
|
+
* import { fitsPrintWidth } from '@orkestrel/scaffold'
|
|
1613
|
+
*
|
|
1614
|
+
* fitsPrintWidth('\t["ESNext"],') // true
|
|
1615
|
+
* ```
|
|
1616
|
+
*/
|
|
1617
|
+
function fitsPrintWidth(text) {
|
|
1618
|
+
return computeColumnWidth(text) <= 100;
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1601
1621
|
* Render a JSON array through `formatJson`'s inline-or-broken rule — inline
|
|
1602
1622
|
* when the rendered width (via `computeColumnWidth`) fits `JSON_PRINT_WIDTH`, one
|
|
1603
1623
|
* item per line otherwise.
|
|
@@ -1619,7 +1639,7 @@ function renderArray(entries, indent, prefix, suffix) {
|
|
|
1619
1639
|
if (entries.length === 0) return "[]";
|
|
1620
1640
|
const items = entries.map((entry) => renderValue(entry, indent, "", ""));
|
|
1621
1641
|
const inline = `[${items.join(", ")}]`;
|
|
1622
|
-
if (
|
|
1642
|
+
if (fitsPrintWidth(`${prefix}${inline}${suffix}`)) return inline;
|
|
1623
1643
|
const childIndent = `${indent}\t`;
|
|
1624
1644
|
return `[\n${items.map((item) => `${childIndent}${item}`).join(",\n")}\n${indent}]`;
|
|
1625
1645
|
}
|
|
@@ -1802,7 +1822,8 @@ function blueprintShape() {
|
|
|
1802
1822
|
overrides: arrayShape(overrideShape(), { max: MAX_COLLECTION_ITEMS }),
|
|
1803
1823
|
bin: booleanShape(),
|
|
1804
1824
|
integration: booleanShape(),
|
|
1805
|
-
service: booleanShape()
|
|
1825
|
+
service: booleanShape(),
|
|
1826
|
+
global: booleanShape()
|
|
1806
1827
|
});
|
|
1807
1828
|
}
|
|
1808
1829
|
/**
|
|
@@ -5772,7 +5793,7 @@ function viteMachinery(src, app = [], bin = false) {
|
|
|
5772
5793
|
*
|
|
5773
5794
|
* @param src - The declared published environments.
|
|
5774
5795
|
* @param app - The declared application environments.
|
|
5775
|
-
* @param
|
|
5796
|
+
* @param facts - Optional structural facts.
|
|
5776
5797
|
* @returns Source projects, application projects, proof projects, then optional axis projects.
|
|
5777
5798
|
*
|
|
5778
5799
|
* @example
|
|
@@ -5781,7 +5802,7 @@ function viteMachinery(src, app = [], bin = false) {
|
|
|
5781
5802
|
* // [{ project: 'srcCore' }, { project: 'policy' }, { project: 'guides' }, { project: 'integration' }]
|
|
5782
5803
|
* ```
|
|
5783
5804
|
*/
|
|
5784
|
-
function viteProjectRegistrations(src, app = [],
|
|
5805
|
+
function viteProjectRegistrations(src, app = [], facts = {}) {
|
|
5785
5806
|
const registrations = [];
|
|
5786
5807
|
for (const environment of ENVIRONMENTS) {
|
|
5787
5808
|
if (!src.includes(environment)) continue;
|
|
@@ -5802,15 +5823,15 @@ function viteProjectRegistrations(src, app = [], axes = {}) {
|
|
|
5802
5823
|
if (environment === "server") registrations.push({ project: "appServer" });
|
|
5803
5824
|
}
|
|
5804
5825
|
registrations.push({ project: "policy" }, { project: "guides" });
|
|
5805
|
-
if (
|
|
5806
|
-
if (
|
|
5807
|
-
if (
|
|
5826
|
+
if (facts.bin === true) registrations.push({ project: "srcBin" });
|
|
5827
|
+
if (facts.integration === true) registrations.push({ project: "integration" });
|
|
5828
|
+
if (facts.service === true) registrations.push({ project: "service" });
|
|
5808
5829
|
return registrations;
|
|
5809
5830
|
}
|
|
5810
5831
|
/**
|
|
5811
5832
|
* Render the one ordered proof and structural-axis project definition block.
|
|
5812
5833
|
*
|
|
5813
|
-
* @param
|
|
5834
|
+
* @param facts - Optional structural facts.
|
|
5814
5835
|
* @returns Policy, guides, then selected axis project definitions, separated by one blank line.
|
|
5815
5836
|
*
|
|
5816
5837
|
* @example
|
|
@@ -5818,11 +5839,11 @@ function viteProjectRegistrations(src, app = [], axes = {}) {
|
|
|
5818
5839
|
* viteProjectDefinitions({ bin: true }).includes('export const srcBin =') // true
|
|
5819
5840
|
* ```
|
|
5820
5841
|
*/
|
|
5821
|
-
function viteProjectDefinitions(
|
|
5842
|
+
function viteProjectDefinitions(facts = {}) {
|
|
5822
5843
|
const definitions = [policyViteProject(), guidesViteProject()];
|
|
5823
|
-
if (
|
|
5824
|
-
if (
|
|
5825
|
-
if (
|
|
5844
|
+
if (facts.bin === true) definitions.push(binViteProject());
|
|
5845
|
+
if (facts.integration === true) definitions.push(integrationViteProject(facts));
|
|
5846
|
+
if (facts.service === true) definitions.push(serviceViteProject());
|
|
5826
5847
|
return definitions.join("\n");
|
|
5827
5848
|
}
|
|
5828
5849
|
/**
|
|
@@ -5842,16 +5863,18 @@ function viteProjectDefinitions(axes = {}) {
|
|
|
5842
5863
|
function renderViteTest(registrations, browser) {
|
|
5843
5864
|
const projects = registrations.map((registration) => registration.project);
|
|
5844
5865
|
const inlineProjects = ` projects: [${projects.join(", ")}],`;
|
|
5845
|
-
const renderedProjects =
|
|
5866
|
+
const renderedProjects = fitsPrintWidth(inlineProjects) ? inlineProjects : ` projects: [
|
|
5846
5867
|
${projects.map((project) => ` ${project},`).join("\n")}
|
|
5847
5868
|
],`;
|
|
5848
5869
|
if (!browser) return ` test: {
|
|
5849
5870
|
${renderedProjects}
|
|
5850
5871
|
},`;
|
|
5872
|
+
const renderedRegistrations = registrations.map((registration) => registration.browser === void 0 ? `{ project: ${registration.project} }` : `{ project: ${registration.project}, browser: ${serializeTypeScriptString(registration.browser)} }`);
|
|
5873
|
+
const inlineRegistrations = ` [${renderedRegistrations.join(", ")}],`;
|
|
5851
5874
|
return ` test: gateBrowserProjects(
|
|
5852
|
-
[
|
|
5853
|
-
${
|
|
5854
|
-
]
|
|
5875
|
+
${fitsPrintWidth(inlineRegistrations) ? inlineRegistrations : ` [
|
|
5876
|
+
${renderedRegistrations.map((registration) => ` ${registration},`).join("\n")}
|
|
5877
|
+
],`}
|
|
5855
5878
|
hasChromium,
|
|
5856
5879
|
process.argv,
|
|
5857
5880
|
),`;
|
|
@@ -7448,17 +7471,17 @@ function binViteProject() {
|
|
|
7448
7471
|
/**
|
|
7449
7472
|
* Build the standalone Node-only installed-consumer integration proof project.
|
|
7450
7473
|
*
|
|
7451
|
-
* @param
|
|
7474
|
+
* @param facts - Optional structural facts controlling the shared global setup.
|
|
7452
7475
|
* @returns The emitted `integration` project definition.
|
|
7453
7476
|
*
|
|
7454
7477
|
* @example
|
|
7455
7478
|
* ```ts
|
|
7456
|
-
* integrationViteProject({ bin: true, integration: true }).includes(
|
|
7457
|
-
* "globalSetup: ['./tests/
|
|
7479
|
+
* integrationViteProject({ bin: true, integration: true, global: true }).includes(
|
|
7480
|
+
* "globalSetup: ['./tests/setupGlobal.ts']",
|
|
7458
7481
|
* ) // true
|
|
7459
7482
|
* ```
|
|
7460
7483
|
*/
|
|
7461
|
-
function integrationViteProject(
|
|
7484
|
+
function integrationViteProject(facts = {}) {
|
|
7462
7485
|
return `${EXPORT_KEYWORD} const integration = (config?: UserConfig): UserConfig =>
|
|
7463
7486
|
mergeConfig(
|
|
7464
7487
|
{
|
|
@@ -7467,8 +7490,8 @@ function integrationViteProject(axes = {}) {
|
|
|
7467
7490
|
name: { label: 'integration', color: 'blue' },
|
|
7468
7491
|
include: ['tests/integration/**/*.test.ts'],
|
|
7469
7492
|
setupFiles: ['./tests/setup.ts'],
|
|
7470
|
-
${
|
|
7471
|
-
globalSetup: ['
|
|
7493
|
+
${facts.bin === true && facts.integration === true && facts.global === true ? ` // Wire the template registry for the generated-consumer proof.
|
|
7494
|
+
globalSetup: ['./${GLOBAL_SETUP_PATH}'],
|
|
7472
7495
|
` : ""} environment: 'node',
|
|
7473
7496
|
browser: { enabled: false },
|
|
7474
7497
|
testTimeout: 120_000,
|
|
@@ -7519,7 +7542,7 @@ function serviceViteProject() {
|
|
|
7519
7542
|
* projects.
|
|
7520
7543
|
*
|
|
7521
7544
|
* @param environment - The sole declared non-`core` environment.
|
|
7522
|
-
* @param
|
|
7545
|
+
* @param facts - Optional structural facts.
|
|
7523
7546
|
* @returns The root `vite.config.ts` file content for a single non-`core` environment, newline-terminated.
|
|
7524
7547
|
*
|
|
7525
7548
|
* @example
|
|
@@ -7527,11 +7550,11 @@ function serviceViteProject() {
|
|
|
7527
7550
|
* singleSrcViteConfig('server').includes('srcServer') // true
|
|
7528
7551
|
* ```
|
|
7529
7552
|
*/
|
|
7530
|
-
function singleSrcViteConfig(environment,
|
|
7553
|
+
function singleSrcViteConfig(environment, facts = {}) {
|
|
7531
7554
|
const machinery = viteMachinery([environment]);
|
|
7532
7555
|
const header = viteHeader(machinery);
|
|
7533
|
-
const renderedTest = renderViteTest(viteProjectRegistrations([environment], [],
|
|
7534
|
-
const definitions = viteProjectDefinitions(
|
|
7556
|
+
const renderedTest = renderViteTest(viteProjectRegistrations([environment], [], facts), machinery.browser);
|
|
7557
|
+
const definitions = viteProjectDefinitions(facts);
|
|
7535
7558
|
if (environment === "browser") return `${header}
|
|
7536
7559
|
${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
7537
7560
|
mergeConfig(
|
|
@@ -7558,7 +7581,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7558
7581
|
test: {
|
|
7559
7582
|
name: { label: 'src:browser', color: 'yellow' },
|
|
7560
7583
|
include: ['tests/src/browser/**/*.test.ts'],
|
|
7561
|
-
setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7584
|
+
${facts.global === true ? `globalSetup: ['./${GLOBAL_SETUP_PATH}'],\n\t\t\t\t` : ""}setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7562
7585
|
...(config?.test?.browser?.enabled === false
|
|
7563
7586
|
? {}
|
|
7564
7587
|
: {
|
|
@@ -7647,9 +7670,9 @@ ${renderedTest}
|
|
|
7647
7670
|
* environment is `browser` (it must run its own tests in a real browser).
|
|
7648
7671
|
*
|
|
7649
7672
|
* @param src - The declared `Environment[]`.
|
|
7650
|
-
* @param
|
|
7651
|
-
*
|
|
7652
|
-
*
|
|
7673
|
+
* @param facts - Optional structural facts. `bin` appends the standalone executable
|
|
7674
|
+
* build-and-test project; `integration` and `service` append their standalone
|
|
7675
|
+
* proof projects; `global` wires the shared global-setup module.
|
|
7653
7676
|
* @returns The root `vite.config.ts` file content, newline-terminated.
|
|
7654
7677
|
*
|
|
7655
7678
|
* @example
|
|
@@ -7657,14 +7680,14 @@ ${renderedTest}
|
|
|
7657
7680
|
* rootViteConfig(['core']).includes('srcCore') // true
|
|
7658
7681
|
* ```
|
|
7659
7682
|
*/
|
|
7660
|
-
function rootViteConfig(src,
|
|
7683
|
+
function rootViteConfig(src, facts = {}) {
|
|
7661
7684
|
const hasCore = src.includes("core");
|
|
7662
7685
|
const nonCore = ENVIRONMENTS.filter((environment) => environment !== "core" && src.includes(environment));
|
|
7663
7686
|
const machinery = viteMachinery(src);
|
|
7664
7687
|
const header = viteHeader(machinery);
|
|
7665
7688
|
if (!hasCore) {
|
|
7666
7689
|
const [onlyEnvironment] = nonCore;
|
|
7667
|
-
if (onlyEnvironment === "browser" || onlyEnvironment === "server") return singleSrcViteConfig(onlyEnvironment,
|
|
7690
|
+
if (onlyEnvironment === "browser" || onlyEnvironment === "server") return singleSrcViteConfig(onlyEnvironment, facts);
|
|
7668
7691
|
}
|
|
7669
7692
|
const browserBlock = `
|
|
7670
7693
|
${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
@@ -7691,7 +7714,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7691
7714
|
name: { label: 'src:browser', color: 'yellow' },
|
|
7692
7715
|
include: ['tests/src/browser/**/*.test.ts'],
|
|
7693
7716
|
exclude: ['tests/src/core/**/*.test.ts'],
|
|
7694
|
-
setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7717
|
+
${facts.global === true ? `globalSetup: ['./${GLOBAL_SETUP_PATH}'],\n\t\t\t\t\t` : ""}setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7695
7718
|
...(config?.test?.browser?.enabled === false
|
|
7696
7719
|
? {}
|
|
7697
7720
|
: {
|
|
@@ -7759,7 +7782,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
7759
7782
|
)
|
|
7760
7783
|
`;
|
|
7761
7784
|
const blocks = nonCore.map((environment) => environment === "browser" ? browserBlock : serverBlock).join("");
|
|
7762
|
-
const renderedTest = renderViteTest(viteProjectRegistrations(src, [],
|
|
7785
|
+
const renderedTest = renderViteTest(viteProjectRegistrations(src, [], facts), machinery.browser);
|
|
7763
7786
|
return `${header}
|
|
7764
7787
|
${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7765
7788
|
mergeConfig(
|
|
@@ -7782,7 +7805,7 @@ ${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
|
7782
7805
|
config ?? {},
|
|
7783
7806
|
)
|
|
7784
7807
|
${blocks}
|
|
7785
|
-
${viteProjectDefinitions(
|
|
7808
|
+
${viteProjectDefinitions(facts)}
|
|
7786
7809
|
export default defineConfig({
|
|
7787
7810
|
resolve,
|
|
7788
7811
|
${renderedTest}
|
|
@@ -7795,7 +7818,7 @@ ${renderedTest}
|
|
|
7795
7818
|
*
|
|
7796
7819
|
* @param src - Published src environments.
|
|
7797
7820
|
* @param app - Private app environments.
|
|
7798
|
-
* @param
|
|
7821
|
+
* @param facts - Optional structural facts.
|
|
7799
7822
|
* @returns The root `vite.config.ts` content.
|
|
7800
7823
|
*
|
|
7801
7824
|
* @example
|
|
@@ -7803,9 +7826,9 @@ ${renderedTest}
|
|
|
7803
7826
|
* applicationViteConfig([], ['core', 'server']).includes('appServer') // true
|
|
7804
7827
|
* ```
|
|
7805
7828
|
*/
|
|
7806
|
-
function applicationViteConfig(src, app,
|
|
7829
|
+
function applicationViteConfig(src, app, facts = {}) {
|
|
7807
7830
|
const hasSourceCore = src.includes("core");
|
|
7808
|
-
const machinery = viteMachinery(src, app,
|
|
7831
|
+
const machinery = viteMachinery(src, app, facts.bin === true);
|
|
7809
7832
|
const header = viteHeader(machinery);
|
|
7810
7833
|
const blocks = [];
|
|
7811
7834
|
if (src.includes("core")) blocks.push(`
|
|
@@ -7857,7 +7880,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7857
7880
|
test: {
|
|
7858
7881
|
name: { label: 'src:browser', color: 'yellow' },
|
|
7859
7882
|
include: ['tests/src/browser/**/*.test.ts'],
|
|
7860
|
-
${hasSourceCore ? "exclude: ['tests/src/core/**/*.test.ts'],\n " : ""}setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7883
|
+
${hasSourceCore ? "exclude: ['tests/src/core/**/*.test.ts'],\n " : ""}${facts.global === true ? `globalSetup: ['./${GLOBAL_SETUP_PATH}'],\n\t\t\t\t` : ""}setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7861
7884
|
...(config?.test?.browser?.enabled === false
|
|
7862
7885
|
? {}
|
|
7863
7886
|
: {
|
|
@@ -8040,8 +8063,8 @@ ${EXPORT_KEYWORD} const appServer = (config?: UserConfig): UserConfig =>
|
|
|
8040
8063
|
config ?? {},
|
|
8041
8064
|
)
|
|
8042
8065
|
`);
|
|
8043
|
-
const renderedTest = renderViteTest(viteProjectRegistrations(src, app,
|
|
8044
|
-
const definitions = viteProjectDefinitions(
|
|
8066
|
+
const renderedTest = renderViteTest(viteProjectRegistrations(src, app, facts), machinery.browser);
|
|
8067
|
+
const definitions = viteProjectDefinitions(facts);
|
|
8045
8068
|
return `${header}${blocks.join("")}
|
|
8046
8069
|
${definitions}
|
|
8047
8070
|
export default defineConfig({
|
|
@@ -8454,7 +8477,7 @@ function configArtifacts(spec) {
|
|
|
8454
8477
|
*/
|
|
8455
8478
|
function sourceArtifacts(spec, pascal) {
|
|
8456
8479
|
const inlineTypeImport = `import type { ${pascal}Interface, ${pascal}Options } from './types.js'`;
|
|
8457
|
-
const typeImport =
|
|
8480
|
+
const typeImport = fitsPrintWidth(inlineTypeImport) ? inlineTypeImport : `import type {
|
|
8458
8481
|
${pascal}Interface,
|
|
8459
8482
|
${pascal}Options,
|
|
8460
8483
|
} from './types.js'`;
|
|
@@ -8462,7 +8485,7 @@ function sourceArtifacts(spec, pascal) {
|
|
|
8462
8485
|
const inlineSignature = `function create${pascal}(options: ${pascal}Options): ${pascal}Interface`;
|
|
8463
8486
|
const values = {
|
|
8464
8487
|
pascal,
|
|
8465
|
-
signature:
|
|
8488
|
+
signature: fitsPrintWidth(`export ${inlineSignature} {`) ? inlineSignature : `function create${pascal}(
|
|
8466
8489
|
options: ${pascal}Options,
|
|
8467
8490
|
): ${pascal}Interface`,
|
|
8468
8491
|
typeImport,
|
|
@@ -8536,7 +8559,7 @@ function paritySpecifiers(spec) {
|
|
|
8536
8559
|
for (const environment of spec.app) modules[`@app/${environment}`] = `app/${environment}`;
|
|
8537
8560
|
const specifierItems = selfSpecifiers.map((specifier) => `'${specifier}'`);
|
|
8538
8561
|
const inlineSpecifierList = `[${specifierItems.join(", ")}]`;
|
|
8539
|
-
return `${EXPORT_KEYWORD} ${CONST_KEYWORD} SELF_SPECIFIERS = ${
|
|
8562
|
+
return `${EXPORT_KEYWORD} ${CONST_KEYWORD} SELF_SPECIFIERS = ${fitsPrintWidth(`const SELF_SPECIFIERS = ${inlineSpecifierList}`) ? inlineSpecifierList : `[
|
|
8540
8563
|
${specifierItems.map((specifier) => `\t${specifier},`).join("\n")}
|
|
8541
8564
|
]`}
|
|
8542
8565
|
|
|
@@ -8615,25 +8638,25 @@ function testArtifacts(spec, pascal) {
|
|
|
8615
8638
|
const multilineExplicitInstance = `instance: ${pascal}Interface = new ${pascal}({
|
|
8616
8639
|
id: 'example',
|
|
8617
8640
|
})`;
|
|
8618
|
-
const explicitInstance =
|
|
8641
|
+
const explicitInstance = fitsPrintWidth(`\t\tconst ${inlineExplicitInstance}`) ? inlineExplicitInstance : fitsPrintWidth(`\t\tconst instance: ${pascal}Interface = new ${pascal}({`) ? multilineExplicitInstance : `instance: ${pascal}Interface =
|
|
8619
8642
|
new ${pascal}({
|
|
8620
8643
|
id: 'example',
|
|
8621
8644
|
})`;
|
|
8622
8645
|
const inlineValueImport = `import { create${pascal}, ${pascal} } from '@src/core'`;
|
|
8623
|
-
const valueImport =
|
|
8646
|
+
const valueImport = fitsPrintWidth(inlineValueImport) ? inlineValueImport : `import {
|
|
8624
8647
|
create${pascal},
|
|
8625
8648
|
${pascal},
|
|
8626
8649
|
} from '@src/core'`;
|
|
8627
8650
|
const inlineTestTypeImport = `import type { ${pascal}Interface } from '@src/core'`;
|
|
8628
|
-
const testTypeImport =
|
|
8651
|
+
const testTypeImport = fitsPrintWidth(inlineTestTypeImport) ? inlineTestTypeImport : `import type {
|
|
8629
8652
|
${pascal}Interface,
|
|
8630
8653
|
} from '@src/core'`;
|
|
8631
8654
|
const inlineFactoryInstance = `instance = create${pascal}({ id: 'example' })`;
|
|
8632
|
-
const factoryInstance =
|
|
8655
|
+
const factoryInstance = fitsPrintWidth(`\t\tconst ${inlineFactoryInstance}`) ? inlineFactoryInstance : `instance = create${pascal}({
|
|
8633
8656
|
id: 'example',
|
|
8634
8657
|
})`;
|
|
8635
8658
|
const inlineTypeExpectation = `expectTypeOf(create${pascal}({ id: 'example' })).toEqualTypeOf<${pascal}Interface>()`;
|
|
8636
|
-
const typeExpectation =
|
|
8659
|
+
const typeExpectation = fitsPrintWidth(`\t\t${inlineTypeExpectation}`) ? inlineTypeExpectation : `expectTypeOf(
|
|
8637
8660
|
create${pascal}({ id: 'example' }),
|
|
8638
8661
|
).toEqualTypeOf<${pascal}Interface>()`;
|
|
8639
8662
|
for (const environment of spec.src) {
|
|
@@ -9565,6 +9588,6 @@ function createBlueprint(data) {
|
|
|
9565
9588
|
return candidate;
|
|
9566
9589
|
}
|
|
9567
9590
|
//#endregion
|
|
9568
|
-
export { APP_BROWSER_DEV_DEPENDENCIES, APP_MATRIX, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, CATEGORIES, CHECKOUT_ACTION_SHA, COMPILER_ID, COMPILE_STAGES, CONST_KEYWORD, CONTROL_CHARACTER_PATTERN, Compiler, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENGINES_PATTERN, ENVIRONMENTS, EXPORT_KEYWORD, EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN, FRESHNESS, FUNCTION_KEYWORD, GROUPS, HEX_PATTERN, HOST_PATHS, IMPORT_KEYWORD, INVALID_PATH_CHARACTER_PATTERN, JSON_PRINT_WIDTH, JSON_TAB_WIDTH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_COLLECTION_ITEMS, MAX_DATA_GRAPH_KEYS, MAX_DATA_GRAPH_NODES, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_SERIALIZED_INPUT_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORIGINS, ORKESTREL_RANGE_PATTERN, PlanManager, SCAFFOLD_RANGE, SERVICE_SCRIPT_PATH, SETUP_NODE_ACTION_SHA, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, SYNC_BASELINE_PATTERN, ScaffoldError, TEMPLATES, TYPESCRIPT_EXTENSIONS, VERSION_PATTERN, alignTable, appTsconfig, appViteConfig, applicationArtifacts, applicationViteConfig, applyOverrides, artifactShape, auditToReview, binTsconfig, binViteConfig, binViteProject, blueprint, blueprintShape, blueprintToMembers, blueprintToPlan, bytesToHex, catalogNames, catalogToBlock, ciWorkflow, compareCodeUnit, computeColumnWidth, computeHash, configArtifacts, contentByteLength, contentCodePoint, contentToBytes, contentToHex, coreTsconfig, coreViteConfig, createBlueprint, createCompiler, createPlanManager, delimiterCell, dependency, dependencyShape, devDependenciesFor, diffPlan, dualCondition, entryFields, escapeHtmlText, exportsMap, fillArtifact, findFileConflict, findPathConflict, formatJson, guideArtifacts, guideMemberTable, guideMethods, guideTests, guideUsage, guidesViteProject, hasBlueprintEnvironment, hasOnlyDataProperties, hasValidArtifactBytes, hasValidArtifactHex, hasValidAuditBytes, hasValidBlueprintBytes, hasValidOverrideBytes, hasValidPlanBytes, hasValidPlanHex, hasValidSnapshotBytes, hasValidSyncReportBytes, hostGroup, inferGroup, integrationViteProject, isArtifact, isBehind, isBlueprint, isCompilerEventHooks, isDenseDataArray, isDependency, isEmitterErrorHandler, isMember, isOverride, isPlan, isPlanManagerEventHooks, isScaffoldError, isSyncReport, isWorkspaceName, manifestToDependencies, manifestToName, member, memberShape, override, overrideShape, ownDataValue, packageManifest, padCell, paritySpecifiers, parseBlueprint, parseBoundedJSON, parseCompilerOptions, parsePlan, parsePlanIds, parsePlanManagerOptions, parseSyncReport, pascalCase, pinPlan, planPayload, planShape, planToReview, planToSummary, policyViteProject, rangeToFreshness, renderArray, renderObject, renderValue, renderViteTest, rootTsconfig, rootViteConfig, selectHostPaths, serializeTypeScriptString, serviceViteProject, singleSrcViteConfig, snapshotOf, snapshotPlan, sourceArtifacts, splitTableRow, srcTsconfig, srcVariant, srcViteConfig, stableStringify, syncReportShape, syncToReview, testArtifacts, validateBlueprint, validateDependencyArray, validatePlan, viteHeader, viteMachinery, viteProjectDefinitions, viteProjectRegistrations };
|
|
9591
|
+
export { APP_BROWSER_DEV_DEPENDENCIES, APP_MATRIX, BASE_DEV_DEPENDENCIES, BIN_CONFIGS, CATEGORIES, CHECKOUT_ACTION_SHA, COMPILER_ID, COMPILE_STAGES, CONST_KEYWORD, CONTROL_CHARACTER_PATTERN, Compiler, DEFAULT_ENGINES, DEFAULT_VERSION, DEPENDENCY_NAME_PATTERN, ENGINES_PATTERN, ENVIRONMENTS, EXPORT_KEYWORD, EXTRA_NAME_PATTERN, EXTRA_RANGE_PATTERN, FRESHNESS, FUNCTION_KEYWORD, GLOBAL_SETUP_PATH, GROUPS, HEX_PATTERN, HOST_PATHS, IMPORT_KEYWORD, INVALID_PATH_CHARACTER_PATTERN, JSON_PRINT_WIDTH, JSON_TAB_WIDTH, MAX_ARTIFACT_BYTES, MAX_ARTIFACT_HEX_LENGTH, MAX_COLLECTION_ITEMS, MAX_DATA_GRAPH_KEYS, MAX_DATA_GRAPH_NODES, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_NAME_LENGTH, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_SERIALIZED_INPUT_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MINIMUM_NODE_VERSION, NAME_PATTERN, ORIGINS, ORKESTREL_RANGE_PATTERN, PlanManager, SCAFFOLD_RANGE, SERVICE_SCRIPT_PATH, SETUP_NODE_ACTION_SHA, SOURCE_BROWSER_DEV_DEPENDENCIES, SRC_MATRIX, SYNC_BASELINE_PATTERN, ScaffoldError, TEMPLATES, TYPESCRIPT_EXTENSIONS, VERSION_PATTERN, alignTable, appTsconfig, appViteConfig, applicationArtifacts, applicationViteConfig, applyOverrides, artifactShape, auditToReview, binTsconfig, binViteConfig, binViteProject, blueprint, blueprintShape, blueprintToMembers, blueprintToPlan, bytesToHex, catalogNames, catalogToBlock, ciWorkflow, compareCodeUnit, computeColumnWidth, computeHash, configArtifacts, contentByteLength, contentCodePoint, contentToBytes, contentToHex, coreTsconfig, coreViteConfig, createBlueprint, createCompiler, createPlanManager, delimiterCell, dependency, dependencyShape, devDependenciesFor, diffPlan, dualCondition, entryFields, escapeHtmlText, exportsMap, fillArtifact, findFileConflict, findPathConflict, fitsPrintWidth, formatJson, guideArtifacts, guideMemberTable, guideMethods, guideTests, guideUsage, guidesViteProject, hasBlueprintEnvironment, hasOnlyDataProperties, hasValidArtifactBytes, hasValidArtifactHex, hasValidAuditBytes, hasValidBlueprintBytes, hasValidOverrideBytes, hasValidPlanBytes, hasValidPlanHex, hasValidSnapshotBytes, hasValidSyncReportBytes, hostGroup, inferGroup, integrationViteProject, isArtifact, isBehind, isBlueprint, isCompilerEventHooks, isDenseDataArray, isDependency, isEmitterErrorHandler, isMember, isOverride, isPlan, isPlanManagerEventHooks, isScaffoldError, isSyncReport, isWorkspaceName, manifestToDependencies, manifestToName, member, memberShape, override, overrideShape, ownDataValue, packageManifest, padCell, paritySpecifiers, parseBlueprint, parseBoundedJSON, parseCompilerOptions, parsePlan, parsePlanIds, parsePlanManagerOptions, parseSyncReport, pascalCase, pinPlan, planPayload, planShape, planToReview, planToSummary, policyViteProject, rangeToFreshness, renderArray, renderObject, renderValue, renderViteTest, rootTsconfig, rootViteConfig, selectHostPaths, serializeTypeScriptString, serviceViteProject, singleSrcViteConfig, snapshotOf, snapshotPlan, sourceArtifacts, splitTableRow, srcTsconfig, srcVariant, srcViteConfig, stableStringify, syncReportShape, syncToReview, testArtifacts, validateBlueprint, validateDependencyArray, validatePlan, viteHeader, viteMachinery, viteProjectDefinitions, viteProjectRegistrations };
|
|
9569
9592
|
|
|
9570
9593
|
//# sourceMappingURL=index.js.map
|