@orkestrel/scaffold 0.0.3 → 0.0.5
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/AGENTS.md +1 -1
- package/dist/host/CLAUDE.md +108 -33
- package/dist/host/claude/agents/application.md +0 -2
- package/dist/host/claude/agents/builder.md +1 -3
- package/dist/host/claude/agents/checker.md +0 -1
- package/dist/host/claude/agents/codex.md +89 -19
- package/dist/host/claude/agents/grok.md +27 -7
- package/dist/host/claude/agents/implementer.md +40 -0
- package/dist/host/claude/agents/orkestrel.md +0 -1
- package/dist/host/claude/agents/planner.md +0 -1
- package/dist/host/claude/agents/reviewer.md +1 -2
- package/dist/host/claude/agents/verifier.md +0 -1
- package/dist/host/claude/rules/architecture.md +2 -1
- package/dist/host/claude/settings.json +1 -5
- package/dist/host/codex/agents/implementer.toml +2 -2
- package/dist/host/codex/agents/opus.toml +25 -0
- package/dist/host/codex/config.toml +5 -3
- package/dist/host/cursor/mcp.json +12 -0
- package/dist/host/dotfiles/mcp.json +8 -0
- package/dist/host/guides/src/scaffold.md +39 -5
- package/dist/host/manifest.json +21 -0
- package/dist/host/tests/setupPolicy.ts +47 -11
- package/dist/src/core/index.cjs +168 -93
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +58 -13
- package/dist/src/core/index.d.ts +58 -13
- package/dist/src/core/index.js +168 -94
- package/dist/src/core/index.js.map +1 -1
- package/package.json +2 -1
package/dist/src/core/index.cjs
CHANGED
|
@@ -119,6 +119,8 @@ var HOST_PATHS = Object.freeze([
|
|
|
119
119
|
".claude/settings.json",
|
|
120
120
|
".codex/agents",
|
|
121
121
|
".codex/config.toml",
|
|
122
|
+
".cursor/mcp.json",
|
|
123
|
+
".mcp.json",
|
|
122
124
|
"scripts/deps.sh",
|
|
123
125
|
"scripts/cursor.sh",
|
|
124
126
|
"scripts/codex.sh",
|
|
@@ -216,7 +218,7 @@ var DEFAULT_VERSION = "0.0.1";
|
|
|
216
218
|
/** The `engines.node` range the `blueprint` builder fills. */
|
|
217
219
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
218
220
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
219
|
-
var SCAFFOLD_RANGE = "^0.0.
|
|
221
|
+
var SCAFFOLD_RANGE = "^0.0.5";
|
|
220
222
|
/** Tooling versions shared by scaffold and every generated workspace. */
|
|
221
223
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
222
224
|
"@microsoft/api-extractor": "^7.58.12",
|
|
@@ -5683,30 +5685,69 @@ function rootTsconfig(src, app = []) {
|
|
|
5683
5685
|
});
|
|
5684
5686
|
}
|
|
5685
5687
|
/**
|
|
5688
|
+
* Derive which host-specific machinery a workspace's generated root
|
|
5689
|
+
* `vite.config.ts` carries from its declared environments.
|
|
5690
|
+
*
|
|
5691
|
+
* @remarks
|
|
5692
|
+
* This is the SOLE derivation of that set; `rootViteConfig`,
|
|
5693
|
+
* `singleSrcViteConfig`, `applicationViteConfig`, and `configArtifacts` all
|
|
5694
|
+
* read it rather than recomputing an axis of their own. Nothing here selects
|
|
5695
|
+
* a boundary GUARANTEE — the environment-boundary plugin, its module-graph
|
|
5696
|
+
* AST audit, and stylesheet rejection ship in every shape.
|
|
5697
|
+
*
|
|
5698
|
+
* @param src - The declared published `Environment[]`.
|
|
5699
|
+
* @param app - The declared application `Environment[]`, defaulting to none.
|
|
5700
|
+
* @param engine - Whether the workspace also builds its own executable.
|
|
5701
|
+
* @returns The machinery set the generated header renders.
|
|
5702
|
+
*
|
|
5703
|
+
* @example
|
|
5704
|
+
* ```ts
|
|
5705
|
+
* viteMachinery(['core']) // { browser: false, vue: false, output: true }
|
|
5706
|
+
* viteMachinery([], ['core']) // { browser: false, vue: false, output: false }
|
|
5707
|
+
* ```
|
|
5708
|
+
*/
|
|
5709
|
+
function viteMachinery(src, app = [], engine = false) {
|
|
5710
|
+
const unbuilt = src.length === 0 && app.length > 0 && !engine && app.every((environment) => environment === "core");
|
|
5711
|
+
return {
|
|
5712
|
+
browser: src.includes("browser") || app.includes("browser"),
|
|
5713
|
+
vue: app.includes("browser"),
|
|
5714
|
+
output: !unbuilt
|
|
5715
|
+
};
|
|
5716
|
+
}
|
|
5717
|
+
/**
|
|
5686
5718
|
* The rendered import / `resolve` header block every `rootViteConfig` shape
|
|
5687
|
-
* prefixes — the
|
|
5688
|
-
* `
|
|
5689
|
-
*
|
|
5690
|
-
*
|
|
5691
|
-
* `core
|
|
5692
|
-
*
|
|
5693
|
-
*
|
|
5694
|
-
* @param
|
|
5719
|
+
* prefixes — the environment boundary and every guarantee it enforces ship
|
|
5720
|
+
* unconditionally; `machinery` selects only the host-specific pipelines layered
|
|
5721
|
+
* over them, per the three grounded `rootViteConfig` shapes: browser machinery
|
|
5722
|
+
* unconditional for a multi-environment blueprint carrying `browser`,
|
|
5723
|
+
* conditional on the sole environment being `'browser'` for a single non-`core`
|
|
5724
|
+
* environment, absent for `core`-only.
|
|
5725
|
+
*
|
|
5726
|
+
* @param machinery - The host-specific machinery this shape carries, from `viteMachinery`.
|
|
5695
5727
|
* @returns The rendered header block, newline-terminated.
|
|
5696
5728
|
*
|
|
5697
5729
|
* @example
|
|
5698
5730
|
* ```ts
|
|
5699
|
-
* viteHeader(
|
|
5700
|
-
* viteHeader(
|
|
5731
|
+
* viteHeader(viteMachinery(['core'])).includes('@vitest/browser-playwright') // false
|
|
5732
|
+
* viteHeader(viteMachinery(['core', 'browser'])).includes('@vitest/browser-playwright') // true
|
|
5701
5733
|
* ```
|
|
5702
5734
|
*/
|
|
5703
|
-
function viteHeader(
|
|
5704
|
-
const
|
|
5735
|
+
function viteHeader(machinery) {
|
|
5736
|
+
const { browser: needsBrowser, vue: needsVue, output: needsOutput } = machinery;
|
|
5737
|
+
const playwrightImports = needsBrowser ? `import { playwright } from '@vitest/browser-playwright'
|
|
5705
5738
|
import { chromium } from 'playwright'
|
|
5706
5739
|
` : "";
|
|
5707
5740
|
const vueImports = needsVue ? `import vue from '@vitejs/plugin-vue'
|
|
5708
5741
|
import { parse as parseVue } from 'vue/compiler-sfc'
|
|
5709
5742
|
` : "";
|
|
5743
|
+
const viteTypeImports = needsVue ? `import type {
|
|
5744
|
+
CSSOptions,
|
|
5745
|
+
HtmlAssetSource,
|
|
5746
|
+
HTMLOptions,
|
|
5747
|
+
Plugin,
|
|
5748
|
+
ResolvedConfig,
|
|
5749
|
+
UserConfig,
|
|
5750
|
+
} from 'vite'` : needsBrowser ? `import type { CSSOptions, Plugin, ResolvedConfig, UserConfig } from 'vite'` : `import type { Plugin, UserConfig } from 'vite'`;
|
|
5710
5751
|
const vueBoundary = needsVue ? `,
|
|
5711
5752
|
transform: {
|
|
5712
5753
|
order: 'pre',
|
|
@@ -5866,11 +5907,10 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5866
5907
|
}
|
|
5867
5908
|
return restored === code ? null : restored
|
|
5868
5909
|
},
|
|
5869
|
-
}` : `,
|
|
5910
|
+
}` : needsBrowser ? `,
|
|
5870
5911
|
transform: {
|
|
5871
5912
|
order: 'pre',
|
|
5872
5913
|
async handler(code, id) {
|
|
5873
|
-
const restored = /[?&]html-proxy(?:[=&]|$)/.test(id) ? restoreIgnoredHtml(code) : code
|
|
5874
5914
|
const target = workspacePath(id)
|
|
5875
5915
|
const physicalImporter = physicalPath(id)
|
|
5876
5916
|
const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
|
|
@@ -5884,15 +5924,13 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5884
5924
|
}
|
|
5885
5925
|
const environmentModule =
|
|
5886
5926
|
target !== undefined && /^(?:app|src)\\/(?:core|browser|server)\\//.test(target)
|
|
5887
|
-
if (!environmentModule && importerPackageRoot === undefined)
|
|
5888
|
-
return restored === code ? null : restored
|
|
5889
|
-
}
|
|
5927
|
+
if (!environmentModule && importerPackageRoot === undefined) return null
|
|
5890
5928
|
if (isCSSRequest(id)) {
|
|
5891
5929
|
const config = resolvedConfig
|
|
5892
5930
|
if (config === undefined) {
|
|
5893
5931
|
this.error('Environment boundary requires resolved Vite configuration')
|
|
5894
5932
|
}
|
|
5895
|
-
const stylesheet = await preprocessCSS(
|
|
5933
|
+
const stylesheet = await preprocessCSS(code, id, config)
|
|
5896
5934
|
for (const dependency of stylesheet.deps ?? []) {
|
|
5897
5935
|
const physicalDependency = physicalPath(dependency)
|
|
5898
5936
|
const dependencyTarget = workspacePath(physicalDependency)
|
|
@@ -5906,7 +5944,7 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5906
5944
|
if (dependencyError !== undefined) this.error(dependencyError)
|
|
5907
5945
|
}
|
|
5908
5946
|
}
|
|
5909
|
-
for (const source of await environmentAssetSources(
|
|
5947
|
+
for (const source of await environmentAssetSources(code, id)) {
|
|
5910
5948
|
const normalizedSource = source.replaceAll('\\\\', '/')
|
|
5911
5949
|
const sourceError = environmentSourceError(owner, normalizedSource)
|
|
5912
5950
|
if (sourceError !== undefined) this.error(sourceError)
|
|
@@ -5949,12 +5987,74 @@ import { parse as parseVue } from 'vue/compiler-sfc'
|
|
|
5949
5987
|
const assetError = environmentPathError(owner, resolvedSource)
|
|
5950
5988
|
if (assetError !== undefined) this.error(assetError)
|
|
5951
5989
|
}
|
|
5952
|
-
return
|
|
5990
|
+
return null
|
|
5991
|
+
},
|
|
5992
|
+
}` : `,
|
|
5993
|
+
transform: {
|
|
5994
|
+
order: 'pre',
|
|
5995
|
+
async handler(code, id) {
|
|
5996
|
+
const target = workspacePath(id)
|
|
5997
|
+
const physicalImporter = physicalPath(id)
|
|
5998
|
+
const importerPackageRoot = trustedPackageRootFor(physicalImporter, trustedPackageRoots)
|
|
5999
|
+
if (target === undefined) {
|
|
6000
|
+
if (isOutsideWorkspacePath(id) && importerPackageRoot === undefined) {
|
|
6001
|
+
this.error('Environment modules cannot import files outside the workspace')
|
|
6002
|
+
}
|
|
6003
|
+
} else {
|
|
6004
|
+
const pathError = environmentPathError(owner, target)
|
|
6005
|
+
if (pathError !== undefined) this.error(pathError)
|
|
6006
|
+
}
|
|
6007
|
+
const environmentModule =
|
|
6008
|
+
target !== undefined && /^(?:app|src)\\/(?:core|browser|server)\\//.test(target)
|
|
6009
|
+
if (!environmentModule && importerPackageRoot === undefined) return null
|
|
6010
|
+
for (const source of await environmentAssetSources(code, id)) {
|
|
6011
|
+
const normalizedSource = source.replaceAll('\\\\', '/')
|
|
6012
|
+
const sourceError = environmentSourceError(owner, normalizedSource)
|
|
6013
|
+
if (sourceError !== undefined) this.error(sourceError)
|
|
6014
|
+
const [sourcePath] = normalizedSource.split(/[?#]/)
|
|
6015
|
+
if (sourcePath !== undefined && isBuiltin(sourcePath)) continue
|
|
6016
|
+
const resolution = await this.resolve(normalizedSource, id, { skipSelf: true })
|
|
6017
|
+
const fallbackSource = sourceFallback(physicalImporter, normalizedSource)
|
|
6018
|
+
const physicalSource = physicalPath(resolution?.id ?? fallbackSource)
|
|
6019
|
+
if (importerPackageRoot !== undefined) {
|
|
6020
|
+
const pathLike =
|
|
6021
|
+
normalizedSource.startsWith('.') ||
|
|
6022
|
+
normalizedSource.startsWith('/') ||
|
|
6023
|
+
/^file:/i.test(normalizedSource) ||
|
|
6024
|
+
/^[A-Za-z]:[\\\\/]/.test(normalizedSource)
|
|
6025
|
+
if (pathLike && !containedPath(importerPackageRoot, physicalSource)) {
|
|
6026
|
+
this.error(
|
|
6027
|
+
'Dependency modules cannot import files outside their physical package root',
|
|
6028
|
+
)
|
|
6029
|
+
}
|
|
6030
|
+
if (!pathLike && !containedPath(importerPackageRoot, physicalSource)) {
|
|
6031
|
+
const packageName = packageNameOf(normalizedSource)
|
|
6032
|
+
const packageRoot = normalizedSource.startsWith('#')
|
|
6033
|
+
? workspacePath(physicalSource) === undefined
|
|
6034
|
+
? packageRootForResolved(physicalSource)
|
|
6035
|
+
: undefined
|
|
6036
|
+
: packageName === undefined
|
|
6037
|
+
? undefined
|
|
6038
|
+
: packageRootOf(packageName, physicalSource)
|
|
6039
|
+
if (packageRoot === undefined || !containedPath(packageRoot, physicalSource)) {
|
|
6040
|
+
this.error('Resolved dependencies must remain inside their physical package root')
|
|
6041
|
+
}
|
|
6042
|
+
trustedPackageRoots.add(packageRoot)
|
|
6043
|
+
}
|
|
6044
|
+
continue
|
|
6045
|
+
}
|
|
6046
|
+
const resolvedSource = workspacePath(physicalSource)
|
|
6047
|
+
if (resolvedSource === undefined) {
|
|
6048
|
+
this.error('Environment modules cannot import files outside the workspace')
|
|
6049
|
+
}
|
|
6050
|
+
const assetError = environmentPathError(owner, resolvedSource)
|
|
6051
|
+
if (assetError !== undefined) this.error(assetError)
|
|
6052
|
+
}
|
|
6053
|
+
return null
|
|
5953
6054
|
},
|
|
5954
6055
|
}`;
|
|
5955
6056
|
const environmentBoundary = `
|
|
5956
|
-
${CONST_KEYWORD} WORKSPACE_ROOT = realpathSync.native(dirname(fileURLToPath(import.meta.url)))
|
|
5957
|
-
${EXPORT_KEYWORD} ${CONST_KEYWORD} IMPORT_META_ENV_PREFIX = 'import.meta.env.'
|
|
6057
|
+
${CONST_KEYWORD} WORKSPACE_ROOT = realpathSync.native(dirname(fileURLToPath(import.meta.url)))${needsVue ? `\n${EXPORT_KEYWORD} ${CONST_KEYWORD} IMPORT_META_ENV_PREFIX = 'import.meta.env.'` : ""}
|
|
5958
6058
|
|
|
5959
6059
|
${EXPORT_KEYWORD} function physicalPath(path: string): string {
|
|
5960
6060
|
const [pathWithoutQuery] = path.split('?')
|
|
@@ -5999,9 +6099,9 @@ ${EXPORT_KEYWORD} function containedPath(root: string, target: string): boolean
|
|
|
5999
6099
|
relativePath === '' ||
|
|
6000
6100
|
(relativePath !== '..' && !relativePath.startsWith(\`..\${sep}\`) && !isAbsolute(relativePath))
|
|
6001
6101
|
)
|
|
6002
|
-
}
|
|
6102
|
+
}${needsVue ? `
|
|
6003
6103
|
|
|
6004
|
-
${
|
|
6104
|
+
${EXPORT_KEYWORD} function browserServerRoots(): readonly string[] {
|
|
6005
6105
|
const roots: string[] = []
|
|
6006
6106
|
for (const path of [
|
|
6007
6107
|
'app/browser',
|
|
@@ -6283,7 +6383,7 @@ ${EXPORT_KEYWORD} function environmentSourceError(owner: string, source: string)
|
|
|
6283
6383
|
return undefined
|
|
6284
6384
|
}
|
|
6285
6385
|
|
|
6286
|
-
${EXPORT_KEYWORD} function stylesheetAssetError(
|
|
6386
|
+
${needsBrowser ? `${EXPORT_KEYWORD} function stylesheetAssetError(
|
|
6287
6387
|
source: string | undefined,
|
|
6288
6388
|
value: string,
|
|
6289
6389
|
): string | undefined {
|
|
@@ -6330,7 +6430,7 @@ ${EXPORT_KEYWORD} function stylesheetAssetError(
|
|
|
6330
6430
|
return undefined
|
|
6331
6431
|
}
|
|
6332
6432
|
|
|
6333
|
-
${EXPORT_KEYWORD} function enforceOutputPath(configured: string, expected: string): void {
|
|
6433
|
+
` : ""}${needsOutput ? `${EXPORT_KEYWORD} function enforceOutputPath(configured: string, expected: string): void {
|
|
6334
6434
|
if (relative(expected, configured) !== '') {
|
|
6335
6435
|
throw new Error(
|
|
6336
6436
|
'[orkestrel-output-boundary] Build output must use its exact configured workspace directory',
|
|
@@ -6397,7 +6497,7 @@ ${EXPORT_KEYWORD} function outputBoundary(output: string): Plugin {
|
|
|
6397
6497
|
}
|
|
6398
6498
|
}
|
|
6399
6499
|
|
|
6400
|
-
${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined {
|
|
6500
|
+
` : ""}${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined {
|
|
6401
6501
|
try {
|
|
6402
6502
|
return decodeURI(source)
|
|
6403
6503
|
} catch {
|
|
@@ -6405,7 +6505,7 @@ ${EXPORT_KEYWORD} function decodeAssetSource(source: string): string | undefined
|
|
|
6405
6505
|
}
|
|
6406
6506
|
}
|
|
6407
6507
|
|
|
6408
|
-
${EXPORT_KEYWORD} function filterHtmlAssetSource(
|
|
6508
|
+
${needsVue ? `${EXPORT_KEYWORD} function filterHtmlAssetSource(
|
|
6409
6509
|
data: Parameters<NonNullable<HtmlAssetSource['filter']>>[0],
|
|
6410
6510
|
): boolean {
|
|
6411
6511
|
const decoded = decodeAssetSource(data.value)
|
|
@@ -6550,7 +6650,7 @@ ${EXPORT_KEYWORD} function maskIgnoredHtml(environmentKeys: ReadonlySet<string>,
|
|
|
6550
6650
|
)
|
|
6551
6651
|
}
|
|
6552
6652
|
|
|
6553
|
-
${EXPORT_KEYWORD} function restoreIgnoredHtml(code: string): string {
|
|
6653
|
+
` : ""}${needsVue ? `${EXPORT_KEYWORD} function restoreIgnoredHtml(code: string): string {
|
|
6554
6654
|
const literals = code.replace(
|
|
6555
6655
|
/(?<prefix>[vV][iI][tT][eE])-(?<suffix>[iI][gG][nN][oO][rR][eE])/gu,
|
|
6556
6656
|
'$<prefix>-$<suffix>',
|
|
@@ -6606,7 +6706,7 @@ ${EXPORT_KEYWORD} function finalizeHtml(): Plugin {
|
|
|
6606
6706
|
}
|
|
6607
6707
|
}
|
|
6608
6708
|
|
|
6609
|
-
${EXPORT_KEYWORD} async function environmentAssetSources(
|
|
6709
|
+
` : ""}${EXPORT_KEYWORD} async function environmentAssetSources(
|
|
6610
6710
|
code: string,
|
|
6611
6711
|
id: string,
|
|
6612
6712
|
emitted = false,
|
|
@@ -6691,23 +6791,19 @@ ${EXPORT_KEYWORD} async function environmentAssetSources(
|
|
|
6691
6791
|
}
|
|
6692
6792
|
},
|
|
6693
6793
|
})
|
|
6694
|
-
visitor.visit(
|
|
6794
|
+
visitor.visit(parseSync(path, transformed.code).program)
|
|
6695
6795
|
return sources
|
|
6696
6796
|
}
|
|
6697
6797
|
|
|
6698
6798
|
${EXPORT_KEYWORD} function environmentBoundary(
|
|
6699
6799
|
owner: 'src/core' | 'src/browser' | 'src/server' | 'app/core' | 'app/browser' | 'app/server',
|
|
6700
6800
|
): Plugin {
|
|
6701
|
-
const trustedPackageRoots = new Set<string>()
|
|
6702
|
-
let environmentRoot = WORKSPACE_ROOT
|
|
6703
|
-
let resolvedConfig: ResolvedConfig | undefined
|
|
6801
|
+
const trustedPackageRoots = new Set<string>()${needsOutput ? "\n let environmentRoot = WORKSPACE_ROOT" : ""}${needsBrowser ? "\n let resolvedConfig: ResolvedConfig | undefined" : ""}
|
|
6704
6802
|
return {
|
|
6705
6803
|
name: 'orkestrel-environment-boundary',
|
|
6706
|
-
enforce: 'pre'
|
|
6707
|
-
configResolved(config) {
|
|
6708
|
-
|
|
6709
|
-
resolvedConfig = config
|
|
6710
|
-
},
|
|
6804
|
+
enforce: 'pre',${needsOutput || needsBrowser ? `
|
|
6805
|
+
configResolved(config) {${needsOutput ? "\n environmentRoot = physicalPath(config.root)" : ""}${needsBrowser ? "\n resolvedConfig = config" : ""}
|
|
6806
|
+
},` : ""}
|
|
6711
6807
|
${needsVue ? ` configureServer(server) {
|
|
6712
6808
|
if (owner !== 'app/browser') return
|
|
6713
6809
|
const roots = browserServerRoots()
|
|
@@ -6840,7 +6936,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6840
6936
|
}
|
|
6841
6937
|
}
|
|
6842
6938
|
return null
|
|
6843
|
-
}
|
|
6939
|
+
},${needsOutput ? `
|
|
6844
6940
|
async generateBundle(_options, bundle) {
|
|
6845
6941
|
for (const output of Object.values(bundle)) {
|
|
6846
6942
|
if (output.type === 'chunk') {
|
|
@@ -6870,7 +6966,7 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6870
6966
|
if (pathError !== undefined) this.error(pathError)
|
|
6871
6967
|
}
|
|
6872
6968
|
}
|
|
6873
|
-
}
|
|
6969
|
+
},` : ""}
|
|
6874
6970
|
buildEnd(error) {
|
|
6875
6971
|
if (error !== undefined) return
|
|
6876
6972
|
for (const id of this.getModuleIds()) {
|
|
@@ -6891,16 +6987,10 @@ ${needsVue ? ` configureServer(server) {
|
|
|
6891
6987
|
}
|
|
6892
6988
|
}
|
|
6893
6989
|
`;
|
|
6894
|
-
return
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
Plugin,
|
|
6899
|
-
ResolvedConfig,
|
|
6900
|
-
UserConfig,
|
|
6901
|
-
} from 'vite'
|
|
6902
|
-
import { isCSSRequest, parseAst, preprocessCSS, transformWithOxc, Visitor } from 'vite'
|
|
6903
|
-
import { defineConfig, mergeConfig } from 'vitest/config'
|
|
6990
|
+
return `${viteTypeImports}
|
|
6991
|
+
${needsBrowser ? `import { isCSSRequest, parseSync, preprocessCSS, transformWithOxc, Visitor } from 'vite'
|
|
6992
|
+
` : `import { parseSync, transformWithOxc, Visitor } from 'vite'
|
|
6993
|
+
`}import { defineConfig, mergeConfig } from 'vitest/config'
|
|
6904
6994
|
import tsconfig from './tsconfig.json' with { type: 'json' }
|
|
6905
6995
|
import { fileURLToPath, URL } from 'node:url'
|
|
6906
6996
|
import { isBuiltin } from 'node:module'
|
|
@@ -6915,8 +7005,7 @@ import {
|
|
|
6915
7005
|
realpathSync,
|
|
6916
7006
|
} from 'node:fs'
|
|
6917
7007
|
import { dirname, isAbsolute, relative, resolve as resolvePath, sep } from 'node:path'
|
|
6918
|
-
${playwrightImports}${vueImports}
|
|
6919
|
-
${needsPlaywright ? `${CONST_KEYWORD} hasChromium = existsSync(chromium.executablePath())\n` : ""}
|
|
7008
|
+
${playwrightImports}${vueImports}${needsBrowser ? `\n${CONST_KEYWORD} hasChromium = existsSync(chromium.executablePath())\n` : ""}
|
|
6920
7009
|
${EXPORT_KEYWORD} function resolveWorkspacePath(relativePath: string): string {
|
|
6921
7010
|
return fileURLToPath(new URL(relativePath, import.meta.url))
|
|
6922
7011
|
}
|
|
@@ -6937,7 +7026,7 @@ ${CONST_KEYWORD} resolve = {
|
|
|
6937
7026
|
}, {}),
|
|
6938
7027
|
}
|
|
6939
7028
|
|
|
6940
|
-
${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
7029
|
+
${needsBrowser ? `${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
6941
7030
|
transformer: 'lightningcss',
|
|
6942
7031
|
lightningcss: {
|
|
6943
7032
|
visitor: () => {
|
|
@@ -6968,7 +7057,7 @@ ${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_CSS = Object.freeze({
|
|
|
6968
7057
|
},
|
|
6969
7058
|
},
|
|
6970
7059
|
} satisfies CSSOptions)
|
|
6971
|
-
${EXPORT_KEYWORD} ${CONST_KEYWORD} PACKAGE_MANIFEST_BYTES = 1_048_576
|
|
7060
|
+
` : ""}${EXPORT_KEYWORD} ${CONST_KEYWORD} PACKAGE_MANIFEST_BYTES = 1_048_576
|
|
6972
7061
|
${EXPORT_KEYWORD} ${CONST_KEYWORD} ENVIRONMENT_MODULE_BYTES = 8_388_608
|
|
6973
7062
|
${environmentBoundary}`;
|
|
6974
7063
|
}
|
|
@@ -7005,7 +7094,8 @@ function policyViteProject() {
|
|
|
7005
7094
|
* ```
|
|
7006
7095
|
*/
|
|
7007
7096
|
function singleSrcViteConfig(environment) {
|
|
7008
|
-
const
|
|
7097
|
+
const machinery = viteMachinery([environment]);
|
|
7098
|
+
const header = viteHeader(machinery);
|
|
7009
7099
|
if (environment === "browser") return `${header}
|
|
7010
7100
|
${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
7011
7101
|
mergeConfig(
|
|
@@ -7013,10 +7103,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7013
7103
|
resolve,
|
|
7014
7104
|
css: ENVIRONMENT_CSS,
|
|
7015
7105
|
publicDir: false,
|
|
7016
|
-
plugins: [
|
|
7017
|
-
outputBoundary('dist/src/browser'),
|
|
7018
|
-
environmentBoundary('src/browser'),
|
|
7019
|
-
],
|
|
7106
|
+
plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
|
|
7020
7107
|
build: {
|
|
7021
7108
|
assetsInlineLimit: 0,
|
|
7022
7109
|
emptyOutDir: true,
|
|
@@ -7076,13 +7163,9 @@ export default defineConfig({
|
|
|
7076
7163
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7077
7164
|
mergeConfig(
|
|
7078
7165
|
{
|
|
7079
|
-
resolve,
|
|
7080
|
-
css: ENVIRONMENT_CSS,
|
|
7166
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7081
7167
|
publicDir: false,
|
|
7082
|
-
plugins: [
|
|
7083
|
-
outputBoundary('dist/src/server'),
|
|
7084
|
-
environmentBoundary('src/server'),
|
|
7085
|
-
],
|
|
7168
|
+
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7086
7169
|
build: {
|
|
7087
7170
|
emptyOutDir: true,
|
|
7088
7171
|
sourcemap: true,
|
|
@@ -7164,7 +7247,8 @@ export default defineConfig({
|
|
|
7164
7247
|
function rootViteConfig(src, engine = false) {
|
|
7165
7248
|
const hasCore = src.includes("core");
|
|
7166
7249
|
const nonCore = src.filter((environment) => environment !== "core");
|
|
7167
|
-
const
|
|
7250
|
+
const machinery = viteMachinery(src);
|
|
7251
|
+
const header = viteHeader(machinery);
|
|
7168
7252
|
if (!hasCore) {
|
|
7169
7253
|
const [onlyEnvironment] = nonCore;
|
|
7170
7254
|
if (onlyEnvironment === "browser" || onlyEnvironment === "server") return singleSrcViteConfig(onlyEnvironment);
|
|
@@ -7176,10 +7260,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7176
7260
|
{
|
|
7177
7261
|
css: ENVIRONMENT_CSS,
|
|
7178
7262
|
publicDir: false,
|
|
7179
|
-
plugins: [
|
|
7180
|
-
outputBoundary('dist/src/browser'),
|
|
7181
|
-
environmentBoundary('src/browser'),
|
|
7182
|
-
],
|
|
7263
|
+
plugins: [outputBoundary('dist/src/browser'), environmentBoundary('src/browser')],
|
|
7183
7264
|
build: {
|
|
7184
7265
|
assetsInlineLimit: 0,
|
|
7185
7266
|
lib: {
|
|
@@ -7215,13 +7296,9 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7215
7296
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7216
7297
|
srcCore(
|
|
7217
7298
|
mergeConfig(
|
|
7218
|
-
{
|
|
7219
|
-
css: ENVIRONMENT_CSS,
|
|
7299
|
+
{${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7220
7300
|
publicDir: false,
|
|
7221
|
-
plugins: [
|
|
7222
|
-
outputBoundary('dist/src/server'),
|
|
7223
|
-
environmentBoundary('src/server'),
|
|
7224
|
-
],
|
|
7301
|
+
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7225
7302
|
build: {
|
|
7226
7303
|
lib: {
|
|
7227
7304
|
entry: resolveWorkspacePath('src/server/index.ts'),
|
|
@@ -7371,7 +7448,8 @@ export default defineConfig({
|
|
|
7371
7448
|
*/
|
|
7372
7449
|
function applicationViteConfig(src, app, engine = false) {
|
|
7373
7450
|
const hasSourceCore = src.includes("core");
|
|
7374
|
-
const
|
|
7451
|
+
const machinery = viteMachinery(src, app, engine);
|
|
7452
|
+
const header = viteHeader(machinery);
|
|
7375
7453
|
const projects = [];
|
|
7376
7454
|
const blocks = [];
|
|
7377
7455
|
if (src.includes("core")) {
|
|
@@ -7380,8 +7458,7 @@ function applicationViteConfig(src, app, engine = false) {
|
|
|
7380
7458
|
${EXPORT_KEYWORD} const srcCore = (config?: UserConfig): UserConfig =>
|
|
7381
7459
|
mergeConfig(
|
|
7382
7460
|
{
|
|
7383
|
-
resolve,
|
|
7384
|
-
css: ENVIRONMENT_CSS,
|
|
7461
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7385
7462
|
publicDir: false,
|
|
7386
7463
|
plugins: [environmentBoundary('src/core')],
|
|
7387
7464
|
build: { emptyOutDir: true, sourcemap: true, minify: false },
|
|
@@ -7463,8 +7540,7 @@ ${EXPORT_KEYWORD} const srcBrowser = (config?: UserConfig): UserConfig =>
|
|
|
7463
7540
|
${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
7464
7541
|
mergeConfig(
|
|
7465
7542
|
{
|
|
7466
|
-
resolve,
|
|
7467
|
-
css: ENVIRONMENT_CSS,
|
|
7543
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7468
7544
|
publicDir: false,
|
|
7469
7545
|
plugins: [outputBoundary('dist/src/server'), environmentBoundary('src/server')],
|
|
7470
7546
|
build: {
|
|
@@ -7500,8 +7576,7 @@ ${EXPORT_KEYWORD} const srcServer = (config?: UserConfig): UserConfig =>
|
|
|
7500
7576
|
${EXPORT_KEYWORD} const appCore = (config?: UserConfig): UserConfig =>
|
|
7501
7577
|
mergeConfig(
|
|
7502
7578
|
{
|
|
7503
|
-
resolve,
|
|
7504
|
-
css: ENVIRONMENT_CSS,
|
|
7579
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7505
7580
|
publicDir: false,
|
|
7506
7581
|
plugins: [environmentBoundary('app/core')],
|
|
7507
7582
|
test: {
|
|
@@ -7578,8 +7653,7 @@ ${EXPORT_KEYWORD} function appBrowser(...config: readonly never[]): UserConfig {
|
|
|
7578
7653
|
${EXPORT_KEYWORD} const appServer = (config?: UserConfig): UserConfig =>
|
|
7579
7654
|
mergeConfig(
|
|
7580
7655
|
{
|
|
7581
|
-
resolve,
|
|
7582
|
-
css: ENVIRONMENT_CSS,
|
|
7656
|
+
resolve,${machinery.browser ? "\n css: ENVIRONMENT_CSS," : ""}
|
|
7583
7657
|
publicDir: false,
|
|
7584
7658
|
plugins: [outputBoundary('dist/app/server'), environmentBoundary('app/server')],
|
|
7585
7659
|
build: {
|
|
@@ -7711,6 +7785,7 @@ function coreTsconfig() {
|
|
|
7711
7785
|
* `configs/src/vite.core.config.ts` — inlines its own `build.lib` /
|
|
7712
7786
|
* `rolldownOptions` (core's `srcCore` root export carries no build.lib).
|
|
7713
7787
|
*
|
|
7788
|
+
* @param browser - Whether a declared browser environment enables the shared CSS pipeline.
|
|
7714
7789
|
* @returns The core environment `vite.config.ts` file content, newline-terminated.
|
|
7715
7790
|
*
|
|
7716
7791
|
* @example
|
|
@@ -7718,12 +7793,11 @@ function coreTsconfig() {
|
|
|
7718
7793
|
* coreViteConfig().includes('srcCore(') // true
|
|
7719
7794
|
* ```
|
|
7720
7795
|
*/
|
|
7721
|
-
function coreViteConfig() {
|
|
7796
|
+
function coreViteConfig(browser = true) {
|
|
7722
7797
|
return `import { defineConfig } from 'vite'
|
|
7723
7798
|
import dts from 'vite-plugin-dts'
|
|
7724
7799
|
import {
|
|
7725
|
-
ENVIRONMENT_CSS,
|
|
7726
|
-
environmentBoundary,
|
|
7800
|
+
${browser ? " ENVIRONMENT_CSS,\n" : ""} environmentBoundary,
|
|
7727
7801
|
outputBoundary,
|
|
7728
7802
|
srcCore,
|
|
7729
7803
|
resolveWorkspacePath,
|
|
@@ -7731,8 +7805,7 @@ import {
|
|
|
7731
7805
|
|
|
7732
7806
|
export default defineConfig(
|
|
7733
7807
|
srcCore({
|
|
7734
|
-
css: ENVIRONMENT_CSS,
|
|
7735
|
-
publicDir: false,
|
|
7808
|
+
${browser ? " css: ENVIRONMENT_CSS,\n" : ""} publicDir: false,
|
|
7736
7809
|
plugins: [
|
|
7737
7810
|
outputBoundary('dist/src/core'),
|
|
7738
7811
|
environmentBoundary('src/core'),
|
|
@@ -7954,6 +8027,7 @@ ${spec.engine || spec.src.includes("browser") || spec.app.includes("browser") ?
|
|
|
7954
8027
|
* ```
|
|
7955
8028
|
*/
|
|
7956
8029
|
function configArtifacts(spec) {
|
|
8030
|
+
const machinery = viteMachinery(spec.src, spec.app, spec.engine);
|
|
7957
8031
|
const artifacts = [{
|
|
7958
8032
|
path: "tsconfig.json",
|
|
7959
8033
|
group: "configs",
|
|
@@ -7969,7 +8043,7 @@ function configArtifacts(spec) {
|
|
|
7969
8043
|
const row = SRC_MATRIX[environment];
|
|
7970
8044
|
for (const path of row.configs) {
|
|
7971
8045
|
const isTsconfig = path.endsWith(".json");
|
|
7972
|
-
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig() : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
|
|
8046
|
+
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig(machinery.browser) : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
|
|
7973
8047
|
artifacts.push({
|
|
7974
8048
|
path,
|
|
7975
8049
|
group: "configs",
|
|
@@ -9278,5 +9352,6 @@ exports.validateBlueprint = validateBlueprint;
|
|
|
9278
9352
|
exports.validateDependencyArray = validateDependencyArray;
|
|
9279
9353
|
exports.validatePlan = validatePlan;
|
|
9280
9354
|
exports.viteHeader = viteHeader;
|
|
9355
|
+
exports.viteMachinery = viteMachinery;
|
|
9281
9356
|
|
|
9282
9357
|
//# sourceMappingURL=index.cjs.map
|