stonyx 0.2.3-alpha.58 → 0.2.3-alpha.59
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/README.md +1 -1
- package/dist/cli/new.js +6 -2
- package/dist/modules.js +12 -5
- package/dist/util/duplicate-core.js +17 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ stonyx test # Bootstrap + run tests
|
|
|
27
27
|
stonyx help # Show all available commands
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
Stonyx reads `config/environment.ts` (preferred) or `config/environment.js`,
|
|
30
|
+
Stonyx reads `config/environment.ts` (preferred) or `config/environment.js`, loads the `@stonyx/*` modules declared in your `dependencies` or `devDependencies` (initializing the async ones), and runs your application.
|
|
31
31
|
|
|
32
32
|
## Documentation
|
|
33
33
|
|
package/dist/cli/new.js
CHANGED
|
@@ -167,8 +167,12 @@ export function generatePackageJson(name, selectedModules, coreVersion = readCor
|
|
|
167
167
|
tsx: '^4.21.0',
|
|
168
168
|
typescript: '^5.8.3'
|
|
169
169
|
};
|
|
170
|
-
//
|
|
171
|
-
//
|
|
170
|
+
// The scaffolder writes modules to `devDependencies` because that remains
|
|
171
|
+
// the conventional placement for an application — NOT because it is the only
|
|
172
|
+
// one discovery sees. Since abofs/stonyx#106 rule 3 the loader scans the
|
|
173
|
+
// de-duplicated union of `dependencies` and `devDependencies`, so either
|
|
174
|
+
// placement is discovered (see docs/modules.md). Requested on the core's own
|
|
175
|
+
// release line rather than at `latest`.
|
|
172
176
|
for (const mod of selectedModules) {
|
|
173
177
|
devDependencies[mod.package] = moduleTag;
|
|
174
178
|
}
|
package/dist/modules.js
CHANGED
|
@@ -106,10 +106,17 @@ export default async function loadModules(config, rootPath, chronicle) {
|
|
|
106
106
|
//
|
|
107
107
|
// Rule 3 widens the source to the DE-DUPLICATED union of both maps. Object
|
|
108
108
|
// spread IS the de-duplication and is load-bearing: a module declared in both
|
|
109
|
-
// maps collapses to one key, so it is registered once and
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
109
|
+
// maps collapses to one key, so it is registered once and — for an async
|
|
110
|
+
// module — instantiated once. (A SYNC module is discovered once and
|
|
111
|
+
// instantiated zero times; the loader never imports its entry point. Measured
|
|
112
|
+
// on a dual-declared sync fixture: `modules.length === 0`.)
|
|
113
|
+
//
|
|
114
|
+
// A bare `[ ...Object.keys(deps), ...Object.keys(devDeps) ]` concat instantiates
|
|
115
|
+
// a dual-declared module twice and runs its `init()` twice. That WOULD be
|
|
116
|
+
// invisible to the suite aggregate were T22 not armed; T22's instance-count
|
|
117
|
+
// assertion is what makes it visible. Measured at this head with the concat
|
|
118
|
+
// seeded: 178/1 with T22 the sole failure, both of its counts reading actual 2
|
|
119
|
+
// against expected 1.
|
|
113
120
|
const declaredDependencies = {
|
|
114
121
|
...(rootPackage.dependencies || {}),
|
|
115
122
|
...(rootPackage.devDependencies || {}),
|
|
@@ -126,7 +133,7 @@ export default async function loadModules(config, rootPath, chronicle) {
|
|
|
126
133
|
// DISCOVERY, hoisted above the pre-flight.
|
|
127
134
|
//
|
|
128
135
|
// The pre-flight must check exactly what the loader loads, and no more.
|
|
129
|
-
// `@stonyx/*` is a NAME test, not a membership test: a scoped
|
|
136
|
+
// `@stonyx/*` is a NAME test, not a membership test: a scoped dependency
|
|
130
137
|
// without the `stonyx-module` keyword is warned about and skipped below —
|
|
131
138
|
// never imported, never configured, incapable of registering anything on any
|
|
132
139
|
// singleton — and refusing to boot over its nested copy prescribed the MODULE
|
|
@@ -265,7 +265,8 @@ export function findForeignCores(modules, core = undefined, report = IGNORE) {
|
|
|
265
265
|
* NOTHING OFF DISK IS TRUSTED FOR DISPLAY — all three interpolated fields.
|
|
266
266
|
*
|
|
267
267
|
* `version` and the package root come from a manifest this app did not write.
|
|
268
|
-
* `moduleName` is narrower — it is a key from the app's own `
|
|
268
|
+
* `moduleName` is narrower — it is a key from the app's own `dependencies` or
|
|
269
|
+
* `devDependencies` (abofs/stonyx#106 rule 3: the loader scans the union),
|
|
269
270
|
* so forging it is an app author forging their own diagnostic — but it is
|
|
270
271
|
* rendered through the same `padEnd` table, and it caused the same two
|
|
271
272
|
* symptoms: seeded with ANSI escapes and embedded newlines it FORGED A
|
|
@@ -297,7 +298,7 @@ export function findForeignCores(modules, core = undefined, report = IGNORE) {
|
|
|
297
298
|
* nothing but its own wrap. The module name and the version are both inside
|
|
298
299
|
* PADDED columns whose widths are the max over every row, so one long value
|
|
299
300
|
* there pushes every other row's remaining columns off screen. Those two take
|
|
300
|
-
* the tight default; a scoped `@stonyx/*`
|
|
301
|
+
* the tight default; a scoped `@stonyx/*` dependency key is far short of it,
|
|
301
302
|
* so a real name is sanitised and never shortened either.
|
|
302
303
|
*/
|
|
303
304
|
const PATH_LIMIT = 1024;
|
|
@@ -368,10 +369,21 @@ export function duplicateCoreMessage(foreign) {
|
|
|
368
369
|
'peerDependencies range, never as an exact dependency — @stonyx/discord is the reference shape. ' +
|
|
369
370
|
consumerRemedy,
|
|
370
371
|
'',
|
|
372
|
+
// THIS PARAGRAPH IS A CLAIM ABOUT WHAT THE LOADER SCANS, printed at the
|
|
373
|
+
// moment boot is refused. abofs/stonyx#106 rule 3 widened that scan to the
|
|
374
|
+
// de-duplicated union of `dependencies` and `devDependencies`, and until
|
|
375
|
+
// PR #120 fix round 1 this sentence still said `devDependencies` only —
|
|
376
|
+
// so a refusal could name `seen by "@stonyx/x"` for a package declared
|
|
377
|
+
// ONLY in `dependencies` and then, seven lines later, tell the operator
|
|
378
|
+
// that such a declaration is not counted. Reproduced verbatim before the
|
|
379
|
+
// fix. That sends them to search `devDependencies`, where there is nothing.
|
|
380
|
+
// If the scan source ever changes again, this string changes with it;
|
|
381
|
+
// `duplicate-core-test.ts` D4 asserts the claim, not just the header.
|
|
371
382
|
'Scope of this check: it compares physical package ROOTS only. It does not check that the ' +
|
|
372
383
|
'single surviving copy is a compatible version, and it looks at @stonyx/* packages declared in ' +
|
|
373
|
-
'this app\'s devDependencies that carry the "stonyx-module" keyword — nothing
|
|
374
|
-
'
|
|
375
|
-
'
|
|
384
|
+
'this app\'s dependencies or devDependencies that carry the "stonyx-module" keyword — nothing ' +
|
|
385
|
+
'else. Either placement counts: the loader scans the de-duplicated union of both maps. A copy ' +
|
|
386
|
+
'dragged in by anything outside that set — a transitive dependency, a package without the ' +
|
|
387
|
+
'keyword, or one not declared in this app\'s manifest at all — is not counted.',
|
|
376
388
|
].join('\n');
|
|
377
389
|
}
|