@orkestrel/scaffold 0.0.134 → 0.0.136
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/agents/skills/orkestrel-parallel/scripts/lane.js +777 -83
- package/dist/agents/skills/orkestrel-publish/scripts/wave.js +327 -21
- package/dist/bin/main.js +254 -36
- package/dist/bin/main.js.map +1 -1
- package/dist/host/AGENTS.md +2 -2
- package/dist/host/agents/orchestration.md +2 -2
- package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +1 -1
- package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +983 -123
- package/dist/host/agents/skills/orkestrel-publish/references/release.md +1 -0
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +22 -5
- package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +403 -32
- package/dist/host/claude/agents/orkestrel.md +17 -17
- package/dist/host/claude/agents/reviewer.md +1 -1
- package/dist/host/claude/rules/architecture.md +1 -1
- package/dist/host/claude/rules/documentation.md +1 -1
- package/dist/host/claude/rules/patterns.md +4 -2
- package/dist/host/claude/rules/workspace.md +73 -67
- package/dist/host/configs/helpers.ts +109 -73
- package/dist/host/dotfiles/oxlintrc.json +1 -57
- package/dist/host/guides/agent.md +989 -395
- package/dist/host/guides/contract.md +198 -163
- package/dist/host/guides/database.md +978 -503
- package/dist/host/guides/indexeddb.md +80 -66
- package/dist/host/guides/middleware.md +5 -5
- package/dist/host/guides/ollama.md +41 -42
- package/dist/host/guides/relation.md +56 -32
- package/dist/host/guides/scaffold.md +185 -107
- package/dist/host/guides/sqlite.md +44 -23
- package/dist/host/guides/study.md +12 -12
- package/dist/host/guides/test.md +163 -47
- package/dist/host/guides/toolbox.md +127 -81
- package/dist/host/guides/workspace.md +21 -14
- package/dist/host/manifest.json +30 -30
- package/dist/host/scripts/browsers.sh +0 -0
- package/dist/host/scripts/codex.sh +0 -0
- package/dist/host/scripts/cursor.sh +0 -0
- package/dist/host/scripts/deps.sh +0 -0
- package/dist/host/scripts/npm.sh +0 -0
- package/dist/host/scripts/ollama.sh +0 -0
- package/dist/host/tests/config.test.ts +237 -115
- package/dist/src/core/index.cjs +591 -218
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +248 -29
- package/dist/src/core/index.d.ts +248 -29
- package/dist/src/core/index.js +581 -216
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +18 -8
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +4 -3
- package/dist/src/server/index.d.ts +4 -3
- package/dist/src/server/index.js +19 -9
- package/dist/src/server/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
cpSync,
|
|
12
12
|
existsSync,
|
|
13
13
|
globSync,
|
|
14
|
-
lstatSync,
|
|
15
14
|
mkdirSync,
|
|
16
15
|
openSync,
|
|
17
16
|
readdirSync,
|
|
@@ -126,6 +125,7 @@ import {
|
|
|
126
125
|
POLICY_VUE_DOMAIN_CASES,
|
|
127
126
|
} from './setupPolicy.js'
|
|
128
127
|
import { describe, expect, it } from 'vitest'
|
|
128
|
+
import { defaultExclude } from 'vitest/config'
|
|
129
129
|
|
|
130
130
|
describe('selected faces', () => {
|
|
131
131
|
it('collects each selected sheet proof from the effective project root and rejects a wrong root', async () => {
|
|
@@ -624,6 +624,7 @@ describe('selected faces', () => {
|
|
|
624
624
|
'srcVue',
|
|
625
625
|
'appVue',
|
|
626
626
|
'setupBrowser',
|
|
627
|
+
'benchBrowser',
|
|
627
628
|
'sheetProject',
|
|
628
629
|
'integration',
|
|
629
630
|
]) {
|
|
@@ -725,6 +726,69 @@ describe('root configuration', () => {
|
|
|
725
726
|
}
|
|
726
727
|
})
|
|
727
728
|
|
|
729
|
+
it('runs the browser benches in a Chromium bench project and keeps them out of the Node workbench', () => {
|
|
730
|
+
const factories = readConfigRecord(rootConfiguration)
|
|
731
|
+
const manifest = readConfigRecord(
|
|
732
|
+
JSON.parse(readFileSync(resolve(POLICY_ROOT, 'package.json'), 'utf8')),
|
|
733
|
+
)
|
|
734
|
+
// Every face that runs in Chromium: each sheet, the themes target without a base sheet, each
|
|
735
|
+
// browser environment, and each framework face.
|
|
736
|
+
const sheets = collectSheets(POLICY_ROOT)
|
|
737
|
+
const browserBenches = [
|
|
738
|
+
...sheets.map((face) => `src/${face}`),
|
|
739
|
+
...(!sheets.includes('styles') &&
|
|
740
|
+
existsSync(resolve(POLICY_ROOT, 'src/styles/themes/index.scss'))
|
|
741
|
+
? ['src/styles/themes']
|
|
742
|
+
: []),
|
|
743
|
+
...['src/browser', 'app/browser'].filter((path) => existsSync(resolve(POLICY_ROOT, path))),
|
|
744
|
+
...collectFrameworks(POLICY_ROOT),
|
|
745
|
+
]
|
|
746
|
+
.map((path) => `tests/${path}/**/*.bench.ts`)
|
|
747
|
+
.sort()
|
|
748
|
+
const browser = browserBenches.length > 0
|
|
749
|
+
const projects = configuration.test?.projects
|
|
750
|
+
if (!Array.isArray(projects)) throw new Error('The root configuration carries no projects')
|
|
751
|
+
expect(
|
|
752
|
+
projects.some((entry) => typeof entry === 'function' && entry.name === 'benchBrowser'),
|
|
753
|
+
).toBe(browser)
|
|
754
|
+
expect(typeof factories.benchBrowser === 'function').toBe(browser)
|
|
755
|
+
|
|
756
|
+
const probe = factories.probe
|
|
757
|
+
if (typeof probe !== 'function') throw new Error('The root configuration exports no probe')
|
|
758
|
+
const workbench = readConfigRecord(
|
|
759
|
+
readConfigRecord(readConfigRecord(Reflect.apply(probe, undefined, [])).test).benchmark,
|
|
760
|
+
)
|
|
761
|
+
expect(workbench.include).toStrictEqual(['tmp/probes/**/*.bench.ts', 'tests/**/*.bench.ts'])
|
|
762
|
+
// The exclusion keeps Vitest's default exclude, which a set `exclude` otherwise replaces, and
|
|
763
|
+
// a workspace with no browser-hosted face sets none.
|
|
764
|
+
expect(
|
|
765
|
+
Array.isArray(workbench.exclude) ? [...workbench.exclude].sort() : workbench.exclude,
|
|
766
|
+
).toStrictEqual(browser ? [...defaultExclude, ...browserBenches].sort() : undefined)
|
|
767
|
+
|
|
768
|
+
// The script names each bench project it runs; a reporter flag beside them stays the package's.
|
|
769
|
+
const script = readConfigScript(readConfigRecord(manifest.scripts), 'test:bench')
|
|
770
|
+
expect(script.startsWith('vitest bench ')).toBe(true)
|
|
771
|
+
expect(
|
|
772
|
+
[...script.matchAll(/--project(?:=|\s+)("[^"]*"|\S+)/gu)].map(([, name]) =>
|
|
773
|
+
(name ?? '').replace(/^"(.*)"$/u, '$1'),
|
|
774
|
+
),
|
|
775
|
+
).toStrictEqual(['probe (bench)', ...(browser ? ['bench:browser'] : [])])
|
|
776
|
+
|
|
777
|
+
const factory = factories.benchBrowser
|
|
778
|
+
if (typeof factory !== 'function') return
|
|
779
|
+
const test = readConfigRecord(readConfigRecord(Reflect.apply(factory, undefined, [])).test)
|
|
780
|
+
expect(test.name).toStrictEqual({ label: 'bench:browser', color: 'black' })
|
|
781
|
+
expect(test.include).toStrictEqual([])
|
|
782
|
+
expect(test.setupFiles).toStrictEqual(['./tests/setup.ts', './tests/setupBrowser.ts'])
|
|
783
|
+
expect(test.globalSetup).toBeUndefined()
|
|
784
|
+
const included = readConfigRecord(test.benchmark).include
|
|
785
|
+
expect(Array.isArray(included) ? [...included].sort() : included).toStrictEqual(browserBenches)
|
|
786
|
+
expect(readConfigRecord(test.browser).enabled).toBe(true)
|
|
787
|
+
expect(readConfigRecord(test.browser).instances).toStrictEqual([
|
|
788
|
+
{ browser: 'chromium', headless: true, name: 'bench:browser (chromium)' },
|
|
789
|
+
])
|
|
790
|
+
})
|
|
791
|
+
|
|
728
792
|
it('registers every workspace project with its fixed include and setup files', () => {
|
|
729
793
|
const browserProofs = ['tests/setupBrowser.test.ts', 'tests/setupStyles.test.ts']
|
|
730
794
|
const setupProofs = globSync('tests/setup*.test.ts', { cwd: POLICY_ROOT })
|
|
@@ -753,12 +817,6 @@ describe('root configuration', () => {
|
|
|
753
817
|
'tests/src/bin/**/*.test.ts',
|
|
754
818
|
['./tests/setup.ts', './tests/setupServer.ts'],
|
|
755
819
|
],
|
|
756
|
-
[
|
|
757
|
-
'src:reporter',
|
|
758
|
-
'src/reporter/main.ts',
|
|
759
|
-
'tests/src/reporter/**/*.test.ts',
|
|
760
|
-
['./tests/setup.ts', './tests/setupServer.ts'],
|
|
761
|
-
],
|
|
762
820
|
['app:core', 'app/core', 'tests/app/core/**/*.test.ts', ['./tests/setup.ts']],
|
|
763
821
|
[
|
|
764
822
|
'app:browser',
|
|
@@ -1143,9 +1201,6 @@ describe('root configuration', () => {
|
|
|
1143
1201
|
...(existsSync(resolve(POLICY_ROOT, 'src/bin'))
|
|
1144
1202
|
? ['configs/src/tsconfig.bin.json', 'configs/src/vite.bin.config.ts']
|
|
1145
1203
|
: []),
|
|
1146
|
-
...(existsSync(resolve(POLICY_ROOT, 'src/reporter/main.ts'))
|
|
1147
|
-
? ['configs/src/tsconfig.reporter.json', 'configs/src/vite.reporter.config.ts']
|
|
1148
|
-
: []),
|
|
1149
1204
|
...(existsSync(resolve(POLICY_ROOT, 'configs/app/vite.showcase.config.ts'))
|
|
1150
1205
|
? ['configs/app/vite.showcase.config.ts']
|
|
1151
1206
|
: []),
|
|
@@ -1210,7 +1265,7 @@ describe('root configuration', () => {
|
|
|
1210
1265
|
for (const { wrapper, directory } of targets) {
|
|
1211
1266
|
expect(controlled).toContain(wrapper)
|
|
1212
1267
|
const viteMatch =
|
|
1213
|
-
/^configs\/(src|app)\/vite\.(core|browser|server|bin|
|
|
1268
|
+
/^configs\/(src|app)\/vite\.(core|browser|server|bin|showcase|journey)\.config\.ts$/u.exec(
|
|
1214
1269
|
wrapper,
|
|
1215
1270
|
)
|
|
1216
1271
|
if (viteMatch !== null) {
|
|
@@ -1270,7 +1325,7 @@ describe('root configuration', () => {
|
|
|
1270
1325
|
const output = loaded.config.build?.outDir
|
|
1271
1326
|
if (output === undefined) throw new Error(`${wrapper} carries no output`)
|
|
1272
1327
|
const expected =
|
|
1273
|
-
environment === 'bin'
|
|
1328
|
+
environment === 'bin'
|
|
1274
1329
|
? `dist/${environment}`
|
|
1275
1330
|
: environment === 'showcase'
|
|
1276
1331
|
? 'showcase'
|
|
@@ -1283,9 +1338,7 @@ describe('root configuration', () => {
|
|
|
1283
1338
|
}
|
|
1284
1339
|
|
|
1285
1340
|
const tsconfigMatch =
|
|
1286
|
-
/^configs\/(src|app)\/tsconfig\.(core|browser|server|bin|
|
|
1287
|
-
wrapper,
|
|
1288
|
-
)
|
|
1341
|
+
/^configs\/(src|app)\/tsconfig\.(core|browser|server|bin|vue)\.json$/u.exec(wrapper)
|
|
1289
1342
|
if (tsconfigMatch === null) {
|
|
1290
1343
|
throw new Error(`${wrapper} is not a required target wrapper`)
|
|
1291
1344
|
}
|
|
@@ -1560,33 +1613,42 @@ describe('root configuration', () => {
|
|
|
1560
1613
|
}
|
|
1561
1614
|
})
|
|
1562
1615
|
|
|
1563
|
-
// A workspace
|
|
1564
|
-
//
|
|
1565
|
-
//
|
|
1566
|
-
//
|
|
1567
|
-
//
|
|
1568
|
-
//
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1573
|
-
|
|
1616
|
+
// A workspace publishes each `src/bin` module other than `main`: a direct lowercase `.ts` child
|
|
1617
|
+
// that no centralized file names. The case copies the workspace's build inputs into a scratch
|
|
1618
|
+
// directory under `tmp/`, so the real `dist/` stays as the last build left it, builds the
|
|
1619
|
+
// library environments and the bin there through the workspace's own wrappers, and reads what
|
|
1620
|
+
// each module ships. A child Node process loads each built module, as a host tool does, and
|
|
1621
|
+
// its default must be a value an environment it imports exports. A workspace with no such
|
|
1622
|
+
// module builds nothing here.
|
|
1623
|
+
it('builds each src/bin module to one ES module whose default an environment exports', async () => {
|
|
1624
|
+
const wrapper = 'configs/src/vite.bin.config.ts'
|
|
1625
|
+
const directory = resolve(POLICY_ROOT, 'src/bin')
|
|
1626
|
+
const modules = existsSync(directory)
|
|
1627
|
+
? readdirSync(directory)
|
|
1628
|
+
.filter(
|
|
1629
|
+
(file) => /^[a-z][a-z0-9]*\.ts$/u.test(file) && !CENTRAL_SOURCE_FILES.includes(file),
|
|
1630
|
+
)
|
|
1631
|
+
.map((file) => file.slice(0, -'.ts'.length))
|
|
1632
|
+
: []
|
|
1633
|
+
expect(existsSync(resolve(POLICY_ROOT, wrapper))).toBe(modules.length > 0)
|
|
1634
|
+
const published = modules.filter((name) => name !== 'main')
|
|
1635
|
+
if (published.length === 0) return
|
|
1574
1636
|
mkdirSync(resolve(POLICY_ROOT, 'tmp'), { recursive: true })
|
|
1575
1637
|
const scratch = createPolicyScratch({
|
|
1576
1638
|
parent: resolve(POLICY_ROOT, 'tmp'),
|
|
1577
|
-
prefix: 'config-
|
|
1639
|
+
prefix: 'config-bin-',
|
|
1578
1640
|
})
|
|
1579
1641
|
try {
|
|
1580
1642
|
for (const path of ['package.json', 'tsconfig.json', 'vite.config.ts', 'configs', 'src']) {
|
|
1581
1643
|
cpSync(resolve(POLICY_ROOT, path), join(scratch.path, path), { recursive: true })
|
|
1582
1644
|
}
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1645
|
+
const environments = ['core', 'server'].filter((environment) =>
|
|
1646
|
+
existsSync(resolve(POLICY_ROOT, 'src', environment)),
|
|
1647
|
+
)
|
|
1648
|
+
for (const config of [
|
|
1649
|
+
...environments.map((environment) => `configs/src/vite.${environment}.config.ts`),
|
|
1587
1650
|
wrapper,
|
|
1588
|
-
]
|
|
1589
|
-
for (const config of configs) {
|
|
1651
|
+
]) {
|
|
1590
1652
|
await build({
|
|
1591
1653
|
configFile: join(scratch.path, config),
|
|
1592
1654
|
root: scratch.path,
|
|
@@ -1594,56 +1656,80 @@ describe('root configuration', () => {
|
|
|
1594
1656
|
logLevel: 'silent',
|
|
1595
1657
|
})
|
|
1596
1658
|
}
|
|
1597
|
-
const output = join(scratch.path, 'dist/
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
// bundler and the extractor each choose their own quote, so the specifier reads either one.
|
|
1601
|
-
const built = /from ["']\.\.\/src\/server\/index\.js["']/u
|
|
1659
|
+
const output = join(scratch.path, 'dist/bin')
|
|
1660
|
+
// Rolldown strips a source shebang, so the executable carries the banner and no module does.
|
|
1661
|
+
const executable = join(output, 'main.js')
|
|
1602
1662
|
expect({
|
|
1603
1663
|
file: 'main.js',
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
:
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
)
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1664
|
+
shebang: existsSync(executable)
|
|
1665
|
+
? readFileSync(executable, 'utf8').startsWith('#!/usr/bin/env node\n')
|
|
1666
|
+
: undefined,
|
|
1667
|
+
}).toStrictEqual({ file: 'main.js', shebang: modules.includes('main') ? true : undefined })
|
|
1668
|
+
for (const name of published) {
|
|
1669
|
+
const source = readFileSync(join(directory, `${name}.ts`), 'utf8')
|
|
1670
|
+
const imported = [...source.matchAll(/from ["']@src\/([a-z][a-z0-9-]*)["']/gu)].flatMap(
|
|
1671
|
+
(match) => (match[1] === undefined ? [] : [match[1]]),
|
|
1672
|
+
)
|
|
1673
|
+
const code = readFileSync(join(output, `${name}.js`), 'utf8')
|
|
1674
|
+
// Each reading names its file, so a failure's diff states which output kept the alias. The
|
|
1675
|
+
// bundler and the extractor each choose their own quote, so a specifier is read without one.
|
|
1676
|
+
expect({
|
|
1677
|
+
file: `${name}.js`,
|
|
1678
|
+
alias: code.includes('@src/'),
|
|
1679
|
+
built: imported.every((environment) => code.includes(`../src/${environment}/index.js`)),
|
|
1680
|
+
shebang: code.startsWith('#!'),
|
|
1681
|
+
}).toStrictEqual({ file: `${name}.js`, alias: false, built: true, shebang: false })
|
|
1682
|
+
const typed = join(output, `${name}.d.ts`)
|
|
1683
|
+
const declaration = existsSync(typed) ? readFileSync(typed, 'utf8') : ''
|
|
1684
|
+
expect({
|
|
1685
|
+
file: `${name}.d.ts`,
|
|
1686
|
+
present: existsSync(typed),
|
|
1687
|
+
alias: declaration.includes('@src/'),
|
|
1688
|
+
built: imported.every((environment) =>
|
|
1689
|
+
declaration.includes(`../src/${environment}/index.js`),
|
|
1690
|
+
),
|
|
1691
|
+
exported: declaration.includes('export default'),
|
|
1692
|
+
}).toStrictEqual({
|
|
1693
|
+
file: `${name}.d.ts`,
|
|
1694
|
+
present: true,
|
|
1695
|
+
alias: false,
|
|
1696
|
+
built: true,
|
|
1697
|
+
exported: true,
|
|
1698
|
+
})
|
|
1699
|
+
// The distribution scan refuses a module map that names no `src/bin/` source.
|
|
1700
|
+
const map = join(output, `${name}.js.map`)
|
|
1701
|
+
const parsed: unknown = existsSync(map) ? JSON.parse(readFileSync(map, 'utf8')) : undefined
|
|
1702
|
+
const sources: unknown =
|
|
1703
|
+
typeof parsed === 'object' && parsed !== null
|
|
1704
|
+
? Object.getOwnPropertyDescriptor(parsed, 'sources')?.value
|
|
1705
|
+
: undefined
|
|
1706
|
+
const listed = Array.isArray(sources)
|
|
1707
|
+
? sources.flatMap((entry: unknown) =>
|
|
1708
|
+
typeof entry === 'string'
|
|
1709
|
+
? [relative(scratch.path, resolve(output, entry)).replaceAll('\\', '/')]
|
|
1710
|
+
: [],
|
|
1711
|
+
)
|
|
1712
|
+
: []
|
|
1713
|
+
expect({
|
|
1714
|
+
file: `${name}.js.map`,
|
|
1715
|
+
entry: listed.includes(`src/bin/${name}.ts`),
|
|
1716
|
+
}).toStrictEqual({ file: `${name}.js.map`, entry: true })
|
|
1717
|
+
const loaded = spawnSync(
|
|
1718
|
+
process.execPath,
|
|
1719
|
+
[
|
|
1720
|
+
'--input-type=module',
|
|
1721
|
+
'--eval',
|
|
1722
|
+
`const module = await import(${JSON.stringify(pathToFileURL(join(output, `${name}.js`)).href)})\nconst values = []\nfor (const href of ${JSON.stringify(imported.map((environment) => pathToFileURL(join(scratch.path, `dist/src/${environment}/index.js`)).href))}) values.push(...Object.values(await import(href)))\nprocess.stdout.write(JSON.stringify({ defined: module.default !== undefined, owned: values.includes(module.default) }))`,
|
|
1723
|
+
],
|
|
1724
|
+
{ encoding: 'utf8' },
|
|
1725
|
+
)
|
|
1726
|
+
expect({ file: `${name}.js`, status: loaded.status, stderr: loaded.stderr }).toStrictEqual({
|
|
1727
|
+
file: `${name}.js`,
|
|
1728
|
+
status: 0,
|
|
1729
|
+
stderr: '',
|
|
1730
|
+
})
|
|
1731
|
+
expect(JSON.parse(loaded.stdout)).toStrictEqual({ defined: true, owned: true })
|
|
1732
|
+
}
|
|
1647
1733
|
} finally {
|
|
1648
1734
|
scratch.destroy()
|
|
1649
1735
|
}
|
|
@@ -4425,7 +4511,6 @@ createSomething({
|
|
|
4425
4511
|
'src/server',
|
|
4426
4512
|
'app/server',
|
|
4427
4513
|
'src/bin',
|
|
4428
|
-
'src/reporter',
|
|
4429
4514
|
].flatMap((owner) => {
|
|
4430
4515
|
const sheet = ['src/bootstrap', 'src/tailwindcss', 'src/styles'].includes(owner)
|
|
4431
4516
|
const refused: ReadonlyArray<string | readonly [string, string]> = [
|
|
@@ -4472,13 +4557,11 @@ createSomething({
|
|
|
4472
4557
|
]),
|
|
4473
4558
|
]
|
|
4474
4559
|
: []),
|
|
4475
|
-
...(['src/browser', 'src/server', 'src/vue', 'src/bin'
|
|
4560
|
+
...(['src/browser', 'src/server', 'src/vue', 'src/bin'].includes(owner)
|
|
4476
4561
|
? ['../core/index.js', '../../src/core/index.js']
|
|
4477
4562
|
: []),
|
|
4478
4563
|
...(owner === 'src/vue' ? ['../browser/index.js', '../../src/browser/index.js'] : []),
|
|
4479
|
-
...(owner === 'src/bin'
|
|
4480
|
-
? ['../server/index.js', '../../src/server/index.js']
|
|
4481
|
-
: []),
|
|
4564
|
+
...(owner === 'src/bin' ? ['../server/index.js', '../../src/server/index.js'] : []),
|
|
4482
4565
|
]
|
|
4483
4566
|
const admitted = [
|
|
4484
4567
|
...(owner.endsWith('/vue')
|
|
@@ -4498,10 +4581,10 @@ createSomething({
|
|
|
4498
4581
|
: []),
|
|
4499
4582
|
]
|
|
4500
4583
|
: ['@src/core']),
|
|
4501
|
-
...(['src/browser', 'src/server', 'src/vue', 'src/bin'
|
|
4584
|
+
...(['src/browser', 'src/server', 'src/vue', 'src/bin'].includes(owner)
|
|
4502
4585
|
? []
|
|
4503
4586
|
: ['../core/index.js']),
|
|
4504
|
-
...(owner === 'src/bin'
|
|
4587
|
+
...(owner === 'src/bin' ? ['@src/server'] : []),
|
|
4505
4588
|
...(sheet
|
|
4506
4589
|
? [
|
|
4507
4590
|
...faces
|
|
@@ -4529,9 +4612,7 @@ createSomething({
|
|
|
4529
4612
|
[
|
|
4530
4613
|
...admitted,
|
|
4531
4614
|
'./index.js',
|
|
4532
|
-
...(owner.endsWith('/server') || owner === 'src/bin'
|
|
4533
|
-
? ['node:fs']
|
|
4534
|
-
: []),
|
|
4615
|
+
...(owner.endsWith('/server') || owner === 'src/bin' ? ['node:fs'] : []),
|
|
4535
4616
|
],
|
|
4536
4617
|
false,
|
|
4537
4618
|
],
|
|
@@ -4552,12 +4633,12 @@ createSomething({
|
|
|
4552
4633
|
}),
|
|
4553
4634
|
)
|
|
4554
4635
|
}),
|
|
4555
|
-
//
|
|
4636
|
+
// A bin module in the form a relative server import would take: only the
|
|
4556
4637
|
// `@src/server` alias reaches `output.paths`, so this import would bundle a server copy.
|
|
4557
4638
|
...(
|
|
4558
4639
|
[
|
|
4559
4640
|
[
|
|
4560
|
-
'src/reporter
|
|
4641
|
+
'src/bin/reporter.ts',
|
|
4561
4642
|
"import { ProgressReporter } from '../server/index.js'\n\nexport default ProgressReporter\ndebugger\n",
|
|
4562
4643
|
true,
|
|
4563
4644
|
],
|
|
@@ -4600,7 +4681,7 @@ createSomething({
|
|
|
4600
4681
|
!files.some(
|
|
4601
4682
|
(file: unknown) =>
|
|
4602
4683
|
typeof file === 'string' &&
|
|
4603
|
-
(file.startsWith('src/vue/') || file.startsWith('src/
|
|
4684
|
+
(file.startsWith('src/vue/') || file.startsWith('src/bin/')),
|
|
4604
4685
|
)
|
|
4605
4686
|
)
|
|
4606
4687
|
continue
|
|
@@ -4637,7 +4718,7 @@ createSomething({
|
|
|
4637
4718
|
expect(control).toContainEqual({ path: 'src/vue/refused3.ts', expected: true, actual: false })
|
|
4638
4719
|
expect(control).toContainEqual({ path: 'src/vue/refused8.ts', expected: true, actual: false })
|
|
4639
4720
|
expect(control).toContainEqual({
|
|
4640
|
-
path: 'src/reporter
|
|
4721
|
+
path: 'src/bin/reporter.ts',
|
|
4641
4722
|
expected: true,
|
|
4642
4723
|
actual: false,
|
|
4643
4724
|
})
|
|
@@ -4960,12 +5041,12 @@ createSomething({
|
|
|
4960
5041
|
'}',
|
|
4961
5042
|
].join('\n'),
|
|
4962
5043
|
)
|
|
4963
|
-
// The default-export exemption names `src/
|
|
4964
|
-
// statement is its arrival control, and a
|
|
5044
|
+
// The default-export exemption names the direct `src/bin` modules alone. The module's `debugger`
|
|
5045
|
+
// statement is its arrival control, and a server module and a `main.ts` in another
|
|
4965
5046
|
// folder carry the same default export and must each still draw the rule.
|
|
4966
5047
|
for (const path of [
|
|
4967
|
-
'src/reporter
|
|
4968
|
-
'src/reporter
|
|
5048
|
+
'src/bin/reporter.ts',
|
|
5049
|
+
'src/server/reporter.ts',
|
|
4969
5050
|
'src/violations/main.ts',
|
|
4970
5051
|
]) {
|
|
4971
5052
|
scratch.write(
|
|
@@ -5023,7 +5104,8 @@ createSomething({
|
|
|
5023
5104
|
'--format',
|
|
5024
5105
|
'json',
|
|
5025
5106
|
'src/violations',
|
|
5026
|
-
'src/
|
|
5107
|
+
'src/bin',
|
|
5108
|
+
'src/server',
|
|
5027
5109
|
'app',
|
|
5028
5110
|
'scripts',
|
|
5029
5111
|
'tests',
|
|
@@ -5137,16 +5219,24 @@ createSomething({
|
|
|
5137
5219
|
`eslint(no-debugger) ${normalizePolicyFilename(comparisonRoot, 'scripts/read.ts')}`,
|
|
5138
5220
|
)
|
|
5139
5221
|
expect(violationCodes).toContain(
|
|
5140
|
-
`eslint(no-debugger) ${normalizePolicyFilename(comparisonRoot, 'src/reporter
|
|
5222
|
+
`eslint(no-debugger) ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`,
|
|
5141
5223
|
)
|
|
5142
5224
|
expect(violationCodes).not.toContain(
|
|
5143
|
-
`import(no-default-export) ${normalizePolicyFilename(comparisonRoot, 'src/reporter
|
|
5225
|
+
`import(no-default-export) ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`,
|
|
5144
5226
|
)
|
|
5145
|
-
// The
|
|
5227
|
+
// The module's `@src/server` import is the form the `src/bin` boundary admits, and the
|
|
5228
|
+
// placement rules read a lowercase module beside `main.ts` as no misplaced file.
|
|
5146
5229
|
expect(violationCodes).not.toContain(
|
|
5147
|
-
`eslint(no-restricted-imports) ${normalizePolicyFilename(comparisonRoot, 'src/reporter
|
|
5230
|
+
`eslint(no-restricted-imports) ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`,
|
|
5148
5231
|
)
|
|
5149
|
-
|
|
5232
|
+
expect(
|
|
5233
|
+
violationCodes.filter(
|
|
5234
|
+
(code) =>
|
|
5235
|
+
code.startsWith('policy(') &&
|
|
5236
|
+
code.endsWith(` ${normalizePolicyFilename(comparisonRoot, 'src/bin/reporter.ts')}`),
|
|
5237
|
+
),
|
|
5238
|
+
).toStrictEqual([])
|
|
5239
|
+
for (const path of ['src/server/reporter.ts', 'src/violations/main.ts']) {
|
|
5150
5240
|
expect(violationCodes).toContain(
|
|
5151
5241
|
`import(no-default-export) ${normalizePolicyFilename(comparisonRoot, path)}`,
|
|
5152
5242
|
)
|
|
@@ -5359,7 +5449,7 @@ describe('configuration helpers', () => {
|
|
|
5359
5449
|
'readCompilerOutput',
|
|
5360
5450
|
'resolveCompiler',
|
|
5361
5451
|
'rewriteCoreSpecifier',
|
|
5362
|
-
'
|
|
5452
|
+
'rewriteSourceSpecifier',
|
|
5363
5453
|
'sourceFallback',
|
|
5364
5454
|
'workspacePath',
|
|
5365
5455
|
]
|
|
@@ -5466,8 +5556,12 @@ describe('configuration helpers', () => {
|
|
|
5466
5556
|
const expected = realpathSync.native(packageRoot)
|
|
5467
5557
|
const absent = resolve(packageRoot, 'src/absent.ts')
|
|
5468
5558
|
const beneathFile = resolve(source, 'child')
|
|
5469
|
-
expect(
|
|
5470
|
-
expect(
|
|
5559
|
+
expect(existsSync(absent)).toBe(false)
|
|
5560
|
+
expect(existsSync(beneathFile)).toBe(false)
|
|
5561
|
+
expect(configHelpers.isDirectoryPath(packageRoot)).toBe(true)
|
|
5562
|
+
expect(configHelpers.isDirectoryPath(source)).toBe(false)
|
|
5563
|
+
expect(configHelpers.isDirectoryPath(absent)).toBe(false)
|
|
5564
|
+
expect(configHelpers.isDirectoryPath(beneathFile)).toBe(false)
|
|
5471
5565
|
expect(configHelpers.packageRootOf('@sample/package', absent)).toBe(expected)
|
|
5472
5566
|
expect(configHelpers.packageRootForResolved(beneathFile)).toBe(expected)
|
|
5473
5567
|
} finally {
|
|
@@ -5550,7 +5644,7 @@ describe('configuration helpers', () => {
|
|
|
5550
5644
|
expect(fresh.building).toBe(false)
|
|
5551
5645
|
expect(fresh.output).toBe(configHelpers.WORKSPACE_ROOT)
|
|
5552
5646
|
expect(fresh.root).toBe(configHelpers.WORKSPACE_ROOT)
|
|
5553
|
-
expect(fresh.
|
|
5647
|
+
expect(fresh.entries).toStrictEqual({})
|
|
5554
5648
|
expect(new configHelpers.BuildState('C:/output').output).toBe('C:/output')
|
|
5555
5649
|
|
|
5556
5650
|
const entry = resolve(scratch.path, 'index.ts')
|
|
@@ -5565,13 +5659,34 @@ describe('configuration helpers', () => {
|
|
|
5565
5659
|
expect(buildState.building).toBe(true)
|
|
5566
5660
|
expect(buildState.output).toBe(resolve(scratch.path, 'out'))
|
|
5567
5661
|
expect(buildState.root).toBe(realpathSync.native(scratch.path))
|
|
5568
|
-
expect(buildState.
|
|
5662
|
+
expect(buildState.entries).toStrictEqual({ index: entry })
|
|
5663
|
+
// A named entry map keeps its names; a list names each member by its file's stem.
|
|
5664
|
+
const tool = resolve(scratch.path, 'reporter.ts')
|
|
5665
|
+
const named = new configHelpers.BuildState()
|
|
5666
|
+
named.resolve(
|
|
5667
|
+
await resolveConfig(
|
|
5668
|
+
{
|
|
5669
|
+
...inline,
|
|
5670
|
+
build: { outDir: 'out', lib: { entry: { main: entry, tool }, formats: ['es'] } },
|
|
5671
|
+
},
|
|
5672
|
+
'build',
|
|
5673
|
+
),
|
|
5674
|
+
)
|
|
5675
|
+
expect(named.entries).toStrictEqual({ main: entry, tool })
|
|
5676
|
+
const listed = new configHelpers.BuildState()
|
|
5677
|
+
listed.resolve(
|
|
5678
|
+
await resolveConfig(
|
|
5679
|
+
{ ...inline, build: { outDir: 'out', lib: { entry: [entry, tool], formats: ['es'] } } },
|
|
5680
|
+
'build',
|
|
5681
|
+
),
|
|
5682
|
+
)
|
|
5683
|
+
expect(listed.entries).toStrictEqual({ index: entry, reporter: tool })
|
|
5569
5684
|
|
|
5570
5685
|
// The control: a serve command is not a build, and a config with no library entry has no source.
|
|
5571
5686
|
const serveState = new configHelpers.BuildState()
|
|
5572
5687
|
serveState.resolve(await resolveConfig({ ...inline, build: { outDir: 'out' } }, 'serve'))
|
|
5573
5688
|
expect(serveState.building).toBe(false)
|
|
5574
|
-
expect(serveState.
|
|
5689
|
+
expect(serveState.entries).toStrictEqual({})
|
|
5575
5690
|
} finally {
|
|
5576
5691
|
scratch.destroy()
|
|
5577
5692
|
}
|
|
@@ -5605,11 +5720,11 @@ describe('configuration helpers', () => {
|
|
|
5605
5720
|
expect(Object.getOwnPropertyNames(configHelpers.BuildState.prototype).sort()).toEqual([
|
|
5606
5721
|
'building',
|
|
5607
5722
|
'constructor',
|
|
5723
|
+
'entries',
|
|
5608
5724
|
'locate',
|
|
5609
5725
|
'output',
|
|
5610
5726
|
'resolve',
|
|
5611
5727
|
'root',
|
|
5612
|
-
'source',
|
|
5613
5728
|
'trust',
|
|
5614
5729
|
])
|
|
5615
5730
|
} finally {
|
|
@@ -5953,10 +6068,17 @@ describe('configuration helpers', () => {
|
|
|
5953
6068
|
`from '${name}/browser'`,
|
|
5954
6069
|
)
|
|
5955
6070
|
expect(configHelpers.rewriteBrowserSpecifier("from './sibling.js'")).toBe("from './sibling.js'")
|
|
5956
|
-
expect(
|
|
5957
|
-
|
|
6071
|
+
expect(
|
|
6072
|
+
configHelpers.rewriteSourceSpecifier(
|
|
6073
|
+
'import { Reporter } from \'@src/server\'\nimport type { Shape } from "@src/core"',
|
|
6074
|
+
),
|
|
6075
|
+
).toBe(
|
|
6076
|
+
'import { Reporter } from \'../src/server/index.js\'\nimport type { Shape } from "../src/core/index.js"',
|
|
6077
|
+
)
|
|
6078
|
+
// A specifier past the environment, and a mention outside quotes, are no environment alias.
|
|
6079
|
+
expect(configHelpers.rewriteSourceSpecifier("from '@src/core/types.js' // @src/server")).toBe(
|
|
6080
|
+
"from '@src/core/types.js' // @src/server",
|
|
5958
6081
|
)
|
|
5959
|
-
expect(configHelpers.rewriteServerSpecifier("from '@src/core'")).toBe("from '@src/core'")
|
|
5960
6082
|
|
|
5961
6083
|
// The mechanism the roll-up proof's skip reads: an absent package rejects resolution.
|
|
5962
6084
|
expect(() => createRequire(import.meta.url).resolve('@absent/declaration-extractor')).toThrow(
|