stonyx 0.2.3-alpha.56 → 0.2.3-alpha.57
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/modules.js +26 -2
- 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`, initializes all `@stonyx/*` modules
|
|
30
|
+
Stonyx reads `config/environment.ts` (preferred) or `config/environment.js`, initializes all `@stonyx/*` modules declared in your `dependencies` or `devDependencies`, and runs your application.
|
|
31
31
|
|
|
32
32
|
## Documentation
|
|
33
33
|
|
package/dist/modules.js
CHANGED
|
@@ -78,11 +78,35 @@ export default async function loadModules(config, rootPath, chronicle) {
|
|
|
78
78
|
const modules = [];
|
|
79
79
|
const initPromises = [];
|
|
80
80
|
const rootPackage = await readFile(`${rootPath}/package.json`, { json: true });
|
|
81
|
-
|
|
81
|
+
// DISCOVERY SOURCE (abofs/stonyx#106 rule 3).
|
|
82
|
+
//
|
|
83
|
+
// This local used to be named `dependencies` while holding `devDependencies`
|
|
84
|
+
// and nothing else. That name is the ruled root cause of #106: every reader
|
|
85
|
+
// of this function — including its own docs — believed discovery scanned
|
|
86
|
+
// both maps, because the identifier said so. It did not. An installed stonyx
|
|
87
|
+
// module declared in `dependencies` was invisible, which is precisely how the
|
|
88
|
+
// published fleet pins the core, so the loader could not see its own
|
|
89
|
+
// siblings.
|
|
90
|
+
//
|
|
91
|
+
// Rule 3 widens the source to the DE-DUPLICATED union of both maps. Object
|
|
92
|
+
// spread IS the de-duplication and is load-bearing: a module declared in both
|
|
93
|
+
// maps collapses to one key, so it is registered once and instantiated once.
|
|
94
|
+
// A bare `[ ...Object.keys(deps), ...Object.keys(devDeps) ]` concat produces a
|
|
95
|
+
// byte-identical suite aggregate while instantiating such a module twice and
|
|
96
|
+
// running its `init()` twice — T22's instance-count assertion owns that kill.
|
|
97
|
+
const declaredDependencies = {
|
|
98
|
+
...(rootPackage.dependencies || {}),
|
|
99
|
+
...(rootPackage.devDependencies || {}),
|
|
100
|
+
};
|
|
82
101
|
const projectName = typeof rootPackage.name === 'string' ? rootPackage.name : '';
|
|
83
102
|
// Expose rootPath to public configuration
|
|
84
103
|
config.rootPath = rootPath;
|
|
85
|
-
|
|
104
|
+
// The `@stonyx/` prefix filter STAYS (#106 keeps it explicitly). Widening it
|
|
105
|
+
// to `@` — or dropping it — makes the loader warn on every non-Stonyx
|
|
106
|
+
// dependency and leaves their `modulePromises` entries permanently
|
|
107
|
+
// unresolved. T3 owns that kill. What is a module is decided below, by the
|
|
108
|
+
// `stonyx-module` keyword; this is only a name test that bounds the scan.
|
|
109
|
+
const moduleDependencies = Object.keys(declaredDependencies).filter((moduleName) => moduleName.startsWith('@stonyx/'));
|
|
86
110
|
// Setup module promises prior to initialization
|
|
87
111
|
for (const moduleName of moduleDependencies) {
|
|
88
112
|
const promise = {};
|