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