@nodegx/export 0.0.0-stage → 0.2.6

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.
Files changed (53) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +76 -2
  3. package/dist/analyze/appState.d.ts +303 -0
  4. package/dist/analyze/plan.d.ts +3904 -0
  5. package/dist/analyze/querySettings.d.ts +75 -0
  6. package/dist/analyze/reach.d.ts +41 -0
  7. package/dist/analyze/scriptUses.d.ts +29 -0
  8. package/dist/catalog.d.ts +129 -0
  9. package/dist/cli/args.d.ts +100 -0
  10. package/dist/cli/exitCodes.d.ts +125 -0
  11. package/dist/cli/run.d.ts +30 -0
  12. package/dist/cli.inputs.json +203 -0
  13. package/dist/cli.mjs +62547 -0
  14. package/dist/cli.mjs.map +7 -0
  15. package/dist/emit/animateLib.d.ts +43 -0
  16. package/dist/emit/component.d.ts +166 -0
  17. package/dist/emit/dateLib.d.ts +45 -0
  18. package/dist/emit/emitApp.d.ts +38 -0
  19. package/dist/emit/idLib.d.ts +68 -0
  20. package/dist/emit/kits.d.ts +91 -0
  21. package/dist/emit/mediaLib.d.ts +75 -0
  22. package/dist/emit/naming.d.ts +76 -0
  23. package/dist/emit/parseLib.d.ts +108 -0
  24. package/dist/emit/preflight.d.ts +174 -0
  25. package/dist/emit/readme.d.ts +51 -0
  26. package/dist/emit/report.d.ts +309 -0
  27. package/dist/emit/scaffold.d.ts +83 -0
  28. package/dist/emit/statesLib.d.ts +52 -0
  29. package/dist/emit/style.d.ts +181 -0
  30. package/dist/emit/utilLib.d.ts +78 -0
  31. package/dist/errorMessage.d.ts +28 -0
  32. package/dist/index.cjs +61649 -0
  33. package/dist/index.cjs.map +7 -0
  34. package/dist/index.d.ts +37 -0
  35. package/dist/index.mjs +61570 -0
  36. package/dist/index.mjs.map +7 -0
  37. package/dist/ir/types.d.ts +567 -0
  38. package/dist/ledger.cjs +971 -0
  39. package/dist/ledger.cjs.map +7 -0
  40. package/dist/ledger.d.ts +75 -0
  41. package/dist/ledger.mjs +948 -0
  42. package/dist/ledger.mjs.map +7 -0
  43. package/dist/node-catalog.json +65370 -0
  44. package/dist/parse/kitSource.d.ts +135 -0
  45. package/dist/parse/parseModules.d.ts +42 -0
  46. package/dist/parse/parseProject.d.ts +13 -0
  47. package/dist/react19/VERSION +2 -0
  48. package/dist/react19/react-dom.production.min.js +51 -0
  49. package/dist/react19/react.production.min.js +21 -0
  50. package/dist/scriptFiles.d.ts +30 -0
  51. package/dist/structurePorts.d.ts +70 -0
  52. package/dist/write/writeExport.d.ts +67 -0
  53. package/package.json +53 -4
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Reading a custom node kit's `index.js` for what it *declares* — EXP-010's parse half.
3
+ *
4
+ * A kit is a plain `<script>`-shaped file that calls `Noodl.defineModule({ reactNodes: [...] })`.
5
+ * Its node definitions are the only statement anywhere of a custom node's ports: there is no
6
+ * catalog entry, no manifest field, nothing on disk beside the code. `projectmodules.ts` says the
7
+ * same thing from the other side — "what a kit registers is known only once its `index.js` has
8
+ * executed". So the export runs it.
9
+ *
10
+ * 🔴 **This is the fourth evaluator of kit source in the repo, and that is deliberate rather than
11
+ * missed.** The other three cannot answer this question, which was checked rather than assumed:
12
+ *
13
+ * - `noodl-editor/src/shared/utils/projectmodules.ts` → `verifyKitSource` returns node *names* and
14
+ * a pass/fail outcome. EXP-010 needs the ports — `inputProps`, `outputProps`, `outputs` — which
15
+ * that function reads past and discards. It is also TypeScript inside the editor package.
16
+ * - `noodl-mcp/src/kitExtract/entry.js` is an esbuild entry point for a child process; there is no
17
+ * function to import.
18
+ * - `noodl-viewer-react/static/ssr/kit-modules.js` takes a *deploy's `index.html`* and reads script
19
+ * tags out of it. There is no deploy at export time.
20
+ *
21
+ * What is reused is the shape of the question and the shim: the recursive-noop `Proxy` on `Noodl`
22
+ * with a collecting `defineModule` is `kitExtract/entry.js`'s, adopted rather than reinvented,
23
+ * because kit code touches other members of the `Noodl` global at module scope.
24
+ *
25
+ * ⚠️ **`React` is a recursive noop here, so this reads declarations and not behaviour.** A kit's
26
+ * components are *values* the export never calls — Route B renders them by running the kit's own
27
+ * code in the browser (`src/kits/`), and what this file extracts is the port map that decides how
28
+ * the graph's parameters and wires reach them. A kit that computed its `inputProps` from a React
29
+ * call at module scope would come back with fewer ports than it has; no kit on this machine does,
30
+ * and a kit that registers *no* usable ports is reported by name rather than assumed empty.
31
+ *
32
+ * ⚠️ **This is a shape read, not a security boundary.** A `vm` context is not a sandbox in the
33
+ * security sense — `vm`'s own documentation says so. Exporting a project already means running the
34
+ * project's own code on the machine that authored it, but no caller may describe a kit that
35
+ * survives this as safe.
36
+ *
37
+ * 🔴 **Nothing from the sandbox escapes.** Every value returned is rebuilt as plain JSON-shaped
38
+ * data by `plainValue`; the definitions hold functions closed over the vm realm and handing one
39
+ * back would put a foreign-realm callable in the IR, which is supposed to be serialisable.
40
+ */
41
+ /**
42
+ * What running a kit's source turned out to be.
43
+ *
44
+ * Named after `projectmodules.ts`'s `KitVerifyOutcome` and carrying the same distinctions, because
45
+ * the two are read by people looking at the same kit — the Kits panel and the export report must
46
+ * not disagree about why a kit produced nothing.
47
+ *
48
+ * ⚠️ `'unreadable'` is the caller's to report: this function is handed source, so "there is no
49
+ * code" is a fact about the file read, not about the run.
50
+ */
51
+ export type KitRunOutcome =
52
+ /** Ran, called `Noodl.defineModule`, and defined at least one named node. */
53
+ 'defines-nodes'
54
+ /** Ran cleanly and never called `Noodl.defineModule` — a library, not a kit. */
55
+ | 'no-define-module'
56
+ /** Called `defineModule` with no `nodes` and no `reactNodes` carrying a name. */
57
+ | 'defines-no-nodes'
58
+ /** An ES-module build; a `<script>` tag cannot load it, so neither can the exported app. */
59
+ | 'es-module'
60
+ /** A CommonJS (Node) build; same. */
61
+ | 'commonjs'
62
+ /** Threw while running. It would register nothing in the running app either. */
63
+ | 'threw';
64
+ /** One port a kit node declares. Plain data — no sandbox values, no functions. */
65
+ export interface KitPort {
66
+ name: string;
67
+ /** Declared port type name ("string", "number", "color", "signal", …) or undefined. */
68
+ type?: string;
69
+ /** The port type's `defaultUnit` ("px"), when the type is a units type. */
70
+ defaultUnit?: string;
71
+ displayName?: string;
72
+ group?: string;
73
+ /** Present only when the definition declares one. JSON-shaped. */
74
+ default?: unknown;
75
+ }
76
+ /** One node a kit defines. */
77
+ export interface KitNodeDefinition {
78
+ /** The node type name the graph stores — `nodegx.cashflow.Pill`. */
79
+ type: string;
80
+ displayName?: string;
81
+ docs?: string;
82
+ /** `allowChildren` — whether the node accepts visual children. */
83
+ allowChildren: boolean;
84
+ /**
85
+ * True when the definition has a `getReactComponent`. A kit may also define non-visual nodes
86
+ * (`nodes:` rather than `reactNodes:`); those are logic and this export does not render them.
87
+ */
88
+ visual: boolean;
89
+ /**
90
+ * Every input the node declares, from **both** places a definition declares them, tagged with
91
+ * how the runtime delivers it.
92
+ *
93
+ * - `via: 'prop'` — an `inputProps` entry. The value becomes a React prop of that name
94
+ * (`react-component-node.ts:945`), which is the only shape a visual kit node normally uses.
95
+ * - `via: 'node'` — an `inputs` entry, whose `set` function the node runs. `rename-kit`'s
96
+ * logic node `Source` declares its only input this way, and reading `inputProps` alone
97
+ * reports it as having none — which then reads as "the author set a parameter no port
98
+ * accepts" for a port that exists and works.
99
+ */
100
+ inputs: Array<KitPort & {
101
+ via: 'prop' | 'node';
102
+ }>;
103
+ /**
104
+ * Every output the node publishes, from **both** places a definition declares them, tagged with
105
+ * which one — the two are wired differently and collapsing them loses the difference.
106
+ *
107
+ * - `via: 'prop'` — an `outputProps` entry. The runtime *gives the component a callback prop*
108
+ * of this name (`react-component-node.ts:addPrimitiveOutputPropHandler`), and the component
109
+ * calling it is what fires the port. A `Money Pill` fires `onClick` this way.
110
+ * - `via: 'node'` — an `outputs` entry. The node itself publishes it: a value output through
111
+ * `get()` after `flagOutputDirty(name)`, a signal through `sendSignalOnOutput(name)`. `Money
112
+ * Pill`'s `liveDay`, `dropped` and `dragStarted` are all this shape, and `dropped` is fired
113
+ * from `initialize` with no `outputProps` entry at all — read only `outputProps` and it
114
+ * disappears.
115
+ */
116
+ outputs: Array<KitPort & {
117
+ kind: 'value' | 'signal';
118
+ via: 'prop' | 'node';
119
+ }>;
120
+ }
121
+ export interface KitRunResult {
122
+ outcome: KitRunOutcome;
123
+ /** Human-facing, and on failure it names the likely cause. Never a bare "false". */
124
+ message: string;
125
+ /** Definition order across every `defineModule` call. Empty on every failure. */
126
+ nodes: KitNodeDefinition[];
127
+ }
128
+ /**
129
+ * Run a kit's source and read every node definition it registers.
130
+ *
131
+ * Never throws. Every failure mode is an outcome with a message, because a project with one broken
132
+ * kit must still export the rest of itself (AC4) — an exception here would take the whole app down
133
+ * over a folder the author may not even remember adding.
134
+ */
135
+ export declare function runKitSource(code: string): KitRunResult;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `noodl_modules/` → `ModuleIR[]` — EXP-010's parse half.
3
+ *
4
+ * Until this file existed, `parseProject` contained **zero references to `noodl_modules`**: the
5
+ * directory was never opened. Every node from a custom kit therefore resolved to `catalogRef:
6
+ * null`, fell through `renderRole`'s default arm, and left the emitted JSX with a hole in it. The
7
+ * export was silently dropping the one part of a project the author had written themselves.
8
+ *
9
+ * 🔴 **The scan is `@nodegx/module-inject`'s, not this file's.** LIB-003 merged two
10
+ * `noodl_modules` readers because they had drifted, and CN-001 moved the merged core into a
11
+ * no-build package precisely so a fourth caller could reuse it instead of writing a third. What
12
+ * this file adds on top is the export's own questions — which modules carry nodes, what those
13
+ * nodes' ports are, and which files have to travel with the app.
14
+ *
15
+ * ⚠️ **Parsing now runs project code.** `runKitSource` executes each kit's `index.js` in a `vm`
16
+ * context, because a custom node's ports are declared nowhere else (see `kitSource.ts`). That is a
17
+ * real change to what `parseProject` does and it is stated here rather than buried: exporting a
18
+ * project runs that project's kits on the machine doing the export.
19
+ *
20
+ * ⚠️ **Never throws on content**, the same contract as the rest of parse. A kit that is missing,
21
+ * unreadable, an ES-module build or a thrower comes back as a `ModuleIR` with a `status` and a
22
+ * `message` saying so, and the rest of the app exports around it (AC4).
23
+ */
24
+ import { ModuleIR } from '../ir/types';
25
+ /**
26
+ * P109-S17-EXPORTKITDEPS — the kit dependencies the deployed page loads, in the order it loads them.
27
+ *
28
+ * The export copied every dependency to `public/` and nothing referenced it, so a kit that reads `window.THREE` threw
29
+ * in the exported app and drew in the deployed one. 🔴 **The injector's own `toInjectModules`, not a transcription**:
30
+ * it owns the path rule (`http…` verbatim, anything else under the module folder), the module order (kits by index
31
+ * path, then the rest, then `requires`) and the refusals (a refused kit has no dependencies). What is left is
32
+ * `buildInjectionTags`' loop: browser modules only, each dependency once.
33
+ */
34
+ export declare function parseModuleDependencies(projectDir: string): string[];
35
+ /**
36
+ * Every module in a project, in directory order.
37
+ *
38
+ * The `kind` split is `projectmodules.ts`'s, measured there across the 29 real projects on this
39
+ * machine and adopted rather than re-derived: there is no `kind: 'node-kit'` marker, so a kit is
40
+ * *subtractively* a module with a `main` that is not an iconset and not an ERG-002 library.
41
+ */
42
+ export declare function parseModules(projectDir: string): ModuleIR[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * v2 files → Graph IR. The faithful half of the pipeline: this stage records what the project
3
+ * says, resolves it against the catalog, and refuses to guess. Decisions (dispositions, names,
4
+ * file plans) belong to analysis, not here.
5
+ *
6
+ * Parsing never drops and never fails on content: unknown node types get catalogRef null,
7
+ * statically-unknowable port sets get portKnowledge 'unknown'/'partial', script parameters are
8
+ * captured verbatim. See EXP-002-IR-DESIGN.md.
9
+ */
10
+ import { Catalog } from '../catalog';
11
+ import { ExportIR } from '../ir/types';
12
+ export declare const EXPORTER_VERSION = "0.2.6";
13
+ export declare function parseProject(projectDir: string, catalog: Catalog): ExportIR;
@@ -0,0 +1,2 @@
1
+ react 19.0.0
2
+ built from npm packages by scripts/build-react-globals.js