@orkestrel/scaffold 0.0.6 → 0.0.7
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/host/CLAUDE.md +53 -27
- package/dist/host/guides/src/scaffold.md +78 -62
- package/dist/host/tests/setupPolicy.ts +1 -0
- package/dist/src/core/index.cjs +199 -62
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +23 -1
- package/dist/src/core/index.d.ts +23 -1
- package/dist/src/core/index.js +199 -63
- package/dist/src/core/index.js.map +1 -1
- package/package.json +8 -7
package/dist/src/core/index.cjs
CHANGED
|
@@ -221,7 +221,7 @@ var DEFAULT_VERSION = "0.0.1";
|
|
|
221
221
|
/** The `engines.node` range the `blueprint` builder fills. */
|
|
222
222
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
223
223
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
224
|
-
var SCAFFOLD_RANGE = "^0.0.
|
|
224
|
+
var SCAFFOLD_RANGE = "^0.0.7";
|
|
225
225
|
/** Tooling versions shared by scaffold and every generated workspace. */
|
|
226
226
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
227
227
|
"@microsoft/api-extractor": "^7.58.12",
|
|
@@ -5602,6 +5602,7 @@ function packageManifest(spec) {
|
|
|
5602
5602
|
}
|
|
5603
5603
|
if (spec.engine) scripts["test:src:bin"] = "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:bin";
|
|
5604
5604
|
if (spec.engine) scripts["test:integration"] = "vitest run --config vite.config.ts --no-cache --reporter=dot --project integration";
|
|
5605
|
+
if (spec.engine) scripts["test:equivalence"] = "node -e \"const c=require('node:child_process'),n=process.platform==='win32'?'npm.cmd':'npm',r=c.spawnSync(n,['run','test:integration'],{stdio:'inherit',env:{...process.env,SCAFFOLD_BOUNDARY_EQUIVALENCE:'1'}});process.exit(r.status??1)\"";
|
|
5605
5606
|
if (spec.app.length > 0) {
|
|
5606
5607
|
scripts["test:app"] = "vitest run --config vite.config.ts --no-cache --reporter=dot " + spec.app.map((environment) => `--project ${APP_MATRIX[environment].project}`).join(" ");
|
|
5607
5608
|
for (const environment of spec.app) scripts[`test:app:${environment}`] = `vitest run --config vite.config.ts --no-cache --reporter=dot --project ${APP_MATRIX[environment].project}`;
|
|
@@ -5762,6 +5763,37 @@ function viteMachinery(src, app = [], engine = false) {
|
|
|
5762
5763
|
};
|
|
5763
5764
|
}
|
|
5764
5765
|
/**
|
|
5766
|
+
* Render the root Vitest project registration, preserving browser ownership
|
|
5767
|
+
* supplied by the caller.
|
|
5768
|
+
*
|
|
5769
|
+
* @param registrations - Ordered project factory identifiers with optional browser labels.
|
|
5770
|
+
* @param browser - Whether the generated configuration carries browser machinery.
|
|
5771
|
+
* @returns The rendered root `test` property.
|
|
5772
|
+
*
|
|
5773
|
+
* @example
|
|
5774
|
+
* ```ts
|
|
5775
|
+
* renderViteTest([{ project: 'srcCore' }], false)
|
|
5776
|
+
* // '\ttest: {\n\t\tprojects: [srcCore],\n\t},'
|
|
5777
|
+
* ```
|
|
5778
|
+
*/
|
|
5779
|
+
function renderViteTest(registrations, browser) {
|
|
5780
|
+
const projects = registrations.map((registration) => registration.project);
|
|
5781
|
+
const inlineProjects = ` projects: [${projects.join(", ")}],`;
|
|
5782
|
+
const renderedProjects = computeColumnWidth(inlineProjects) <= 100 ? inlineProjects : ` projects: [
|
|
5783
|
+
${projects.map((project) => ` ${project},`).join("\n")}
|
|
5784
|
+
],`;
|
|
5785
|
+
if (!browser) return ` test: {
|
|
5786
|
+
${renderedProjects}
|
|
5787
|
+
},`;
|
|
5788
|
+
return ` test: gateBrowserProjects(
|
|
5789
|
+
[
|
|
5790
|
+
${registrations.map((registration) => registration.browser === void 0 ? `{ project: ${registration.project} }` : `{ project: ${registration.project}, browser: ${serializeTypeScriptString(registration.browser)} }`).map((registration) => ` ${registration},`).join("\n")}
|
|
5791
|
+
],
|
|
5792
|
+
hasChromium,
|
|
5793
|
+
process.argv,
|
|
5794
|
+
),`;
|
|
5795
|
+
}
|
|
5796
|
+
/**
|
|
5765
5797
|
* The rendered import / `resolve` header block every `rootViteConfig` shape
|
|
5766
5798
|
* prefixes — the environment boundary and every guarantee it enforces ship
|
|
5767
5799
|
* unconditionally; `machinery` selects only the host-specific pipelines layered
|
|
@@ -5799,6 +5831,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5799
5831
|
transform: {
|
|
5800
5832
|
order: 'pre',
|
|
5801
5833
|
async handler(code, id) {
|
|
5834
|
+
if (!isWorkspaceBoundaryModule(id)) return null
|
|
5802
5835
|
const restored = /[?&]html-proxy(?:[=&]|$)/.test(id) ? restoreIgnoredHtml(code) : code
|
|
5803
5836
|
const target = workspacePath(id)
|
|
5804
5837
|
const physicalImporter = physicalPath(id)
|
|
@@ -5958,6 +5991,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5958
5991
|
transform: {
|
|
5959
5992
|
order: 'pre',
|
|
5960
5993
|
async handler(code, id) {
|
|
5994
|
+
if (!isWorkspaceBoundaryModule(id)) return null
|
|
5961
5995
|
const target = workspacePath(id)
|
|
5962
5996
|
const physicalImporter = physicalPath(id)
|
|
5963
5997
|
const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
|
|
@@ -6040,6 +6074,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
6040
6074
|
transform: {
|
|
6041
6075
|
order: 'pre',
|
|
6042
6076
|
async handler(code, id) {
|
|
6077
|
+
if (!isWorkspaceBoundaryModule(id)) return null
|
|
6043
6078
|
const target = workspacePath(id)
|
|
6044
6079
|
const physicalImporter = physicalPath(id)
|
|
6045
6080
|
const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
|
|
@@ -6131,6 +6166,64 @@ ${EXPORT_KEYWORD} function workspacePath(path: string): string | undefined {
|
|
|
6131
6166
|
return relativePath
|
|
6132
6167
|
}
|
|
6133
6168
|
|
|
6169
|
+
${EXPORT_KEYWORD} function isBoundaryExemptModule(id: string): boolean {
|
|
6170
|
+
const normalizedId = id.replaceAll('\\\\', '/')
|
|
6171
|
+
const [path] = normalizedId.split(/[?#]/)
|
|
6172
|
+
if (
|
|
6173
|
+
path === undefined ||
|
|
6174
|
+
normalizedId.startsWith('\\0') ||
|
|
6175
|
+
normalizedId.includes('virtual:') ||
|
|
6176
|
+
normalizedId === '@vite/client' ||
|
|
6177
|
+
normalizedId === '@vite/env' ||
|
|
6178
|
+
normalizedId.startsWith('/@id/') ||
|
|
6179
|
+
normalizedId.startsWith('/@vite/') ||
|
|
6180
|
+
normalizedId.startsWith('/__vite') ||
|
|
6181
|
+
normalizedId.startsWith('/__vitest') ||
|
|
6182
|
+
normalizedId.startsWith('@vitest/browser') ||
|
|
6183
|
+
normalizedId.includes('/@vitest/browser/')
|
|
6184
|
+
) {
|
|
6185
|
+
return true
|
|
6186
|
+
}
|
|
6187
|
+
let physicalId: string | undefined
|
|
6188
|
+
try {
|
|
6189
|
+
physicalId = physicalPath(id).replaceAll('\\\\', '/')
|
|
6190
|
+
} catch {
|
|
6191
|
+
physicalId = undefined
|
|
6192
|
+
}
|
|
6193
|
+
for (const candidate of physicalId === undefined ? [path] : [path, physicalId]) {
|
|
6194
|
+
if (candidate.split('/').some((segment) => segment.toLowerCase() === 'node_modules')) {
|
|
6195
|
+
return true
|
|
6196
|
+
}
|
|
6197
|
+
}
|
|
6198
|
+
return false
|
|
6199
|
+
}
|
|
6200
|
+
|
|
6201
|
+
${EXPORT_KEYWORD} function isWorkspaceBoundaryModule(id: string): boolean {
|
|
6202
|
+
if (isBoundaryExemptModule(id)) return false
|
|
6203
|
+
const normalizedId = id.replaceAll('\\\\', '/')
|
|
6204
|
+
const [path] = normalizedId.split(/[?#]/)
|
|
6205
|
+
if (path === undefined) return false
|
|
6206
|
+
let candidate = path.startsWith('/@fs/') ? path.slice('/@fs/'.length) : path
|
|
6207
|
+
try {
|
|
6208
|
+
if (/^file:/i.test(candidate)) candidate = fileURLToPath(candidate)
|
|
6209
|
+
} catch {
|
|
6210
|
+
return false
|
|
6211
|
+
}
|
|
6212
|
+
const rootRelative = /^\\/(?:app|src)\\/(?:core|browser|server)\\//.test(candidate)
|
|
6213
|
+
const absoluteCandidate = rootRelative
|
|
6214
|
+
? resolvePath(WORKSPACE_ROOT, candidate.slice(1))
|
|
6215
|
+
: isAbsolute(candidate)
|
|
6216
|
+
? candidate
|
|
6217
|
+
: resolvePath(WORKSPACE_ROOT, candidate)
|
|
6218
|
+
const relativeId = relative(WORKSPACE_ROOT, absoluteCandidate).replaceAll('\\\\', '/')
|
|
6219
|
+
return (
|
|
6220
|
+
relativeId !== '..' &&
|
|
6221
|
+
!relativeId.startsWith('../') &&
|
|
6222
|
+
!isAbsolute(relativeId) &&
|
|
6223
|
+
/^(?:app|src)\\/(?:core|browser|server)\\//.test(relativeId)
|
|
6224
|
+
)
|
|
6225
|
+
}
|
|
6226
|
+
|
|
6134
6227
|
${EXPORT_KEYWORD} function isOutsideWorkspacePath(path: string): boolean {
|
|
6135
6228
|
const [pathWithoutQuery] = path.split('?')
|
|
6136
6229
|
if (pathWithoutQuery === undefined) return false
|
|
@@ -6769,6 +6862,7 @@ ${EXPORT_KEYWORD} function finalizeHtml(): Plugin {
|
|
|
6769
6862
|
const transformed = await transformWithOxc(code, path)
|
|
6770
6863
|
const visitor = new Visitor({
|
|
6771
6864
|
ImportExpression(node) {
|
|
6865
|
+
if (emitted) return
|
|
6772
6866
|
let value: string | undefined
|
|
6773
6867
|
if (node.source.type === 'Literal' && typeof node.source.value === 'string') {
|
|
6774
6868
|
value = node.source.value
|
|
@@ -6867,8 +6961,8 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6867
6961
|
})
|
|
6868
6962
|
},
|
|
6869
6963
|
` : ""} async resolveId(source, importer) {
|
|
6870
|
-
if (importer === undefined) return null
|
|
6871
|
-
if (source
|
|
6964
|
+
if (importer === undefined || !isWorkspaceBoundaryModule(importer)) return null
|
|
6965
|
+
if (isBoundaryExemptModule(source)) return null
|
|
6872
6966
|
const normalizedSource = source.replaceAll('\\\\', '/')
|
|
6873
6967
|
const sourceError = environmentSourceError(owner, normalizedSource)
|
|
6874
6968
|
if (sourceError !== undefined) this.error(sourceError)
|
|
@@ -6945,6 +7039,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6945
7039
|
return null
|
|
6946
7040
|
},
|
|
6947
7041
|
async load(id) {
|
|
7042
|
+
if (!isWorkspaceBoundaryModule(id)) return null
|
|
6948
7043
|
const physicalImporter = physicalPath(id)
|
|
6949
7044
|
const trustedPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
|
|
6950
7045
|
const inferredPackageRoot =
|
|
@@ -7002,6 +7097,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
7002
7097
|
const physical = physicalPath(
|
|
7003
7098
|
isAbsolute(original) ? original : resolvePath(environmentRoot, original),
|
|
7004
7099
|
)
|
|
7100
|
+
if (isBoundaryExemptModule(original) || isBoundaryExemptModule(physical)) continue
|
|
7005
7101
|
const target = workspacePath(physical)
|
|
7006
7102
|
if (target === undefined) {
|
|
7007
7103
|
if (trustedPackageRootFor(physical, trustedPackageRoots) === undefined) {
|
|
@@ -7017,6 +7113,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
7017
7113
|
buildEnd(error) {
|
|
7018
7114
|
if (error !== undefined) return
|
|
7019
7115
|
for (const id of this.getModuleIds()) {
|
|
7116
|
+
if (!isWorkspaceBoundaryModule(id)) continue
|
|
7020
7117
|
const target = workspacePath(id)
|
|
7021
7118
|
if (target === undefined) {
|
|
7022
7119
|
if (
|
|
@@ -7073,7 +7170,58 @@ ${CONST_KEYWORD} resolve = {
|
|
|
7073
7170
|
}, {}),
|
|
7074
7171
|
}
|
|
7075
7172
|
|
|
7076
|
-
${needsBrowser ? `${EXPORT_KEYWORD}
|
|
7173
|
+
${needsBrowser ? `${EXPORT_KEYWORD} function gateBrowserProjects(
|
|
7174
|
+
registrations: readonly {
|
|
7175
|
+
readonly project: () => UserConfig
|
|
7176
|
+
readonly browser?: string
|
|
7177
|
+
}[],
|
|
7178
|
+
available: boolean,
|
|
7179
|
+
argv: readonly string[],
|
|
7180
|
+
): NonNullable<UserConfig['test']> {
|
|
7181
|
+
const projects: UserConfig[] = []
|
|
7182
|
+
const gated: string[] = []
|
|
7183
|
+
for (const registration of registrations) {
|
|
7184
|
+
if (registration.browser !== undefined && !available) {
|
|
7185
|
+
gated.push(registration.browser)
|
|
7186
|
+
projects.push({
|
|
7187
|
+
resolve,
|
|
7188
|
+
test: {
|
|
7189
|
+
name: { label: registration.browser, color: 'yellow' },
|
|
7190
|
+
include: [],
|
|
7191
|
+
environment: 'node',
|
|
7192
|
+
browser: { enabled: false },
|
|
7193
|
+
},
|
|
7194
|
+
})
|
|
7195
|
+
continue
|
|
7196
|
+
}
|
|
7197
|
+
projects.push(registration.project())
|
|
7198
|
+
}
|
|
7199
|
+
if (gated.length === 0) return { projects }
|
|
7200
|
+
console.warn(\`browser projects skipped: Chromium absent (\${gated.join(', ')})\`)
|
|
7201
|
+
const filters: string[] = []
|
|
7202
|
+
let readable = true
|
|
7203
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
7204
|
+
const argument = argv[index]
|
|
7205
|
+
if (argument === '--project') {
|
|
7206
|
+
const filter = argv[index + 1]
|
|
7207
|
+
if (filter === undefined) {
|
|
7208
|
+
readable = false
|
|
7209
|
+
continue
|
|
7210
|
+
}
|
|
7211
|
+
filters.push(filter)
|
|
7212
|
+
index += 1
|
|
7213
|
+
continue
|
|
7214
|
+
}
|
|
7215
|
+
if (argument?.startsWith('--project=') === true) {
|
|
7216
|
+
filters.push(argument.slice('--project='.length))
|
|
7217
|
+
}
|
|
7218
|
+
}
|
|
7219
|
+
return readable && filters.length > 0 && filters.every((filter) => gated.includes(filter))
|
|
7220
|
+
? { passWithNoTests: true, projects }
|
|
7221
|
+
: { projects }
|
|
7222
|
+
}
|
|
7223
|
+
|
|
7224
|
+
${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
7077
7225
|
transformer: 'lightningcss',
|
|
7078
7226
|
lightningcss: {
|
|
7079
7227
|
visitor: () => {
|
|
@@ -7144,7 +7292,6 @@ function singleSrcViteConfig(environment) {
|
|
|
7144
7292
|
const machinery = viteMachinery([environment]);
|
|
7145
7293
|
const header = viteHeader(machinery);
|
|
7146
7294
|
if (environment === "browser") return `${header}
|
|
7147
|
-
if (!hasChromium) console.warn('browser projects skipped: Chromium absent (${SRC_MATRIX.browser.project})')
|
|
7148
7295
|
${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
7149
7296
|
mergeConfig(
|
|
7150
7297
|
{
|
|
@@ -7169,11 +7316,10 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7169
7316
|
},
|
|
7170
7317
|
test: {
|
|
7171
7318
|
name: { label: 'src:browser', color: 'yellow' },
|
|
7172
|
-
include:
|
|
7173
|
-
passWithNoTests: !hasChromium,
|
|
7319
|
+
include: ['tests/src/browser/**/*.test.ts'],
|
|
7174
7320
|
setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7175
7321
|
browser: {
|
|
7176
|
-
enabled:
|
|
7322
|
+
enabled: true,
|
|
7177
7323
|
provider: playwright(),
|
|
7178
7324
|
instances: [{ browser: 'chromium', headless: true }],
|
|
7179
7325
|
},
|
|
@@ -7202,9 +7348,15 @@ ${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>
|
|
|
7202
7348
|
|
|
7203
7349
|
export default defineConfig({
|
|
7204
7350
|
resolve,
|
|
7205
|
-
test:
|
|
7206
|
-
|
|
7207
|
-
|
|
7351
|
+
test: gateBrowserProjects(
|
|
7352
|
+
[
|
|
7353
|
+
{ project: srcBrowser, browser: 'src:browser' },
|
|
7354
|
+
{ project: policy },
|
|
7355
|
+
{ project: guides },
|
|
7356
|
+
],
|
|
7357
|
+
hasChromium,
|
|
7358
|
+
process.argv,
|
|
7359
|
+
),
|
|
7208
7360
|
})
|
|
7209
7361
|
`;
|
|
7210
7362
|
return `${header}
|
|
@@ -7324,12 +7476,11 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7324
7476
|
},
|
|
7325
7477
|
test: {
|
|
7326
7478
|
name: { label: 'src:browser', color: 'yellow' },
|
|
7327
|
-
include:
|
|
7328
|
-
passWithNoTests: !hasChromium,
|
|
7479
|
+
include: ['tests/src/browser/**/*.test.ts'],
|
|
7329
7480
|
exclude: ['tests/src/core/**/*.test.ts'],
|
|
7330
7481
|
setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7331
7482
|
browser: {
|
|
7332
|
-
enabled:
|
|
7483
|
+
enabled: true,
|
|
7333
7484
|
provider: playwright(),
|
|
7334
7485
|
instances: [{ browser: 'chromium', headless: true }],
|
|
7335
7486
|
},
|
|
@@ -7427,20 +7578,17 @@ ${EXPORT_KEYWORD} const integration = (config?: UserConfig): UserConfig =>
|
|
|
7427
7578
|
)
|
|
7428
7579
|
` : "";
|
|
7429
7580
|
const blocks = nonCore.map((environment) => environment === "browser" ? browserBlock : serverBlock).join("") + binBlock;
|
|
7430
|
-
const
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
"
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
const
|
|
7439
|
-
const renderedProjects = computeColumnWidth(inlineProjects) <= 100 ? inlineProjects : ` projects: [
|
|
7440
|
-
${projectNames.map((project) => ` ${project},`).join("\n")}
|
|
7441
|
-
],`;
|
|
7581
|
+
const registrations = [];
|
|
7582
|
+
if (hasCore) registrations.push({ project: "srcCore" });
|
|
7583
|
+
for (const environment of nonCore) registrations.push(environment === "browser" ? {
|
|
7584
|
+
project: "srcBrowser",
|
|
7585
|
+
browser: SRC_MATRIX.browser.project
|
|
7586
|
+
} : { project: "srcServer" });
|
|
7587
|
+
registrations.push({ project: "policy" }, { project: "guides" });
|
|
7588
|
+
if (engine) registrations.push({ project: "srcBin" }, { project: "integration" });
|
|
7589
|
+
const renderedTest = renderViteTest(registrations, machinery.browser);
|
|
7442
7590
|
return `${header}
|
|
7443
|
-
${
|
|
7591
|
+
${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7444
7592
|
mergeConfig(
|
|
7445
7593
|
{
|
|
7446
7594
|
resolve,
|
|
@@ -7478,9 +7626,7 @@ ${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>
|
|
|
7478
7626
|
${blocks}
|
|
7479
7627
|
export default defineConfig({
|
|
7480
7628
|
resolve,
|
|
7481
|
-
|
|
7482
|
-
${renderedProjects}
|
|
7483
|
-
},
|
|
7629
|
+
${renderedTest}
|
|
7484
7630
|
})
|
|
7485
7631
|
`;
|
|
7486
7632
|
}
|
|
@@ -7502,10 +7648,10 @@ function applicationViteConfig(src, app, engine = false) {
|
|
|
7502
7648
|
const hasSourceCore = src.includes("core");
|
|
7503
7649
|
const machinery = viteMachinery(src, app, engine);
|
|
7504
7650
|
const header = viteHeader(machinery);
|
|
7505
|
-
const
|
|
7651
|
+
const registrations = [];
|
|
7506
7652
|
const blocks = [];
|
|
7507
7653
|
if (src.includes("core")) {
|
|
7508
|
-
|
|
7654
|
+
registrations.push({ project: "srcCore" });
|
|
7509
7655
|
blocks.push(`
|
|
7510
7656
|
${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7511
7657
|
mergeConfig(
|
|
@@ -7527,7 +7673,10 @@ ${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
|
7527
7673
|
`);
|
|
7528
7674
|
}
|
|
7529
7675
|
if (src.includes("browser")) {
|
|
7530
|
-
|
|
7676
|
+
registrations.push({
|
|
7677
|
+
project: "srcBrowser",
|
|
7678
|
+
browser: SRC_MATRIX.browser.project
|
|
7679
|
+
});
|
|
7531
7680
|
const coreOutput = hasSourceCore ? `
|
|
7532
7681
|
output: { paths: { '@src/core': '../core/index.js' } },` : "";
|
|
7533
7682
|
const coreExternal = hasSourceCore ? `id === '@src/core' || ` : "";
|
|
@@ -7556,11 +7705,10 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7556
7705
|
},
|
|
7557
7706
|
test: {
|
|
7558
7707
|
name: { label: 'src:browser', color: 'yellow' },
|
|
7559
|
-
include:
|
|
7560
|
-
passWithNoTests: !hasChromium,
|
|
7708
|
+
include: ['tests/src/browser/**/*.test.ts'],
|
|
7561
7709
|
${hasSourceCore ? "exclude: ['tests/src/core/**/*.test.ts'],\n " : ""}setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7562
7710
|
browser: {
|
|
7563
|
-
enabled:
|
|
7711
|
+
enabled: true,
|
|
7564
7712
|
provider: playwright(),
|
|
7565
7713
|
instances: [{ browser: 'chromium', headless: true }],
|
|
7566
7714
|
},
|
|
@@ -7572,7 +7720,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7572
7720
|
`);
|
|
7573
7721
|
}
|
|
7574
7722
|
if (src.includes("server")) {
|
|
7575
|
-
|
|
7723
|
+
registrations.push({ project: "srcServer" });
|
|
7576
7724
|
const coreOutput = hasSourceCore ? `
|
|
7577
7725
|
output: [
|
|
7578
7726
|
{
|
|
@@ -7623,7 +7771,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
7623
7771
|
`);
|
|
7624
7772
|
}
|
|
7625
7773
|
if (app.includes("core")) {
|
|
7626
|
-
|
|
7774
|
+
registrations.push({ project: "appCore" });
|
|
7627
7775
|
blocks.push(`
|
|
7628
7776
|
${EXPORT_KEYWORD} const appCore = (config?: UserConfig): UserConfig =>
|
|
7629
7777
|
mergeConfig(
|
|
@@ -7644,7 +7792,10 @@ ${EXPORT_KEYWORD} const appCore = (config?: UserConfig): UserConfig =>
|
|
|
7644
7792
|
`);
|
|
7645
7793
|
}
|
|
7646
7794
|
if (app.includes("browser")) {
|
|
7647
|
-
|
|
7795
|
+
registrations.push({
|
|
7796
|
+
project: "appBrowser",
|
|
7797
|
+
browser: APP_MATRIX.browser.project
|
|
7798
|
+
});
|
|
7648
7799
|
blocks.push(`
|
|
7649
7800
|
${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
|
|
7650
7801
|
if (config.length > 0) {
|
|
@@ -7685,11 +7836,10 @@ ${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
|
|
|
7685
7836
|
name: { label: '${APP_MATRIX.browser.project}', color: 'blue' },
|
|
7686
7837
|
root: resolveWorkspacePath('.'),
|
|
7687
7838
|
dir: resolveWorkspacePath('.'),
|
|
7688
|
-
include:
|
|
7689
|
-
passWithNoTests: !hasChromium,
|
|
7839
|
+
include: ['tests/app/browser/**/*.test.ts'],
|
|
7690
7840
|
setupFiles: ['./tests/setup.ts', './tests/setupBrowser.ts'],
|
|
7691
7841
|
browser: {
|
|
7692
|
-
enabled:
|
|
7842
|
+
enabled: true,
|
|
7693
7843
|
provider: playwright(),
|
|
7694
7844
|
instances: [{ browser: 'chromium', headless: true }],
|
|
7695
7845
|
},
|
|
@@ -7700,7 +7850,7 @@ ${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
|
|
|
7700
7850
|
`);
|
|
7701
7851
|
}
|
|
7702
7852
|
if (app.includes("server")) {
|
|
7703
|
-
|
|
7853
|
+
registrations.push({ project: "appServer" });
|
|
7704
7854
|
blocks.push(`
|
|
7705
7855
|
${EXPORT_KEYWORD} const appServer = (config?: UserConfig): UserConfig =>
|
|
7706
7856
|
mergeConfig(
|
|
@@ -7734,7 +7884,7 @@ ${EXPORT_KEYWORD} const appServer = (config?: UserConfig): UserConfig =>
|
|
|
7734
7884
|
`);
|
|
7735
7885
|
}
|
|
7736
7886
|
if (engine) {
|
|
7737
|
-
|
|
7887
|
+
registrations.push({ project: "srcBin" }, { project: "integration" });
|
|
7738
7888
|
blocks.push(`
|
|
7739
7889
|
${EXPORT_KEYWORD} const srcBin = (config?: UserConfig): UserConfig =>
|
|
7740
7890
|
mergeConfig(
|
|
@@ -7778,22 +7928,10 @@ ${EXPORT_KEYWORD} const integration = (config?: UserConfig): UserConfig =>
|
|
|
7778
7928
|
)
|
|
7779
7929
|
`);
|
|
7780
7930
|
}
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
"policy",
|
|
7784
|
-
"guides"
|
|
7785
|
-
];
|
|
7786
|
-
const inlineProjects = ` projects: [${projectNames.join(", ")}],`;
|
|
7787
|
-
const renderedProjects = computeColumnWidth(inlineProjects) <= 100 ? inlineProjects : ` projects: [
|
|
7788
|
-
${projectNames.map((project) => ` ${project},`).join("\n")}
|
|
7789
|
-
],`;
|
|
7790
|
-
const browserProjects = [...src.includes("browser") ? [SRC_MATRIX.browser.project] : [], ...app.includes("browser") ? [APP_MATRIX.browser.project] : []];
|
|
7791
|
-
const browserNotice = serializeTypeScriptString(`browser projects skipped: Chromium absent (${browserProjects.join(", ")})`);
|
|
7792
|
-
const inlineBrowserNotice = `if (!hasChromium) console.warn(${browserNotice})`;
|
|
7793
|
-
const renderedBrowserNotice = browserProjects.length === 0 ? void 0 : computeColumnWidth(inlineBrowserNotice) <= 100 ? inlineBrowserNotice : `if (!hasChromium)
|
|
7794
|
-
console.warn(${browserNotice})`;
|
|
7931
|
+
registrations.push({ project: "policy" }, { project: "guides" });
|
|
7932
|
+
const renderedTest = renderViteTest(registrations, machinery.browser);
|
|
7795
7933
|
return `${header}
|
|
7796
|
-
${
|
|
7934
|
+
${policyViteProject()}
|
|
7797
7935
|
${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>
|
|
7798
7936
|
mergeConfig(
|
|
7799
7937
|
{
|
|
@@ -7812,9 +7950,7 @@ ${EXPORT_KEYWORD} const guides = (config?: UserConfig): UserConfig =>
|
|
|
7812
7950
|
${blocks.join("")}
|
|
7813
7951
|
export default defineConfig({
|
|
7814
7952
|
resolve,
|
|
7815
|
-
|
|
7816
|
-
${renderedProjects}
|
|
7817
|
-
},
|
|
7953
|
+
${renderedTest}
|
|
7818
7954
|
})
|
|
7819
7955
|
`;
|
|
7820
7956
|
}
|
|
@@ -9415,6 +9551,7 @@ exports.rangeToFreshness = rangeToFreshness;
|
|
|
9415
9551
|
exports.renderArray = renderArray;
|
|
9416
9552
|
exports.renderObject = renderObject;
|
|
9417
9553
|
exports.renderValue = renderValue;
|
|
9554
|
+
exports.renderViteTest = renderViteTest;
|
|
9418
9555
|
exports.rootTsconfig = rootTsconfig;
|
|
9419
9556
|
exports.rootViteConfig = rootViteConfig;
|
|
9420
9557
|
exports.selectHostPaths = selectHostPaths;
|