@orkestrel/scaffold 0.0.22 → 0.0.23
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/agents/orkestrel.md +5 -5
- package/dist/host/guides/src/scaffold.md +38 -2
- package/dist/host/tests/setupPolicy.ts +127 -0
- package/dist/src/core/index.cjs +76 -9
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +14 -3
- package/dist/src/core/index.d.ts +14 -3
- package/dist/src/core/index.js +76 -9
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.d.cts +11 -11
- package/dist/src/server/index.d.ts +11 -11
- package/package.json +1 -1
|
@@ -2432,7 +2432,7 @@ export declare function coreViteConfig(): string;
|
|
|
2432
2432
|
export declare function rootViteConfig(src: readonly Environment[], facts?: ViteFacts): string;
|
|
2433
2433
|
|
|
2434
2434
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
2435
|
-
export declare const SCAFFOLD_RANGE = "^0.0.
|
|
2435
|
+
export declare const SCAFFOLD_RANGE = "^0.0.23";
|
|
2436
2436
|
|
|
2437
2437
|
/**
|
|
2438
2438
|
* Carries a `ScaffoldErrorCode` + optional `context` (AGENTS §12).
|
|
@@ -2665,15 +2665,26 @@ export declare function coreViteConfig(): string;
|
|
|
2665
2665
|
* `build.lib` / externals live in the root `srcBrowser` / `srcServer` export
|
|
2666
2666
|
* instead (per the live exemplars).
|
|
2667
2667
|
*
|
|
2668
|
+
* @remarks
|
|
2669
|
+
* `bundleTypes` rolls the face up through API Extractor, which leaves every
|
|
2670
|
+
* `src/core` re-export behind a relative `../core/index.ts` specifier — a path no
|
|
2671
|
+
* published tarball carries. A workspace that also declares `core` therefore emits
|
|
2672
|
+
* a `beforeWriteFile` rewrite turning that specifier into `@orkestrel/<name>`, the
|
|
2673
|
+
* package's own published root export. The rewrite is narrowed to the FINAL face
|
|
2674
|
+
* roll-up: applying it to the intermediate declarations makes API Extractor analyse
|
|
2675
|
+
* `src/core`'s own source and abort. A workspace with no `core` emits no rewrite,
|
|
2676
|
+
* because it has no cross-environment specifier to externalize.
|
|
2677
|
+
*
|
|
2668
2678
|
* @param environment - The non-`core` environment to derive the `vite.config.ts` for.
|
|
2679
|
+
* @param spec - The blueprint slice naming the package and its declared source environments.
|
|
2669
2680
|
* @returns The environment `vite.config.ts` file content, newline-terminated.
|
|
2670
2681
|
*
|
|
2671
2682
|
* @example
|
|
2672
2683
|
* ```ts
|
|
2673
|
-
* srcViteConfig('browser').includes('srcBrowser')
|
|
2684
|
+
* srcViteConfig('browser', { name: 'router', src: ['core', 'browser'] }).includes('srcBrowser')
|
|
2674
2685
|
* ```
|
|
2675
2686
|
*/
|
|
2676
|
-
export declare function srcViteConfig(environment: 'browser' | 'server'): string;
|
|
2687
|
+
export declare function srcViteConfig(environment: 'browser' | 'server', spec: Pick<Blueprint, 'name' | 'src'>): string;
|
|
2677
2688
|
|
|
2678
2689
|
/**
|
|
2679
2690
|
* Serialize a value to a canonical, key-order-INDEPENDENT JSON-like string.
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -2432,7 +2432,7 @@ export declare function coreViteConfig(): string;
|
|
|
2432
2432
|
export declare function rootViteConfig(src: readonly Environment[], facts?: ViteFacts): string;
|
|
2433
2433
|
|
|
2434
2434
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
2435
|
-
export declare const SCAFFOLD_RANGE = "^0.0.
|
|
2435
|
+
export declare const SCAFFOLD_RANGE = "^0.0.23";
|
|
2436
2436
|
|
|
2437
2437
|
/**
|
|
2438
2438
|
* Carries a `ScaffoldErrorCode` + optional `context` (AGENTS §12).
|
|
@@ -2665,15 +2665,26 @@ export declare function coreViteConfig(): string;
|
|
|
2665
2665
|
* `build.lib` / externals live in the root `srcBrowser` / `srcServer` export
|
|
2666
2666
|
* instead (per the live exemplars).
|
|
2667
2667
|
*
|
|
2668
|
+
* @remarks
|
|
2669
|
+
* `bundleTypes` rolls the face up through API Extractor, which leaves every
|
|
2670
|
+
* `src/core` re-export behind a relative `../core/index.ts` specifier — a path no
|
|
2671
|
+
* published tarball carries. A workspace that also declares `core` therefore emits
|
|
2672
|
+
* a `beforeWriteFile` rewrite turning that specifier into `@orkestrel/<name>`, the
|
|
2673
|
+
* package's own published root export. The rewrite is narrowed to the FINAL face
|
|
2674
|
+
* roll-up: applying it to the intermediate declarations makes API Extractor analyse
|
|
2675
|
+
* `src/core`'s own source and abort. A workspace with no `core` emits no rewrite,
|
|
2676
|
+
* because it has no cross-environment specifier to externalize.
|
|
2677
|
+
*
|
|
2668
2678
|
* @param environment - The non-`core` environment to derive the `vite.config.ts` for.
|
|
2679
|
+
* @param spec - The blueprint slice naming the package and its declared source environments.
|
|
2669
2680
|
* @returns The environment `vite.config.ts` file content, newline-terminated.
|
|
2670
2681
|
*
|
|
2671
2682
|
* @example
|
|
2672
2683
|
* ```ts
|
|
2673
|
-
* srcViteConfig('browser').includes('srcBrowser')
|
|
2684
|
+
* srcViteConfig('browser', { name: 'router', src: ['core', 'browser'] }).includes('srcBrowser')
|
|
2674
2685
|
* ```
|
|
2675
2686
|
*/
|
|
2676
|
-
export declare function srcViteConfig(environment: 'browser' | 'server'): string;
|
|
2687
|
+
export declare function srcViteConfig(environment: 'browser' | 'server', spec: Pick<Blueprint, 'name' | 'src'>): string;
|
|
2677
2688
|
|
|
2678
2689
|
/**
|
|
2679
2690
|
* Serialize a value to a canonical, key-order-INDEPENDENT JSON-like string.
|
package/dist/src/core/index.js
CHANGED
|
@@ -274,7 +274,7 @@ var DEFAULT_VERSION = "0.0.1";
|
|
|
274
274
|
/** The `engines.node` range the `blueprint` builder fills. */
|
|
275
275
|
var DEFAULT_ENGINES = `>=${MINIMUM_NODE_VERSION}`;
|
|
276
276
|
/** The devDependency range generated packages pin `@orkestrel/scaffold` at. */
|
|
277
|
-
var SCAFFOLD_RANGE = "^0.0.
|
|
277
|
+
var SCAFFOLD_RANGE = "^0.0.23";
|
|
278
278
|
/** Tooling versions shared by scaffold and every generated workspace. */
|
|
279
279
|
var BASE_DEV_DEPENDENCIES = Object.freeze({
|
|
280
280
|
"@microsoft/api-extractor": "^7.58.12",
|
|
@@ -4699,8 +4699,19 @@ exit 1
|
|
|
4699
4699
|
content: `import { globSync } from 'node:fs'
|
|
4700
4700
|
import { describe, expect, it } from 'vitest'
|
|
4701
4701
|
import { isBrowserVuePath } from './setup.js'
|
|
4702
|
-
import {
|
|
4703
|
-
|
|
4702
|
+
import {
|
|
4703
|
+
derivePolicyTokens,
|
|
4704
|
+
inspectCodingLaw,
|
|
4705
|
+
inspectCodingWorkspace,
|
|
4706
|
+
inspectPolicyPurity,
|
|
4707
|
+
inspectPolicyWorkspace,
|
|
4708
|
+
isFunctionDomainPath,
|
|
4709
|
+
POLICY_SOURCE_ENVIRONMENTS,
|
|
4710
|
+
readPackageName,
|
|
4711
|
+
} from './setupPolicy.js'{{vuePolicyImport}}
|
|
4712
|
+
|
|
4713
|
+
${CONST_KEYWORD} POLICY_PLANTED_PATH = 'tests/setupPolicy.ts'
|
|
4714
|
+
${CONST_KEYWORD} POLICY_TOKENS = derivePolicyTokens(readPackageName(process.cwd()))
|
|
4704
4715
|
${CONST_KEYWORD} FUNCTION_MODULE_PATH = 'app/browser/composables/useTheme.ts'
|
|
4705
4716
|
${CONST_KEYWORD} FUNCTION_MODULE_VIOLATION =
|
|
4706
4717
|
FUNCTION_MODULE_PATH + ' declarations do not form one matching exported function implementation'
|
|
@@ -4839,6 +4850,30 @@ describe('repository coding law', () => {
|
|
|
4839
4850
|
expect(inspectCodingLaw(path, content)).toEqual([])
|
|
4840
4851
|
})
|
|
4841
4852
|
})
|
|
4853
|
+
|
|
4854
|
+
describe('fleet policy purity', () => {
|
|
4855
|
+
it('keeps fleet policy files free of this package architecture', () => {
|
|
4856
|
+
expect(inspectPolicyWorkspace(process.cwd())).toEqual([])
|
|
4857
|
+
})
|
|
4858
|
+
|
|
4859
|
+
it('reports planted package architecture, so a clean sweep is evidence', () => {
|
|
4860
|
+
const token = POLICY_TOKENS[0]
|
|
4861
|
+
const environment = POLICY_SOURCE_ENVIRONMENTS[0]
|
|
4862
|
+
if (token === undefined || environment === undefined) {
|
|
4863
|
+
throw new Error('The package manifest derived no policy token to plant')
|
|
4864
|
+
}
|
|
4865
|
+
const planted = [
|
|
4866
|
+
'export const ' + token + '_PATH = []',
|
|
4867
|
+
"export const path = 'src/" + environment + "/index.ts'",
|
|
4868
|
+
'',
|
|
4869
|
+
].join('\\n')
|
|
4870
|
+
|
|
4871
|
+
expect(inspectPolicyPurity(POLICY_PLANTED_PATH, planted, POLICY_TOKENS)).toEqual([
|
|
4872
|
+
POLICY_PLANTED_PATH + ':1:14 forbids the ' + token + ' package token',
|
|
4873
|
+
POLICY_PLANTED_PATH + ':2:21 forbids a source-environment path literal',
|
|
4874
|
+
])
|
|
4875
|
+
})
|
|
4876
|
+
})
|
|
4842
4877
|
`
|
|
4843
4878
|
}),
|
|
4844
4879
|
setupServer: Object.freeze({
|
|
@@ -9287,28 +9322,60 @@ function srcTsconfig(environment) {
|
|
|
9287
9322
|
* `build.lib` / externals live in the root `srcBrowser` / `srcServer` export
|
|
9288
9323
|
* instead (per the live exemplars).
|
|
9289
9324
|
*
|
|
9325
|
+
* @remarks
|
|
9326
|
+
* `bundleTypes` rolls the face up through API Extractor, which leaves every
|
|
9327
|
+
* `src/core` re-export behind a relative `../core/index.ts` specifier — a path no
|
|
9328
|
+
* published tarball carries. A workspace that also declares `core` therefore emits
|
|
9329
|
+
* a `beforeWriteFile` rewrite turning that specifier into `@orkestrel/<name>`, the
|
|
9330
|
+
* package's own published root export. The rewrite is narrowed to the FINAL face
|
|
9331
|
+
* roll-up: applying it to the intermediate declarations makes API Extractor analyse
|
|
9332
|
+
* `src/core`'s own source and abort. A workspace with no `core` emits no rewrite,
|
|
9333
|
+
* because it has no cross-environment specifier to externalize.
|
|
9334
|
+
*
|
|
9290
9335
|
* @param environment - The non-`core` environment to derive the `vite.config.ts` for.
|
|
9336
|
+
* @param spec - The blueprint slice naming the package and its declared source environments.
|
|
9291
9337
|
* @returns The environment `vite.config.ts` file content, newline-terminated.
|
|
9292
9338
|
*
|
|
9293
9339
|
* @example
|
|
9294
9340
|
* ```ts
|
|
9295
|
-
* srcViteConfig('browser').includes('srcBrowser')
|
|
9341
|
+
* srcViteConfig('browser', { name: 'router', src: ['core', 'browser'] }).includes('srcBrowser')
|
|
9296
9342
|
* ```
|
|
9297
9343
|
*/
|
|
9298
|
-
function srcViteConfig(environment) {
|
|
9344
|
+
function srcViteConfig(environment, spec) {
|
|
9299
9345
|
const anchor = environment === "browser" ? "srcBrowser" : "srcServer";
|
|
9346
|
+
const specifier = `'@orkestrel/${spec.name}'`;
|
|
9347
|
+
const pattern = "/(?:\\.\\.\\/)+core\\/index\\.ts/g";
|
|
9348
|
+
const inlineCall = `\t\t\t\t\t\t? content.replaceAll(${pattern}, ${specifier})`;
|
|
9349
|
+
const call = fitsPrintWidth(inlineCall) ? [inlineCall] : [
|
|
9350
|
+
" ? content.replaceAll(",
|
|
9351
|
+
`\t\t\t\t\t\t\t\t${pattern},`,
|
|
9352
|
+
`\t\t\t\t\t\t\t\t${specifier},`,
|
|
9353
|
+
" )"
|
|
9354
|
+
];
|
|
9355
|
+
const face = `/[\\\\/]dist[\\\\/]src[\\\\/]${environment}[\\\\/]index\\.d\\.ts$/`;
|
|
9356
|
+
const external = spec.src.includes("core");
|
|
9357
|
+
const rewrite = external ? `\n${[
|
|
9358
|
+
" beforeWriteFile: (path, content) => ({",
|
|
9359
|
+
`\t\t\t\t\tcontent: ${face}.test(path)`,
|
|
9360
|
+
...call,
|
|
9361
|
+
" : content,",
|
|
9362
|
+
" }),"
|
|
9363
|
+
].join("\n")}` : "";
|
|
9300
9364
|
return `import { defineConfig } from 'vite'
|
|
9301
9365
|
import dts from 'vite-plugin-dts'
|
|
9302
9366
|
import { ${anchor}, resolveWorkspacePath } from '../../vite.config.ts'
|
|
9303
9367
|
|
|
9304
|
-
|
|
9305
|
-
//
|
|
9368
|
+
${external ? `// vite-plugin-dts rolls this face into one declaration, and the roll-up reaches
|
|
9369
|
+
// src/core through a relative source path the tarball does not carry. The rewrite
|
|
9370
|
+
// below externalizes core through the package's own published root export, on the
|
|
9371
|
+
// final roll-up only.` : `// vite-plugin-dts rolls this face into one declaration. This workspace declares no
|
|
9372
|
+
// src/core, so the roll-up has no cross-environment specifier to externalize.`}
|
|
9306
9373
|
export default defineConfig(
|
|
9307
9374
|
${anchor}({
|
|
9308
9375
|
plugins: [
|
|
9309
9376
|
dts({
|
|
9310
9377
|
tsconfigPath: resolveWorkspacePath('configs/src/tsconfig.${environment}.json'),
|
|
9311
|
-
bundleTypes: true
|
|
9378
|
+
bundleTypes: true,${rewrite}
|
|
9312
9379
|
}),
|
|
9313
9380
|
],
|
|
9314
9381
|
}),
|
|
@@ -9524,7 +9591,7 @@ function configArtifacts(spec) {
|
|
|
9524
9591
|
const row = SRC_MATRIX[environment];
|
|
9525
9592
|
for (const path of row.configs) {
|
|
9526
9593
|
const isTsconfig = path.endsWith(".json");
|
|
9527
|
-
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig() : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment);
|
|
9594
|
+
const content = environment === "core" ? isTsconfig ? coreTsconfig() : coreViteConfig() : isTsconfig ? srcTsconfig(environment) : srcViteConfig(environment, spec);
|
|
9528
9595
|
artifacts.push({
|
|
9529
9596
|
path,
|
|
9530
9597
|
group: "configs",
|