@nola-lang/node-loader 0.1.0-alpha.0 → 0.1.3
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/LICENSE +201 -21
- package/dist/bundle-config.d.ts +16 -0
- package/dist/bundle-config.d.ts.map +1 -0
- package/dist/bundle-config.js +66 -0
- package/dist/bundle-config.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -5
- package/dist/config.js.map +1 -1
- package/dist/hooks.d.ts +0 -6
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +24 -0
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/register.d.ts +9 -0
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +18 -0
- package/dist/register.js.map +1 -1
- package/package.json +8 -7
- package/dist/debug-prewarm.d.ts +0 -13
- package/dist/debug-prewarm.d.ts.map +0 -1
- package/dist/debug-prewarm.js +0 -33
- package/dist/debug-prewarm.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,201 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Evgen Mykhailenko
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle nola.config.ts into one ESM module string. Relative and
|
|
3
|
+
* tsconfig-paths imports are inlined (middleware/hooks in src travel with the
|
|
4
|
+
* config); bare package specifiers stay external so module-level state is
|
|
5
|
+
* never duplicated between the config bundle and the app's own imports.
|
|
6
|
+
* The default export is preserved.
|
|
7
|
+
*/
|
|
8
|
+
export declare function bundleConfig(configPath: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* The dist artifact for app builds: the bundled config plus a wrapper that
|
|
11
|
+
* applies it to the process runtime on import. Importing it is idempotent
|
|
12
|
+
* (ESM module cache); a manual configure() in the entry's body still wins —
|
|
13
|
+
* body code runs after imports and before the first-ask latch.
|
|
14
|
+
*/
|
|
15
|
+
export declare function bundleSelfConfiguringConfig(configPath: string): Promise<string>;
|
|
16
|
+
//# sourceMappingURL=bundle-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-config.d.ts","sourceRoot":"","sources":["../src/bundle-config.ts"],"names":[],"mappings":"AA2CA;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtE;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQrF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { basename, dirname } from "node:path";
|
|
2
|
+
import { Codes } from "@nola-lang/ast";
|
|
3
|
+
import { NolaConfigError } from "@nola-lang/runtime";
|
|
4
|
+
import { build } from "esbuild";
|
|
5
|
+
/** Refuse .tsi in the config graph: the config is evaluated before the Nola loader registers. */
|
|
6
|
+
const refuseTsi = {
|
|
7
|
+
name: "nola-refuse-tsi",
|
|
8
|
+
setup(b) {
|
|
9
|
+
b.onResolve({ filter: /\.tsi$/ }, (args) => ({
|
|
10
|
+
errors: [
|
|
11
|
+
{
|
|
12
|
+
text: `${Codes.ConfigImportsTsi}: nola.config.ts cannot import ".tsi" modules ("${args.path}" imported from ${args.importer}) — the config is evaluated before the Nola loader registers.`,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
}));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
async function runBundle(source, configPath) {
|
|
19
|
+
try {
|
|
20
|
+
const result = await build({
|
|
21
|
+
...source,
|
|
22
|
+
bundle: true,
|
|
23
|
+
platform: "node",
|
|
24
|
+
format: "esm",
|
|
25
|
+
packages: "external",
|
|
26
|
+
write: false,
|
|
27
|
+
absWorkingDir: dirname(configPath),
|
|
28
|
+
logLevel: "silent",
|
|
29
|
+
plugins: [refuseTsi],
|
|
30
|
+
});
|
|
31
|
+
return result.outputFiles[0]?.text ?? "";
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
const messages = err.errors ?? [];
|
|
35
|
+
const tsi = messages.find((m) => m.text.includes(Codes.ConfigImportsTsi));
|
|
36
|
+
if (tsi)
|
|
37
|
+
throw new NolaConfigError(tsi.text, Codes.ConfigImportsTsi);
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Bundle nola.config.ts into one ESM module string. Relative and
|
|
43
|
+
* tsconfig-paths imports are inlined (middleware/hooks in src travel with the
|
|
44
|
+
* config); bare package specifiers stay external so module-level state is
|
|
45
|
+
* never duplicated between the config bundle and the app's own imports.
|
|
46
|
+
* The default export is preserved.
|
|
47
|
+
*/
|
|
48
|
+
export async function bundleConfig(configPath) {
|
|
49
|
+
return runBundle({ entryPoints: [configPath] }, configPath);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The dist artifact for app builds: the bundled config plus a wrapper that
|
|
53
|
+
* applies it to the process runtime on import. Importing it is idempotent
|
|
54
|
+
* (ESM module cache); a manual configure() in the entry's body still wins —
|
|
55
|
+
* body code runs after imports and before the first-ask latch.
|
|
56
|
+
*/
|
|
57
|
+
export async function bundleSelfConfiguringConfig(configPath) {
|
|
58
|
+
const entry = [
|
|
59
|
+
`import config from ${JSON.stringify(`./${basename(configPath)}`)};`,
|
|
60
|
+
`import { nolaRuntime } from "@nola-lang/runtime";`,
|
|
61
|
+
`nolaRuntime.configure(config, { source: "nola.config.ts" });`,
|
|
62
|
+
"",
|
|
63
|
+
].join("\n");
|
|
64
|
+
return runBundle({ stdin: { contents: entry, resolveDir: dirname(configPath), loader: "ts" } }, configPath);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=bundle-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-config.js","sourceRoot":"","sources":["../src/bundle-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAe,MAAM,SAAS,CAAC;AAE7C,iGAAiG;AACjG,MAAM,SAAS,GAAW;IACxB,IAAI,EAAE,iBAAiB;IACvB,KAAK,CAAC,CAAC;QACL,CAAC,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC3C,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,GAAG,KAAK,CAAC,gBAAgB,mDAAmD,IAAI,CAAC,IAAI,mBAAmB,IAAI,CAAC,QAAQ,+DAA+D;iBAC3L;aACF;SACF,CAAC,CAAC,CAAC;IACN,CAAC;CACF,CAAC;AAIF,KAAK,UAAU,SAAS,CAAC,MAAoB,EAAE,UAAkB;IAC/D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC;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,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;AAC9G,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -16,4 +16,15 @@ export declare function loadNolaConfig(startDir?: string): Promise<ResolvedNolaC
|
|
|
16
16
|
* still compiles. Defaults apply when there is no config file at all.
|
|
17
17
|
*/
|
|
18
18
|
export declare function loadCompilerOptions(startDir?: string): Promise<ResolvedCompilerConfig>;
|
|
19
|
+
export interface BuildOptions {
|
|
20
|
+
target: "app" | "lib";
|
|
21
|
+
/** Absolute path of the governing nola.config.ts, or null when none exists. */
|
|
22
|
+
configPath: string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The `build` section alone, for `nola build`: validates ONLY that section,
|
|
26
|
+
* so a project without a runtime-valid config still builds. Also reports
|
|
27
|
+
* where the config lives, so app builds can bundle it into --out.
|
|
28
|
+
*/
|
|
29
|
+
export declare function loadBuildOptions(startDir?: string): Promise<BuildOptions>;
|
|
19
30
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EAIxB,MAAM,oBAAoB,CAAC;AA2B5B;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAgB,GAAG,MAAM,CAIhE;AAgBD,wBAAsB,cAAc,CAAC,QAAQ,SAAgB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAIjG;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,SAAgB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAMnG;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;IACtB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,SAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAMtF"}
|
package/dist/config.js
CHANGED
|
@@ -3,8 +3,8 @@ import { readFile, rm, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { parseEnv } from "node:util";
|
|
6
|
-
import { resolveCompilerConfig, resolveNolaConfig, } from "@nola-lang/runtime";
|
|
7
|
-
import {
|
|
6
|
+
import { resolveBuildConfig, resolveCompilerConfig, resolveNolaConfig, } from "@nola-lang/runtime";
|
|
7
|
+
import { bundleConfig } from "./bundle-config.js";
|
|
8
8
|
// Apply a project-root `.env` into process.env before the config is evaluated, so
|
|
9
9
|
// `nola.config.ts` (and anything it reads, e.g. OPENAI_API_KEY) sees it. Precedence
|
|
10
10
|
// follows dotenv convention: an entry already set in the real environment wins, so
|
|
@@ -45,11 +45,10 @@ export function findProjectRoot(startDir = process.cwd()) {
|
|
|
45
45
|
const configPath = findUp(from, "nola.config.ts");
|
|
46
46
|
return configPath ? dirname(configPath) : from;
|
|
47
47
|
}
|
|
48
|
-
/** Evaluate nola.config.ts (
|
|
48
|
+
/** Evaluate nola.config.ts (bundled: relative imports inlined, packages external) via temp-module import. */
|
|
49
49
|
async function evalConfigModule(configPath) {
|
|
50
50
|
await applyDotEnv(dirname(configPath));
|
|
51
|
-
const
|
|
52
|
-
const { code } = transformSync(source, { loader: "ts", format: "esm" });
|
|
51
|
+
const code = await bundleConfig(configPath);
|
|
53
52
|
const tmp = join(dirname(configPath), `nola.config.${Date.now()}.${process.pid}.mjs`);
|
|
54
53
|
await writeFile(tmp, code);
|
|
55
54
|
try {
|
|
@@ -79,4 +78,17 @@ export async function loadCompilerOptions(startDir = process.cwd()) {
|
|
|
79
78
|
const section = raw !== null && typeof raw === "object" ? raw.compiler : undefined;
|
|
80
79
|
return resolveCompilerConfig(section, configPath);
|
|
81
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* The `build` section alone, for `nola build`: validates ONLY that section,
|
|
83
|
+
* so a project without a runtime-valid config still builds. Also reports
|
|
84
|
+
* where the config lives, so app builds can bundle it into --out.
|
|
85
|
+
*/
|
|
86
|
+
export async function loadBuildOptions(startDir = process.cwd()) {
|
|
87
|
+
const configPath = findUp(startDir, "nola.config.ts");
|
|
88
|
+
if (!configPath)
|
|
89
|
+
return { target: "app", configPath: null };
|
|
90
|
+
const raw = await evalConfigModule(configPath);
|
|
91
|
+
const section = raw !== null && typeof raw === "object" ? raw.build : undefined;
|
|
92
|
+
return { target: resolveBuildConfig(section, configPath).target, configPath };
|
|
93
|
+
}
|
|
82
94
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAGL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],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,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;AAChF,CAAC"}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -10,12 +10,6 @@ type NextResolve = (specifier: string, context: ResolveContext) => Promise<{
|
|
|
10
10
|
url: string;
|
|
11
11
|
shortCircuit?: boolean;
|
|
12
12
|
}>;
|
|
13
|
-
/**
|
|
14
|
-
* Companion specifiers name modules that never exist on disk — default
|
|
15
|
-
* resolution would throw ERR_MODULE_NOT_FOUND before `load` ran. Recognize the
|
|
16
|
-
* reserved suffix, probe the type-source candidates next to the importer, and
|
|
17
|
-
* short-circuit to a marked URL the `load` hook synthesizes from.
|
|
18
|
-
*/
|
|
19
13
|
export declare function resolve(specifier: string, context: ResolveContext, nextResolve: NextResolve): Promise<{
|
|
20
14
|
url: string;
|
|
21
15
|
shortCircuit?: boolean;
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AA+BA,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE;QAAE,sBAAsB,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE,GAAG,IAAI,CAE9G;AAED,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AA+BA,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE;QAAE,sBAAsB,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE,GAAG,IAAI,CAE9G;AAED,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AA2BpH,wBAAsB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;SA3BhB,MAAM;mBAAiB,OAAO;GAiD/G;AAED,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AACD,KAAK,QAAQ,GAAG,CACd,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE1E,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ;YAFzD,MAAM;YAAU,OAAO;mBAAiB,OAAO;GAqBrE"}
|
package/dist/hooks.js
CHANGED
|
@@ -34,8 +34,32 @@ export function initialize(data) {
|
|
|
34
34
|
* reserved suffix, probe the type-source candidates next to the importer, and
|
|
35
35
|
* short-circuit to a marked URL the `load` hook synthesizes from.
|
|
36
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* NodeNext convention: plain TS written for tsc says `./x.js` while only
|
|
39
|
+
* `x.ts` is on disk. Node's native type-stripping refuses that mapping, so
|
|
40
|
+
* when default resolution finds nothing, retry once with a `.ts` tail — a
|
|
41
|
+
* real `.js` always won already, and a miss rethrows the original error.
|
|
42
|
+
*/
|
|
43
|
+
async function resolveWithTsFallback(specifier, context, nextResolve) {
|
|
44
|
+
try {
|
|
45
|
+
return await nextResolve(specifier, context);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (err.code !== "ERR_MODULE_NOT_FOUND")
|
|
49
|
+
throw err;
|
|
50
|
+
try {
|
|
51
|
+
return await nextResolve(`${specifier.slice(0, -".js".length)}.ts`, context);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
throw err;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
37
58
|
export async function resolve(specifier, context, nextResolve) {
|
|
38
59
|
if (!isCompanionSpecifier(specifier) || !specifier.startsWith(".") || !context.parentURL?.startsWith("file:")) {
|
|
60
|
+
if (specifier.endsWith(".js") && specifier.startsWith(".") && context.parentURL?.startsWith("file:")) {
|
|
61
|
+
return resolveWithTsFallback(specifier, context, nextResolve);
|
|
62
|
+
}
|
|
39
63
|
return nextResolve(specifier, context);
|
|
40
64
|
}
|
|
41
65
|
const importerDir = dirname(fileURLToPath(context.parentURL));
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,aAA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aAAa,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC/G,MAAM,OAAO,GAAG,GAAG,IAAI,uDAAuD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;IACtH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AACnE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { bundleConfig, bundleSelfConfiguringConfig } from "./bundle-config.js";
|
|
2
|
+
export { type BuildOptions, findProjectRoot, loadBuildOptions, loadCompilerOptions, loadNolaConfig, } from "./config.js";
|
|
3
|
+
export { assertNodeModuleHooks, registerNola } from "./register.js";
|
|
3
4
|
export { formatDiagnostics, NolaTransformError, transformNola } from "./transform.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EACL,KAAK,YAAY,EACjB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { bundleConfig, bundleSelfConfiguringConfig } from "./bundle-config.js";
|
|
2
|
+
export { findProjectRoot, loadBuildOptions, loadCompilerOptions, loadNolaConfig, } from "./config.js";
|
|
3
|
+
export { assertNodeModuleHooks, registerNola } from "./register.js";
|
|
3
4
|
export { formatDiagnostics, NolaTransformError, transformNola } from "./transform.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/register.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The loader IS Node's module customization hooks (`module.register`). Bun and
|
|
3
|
+
* Deno expose `node:module` but do not run the hooks (Bun's `register` is a
|
|
4
|
+
* silent no-op), so a `.tsi` import under them fails later with an opaque
|
|
5
|
+
* "export not found". Fail first, with the invocations that do work: every
|
|
6
|
+
* package manager is fine (`bun install`, `bun run start` — the `nola` bin is
|
|
7
|
+
* a Node script by shebang), only Bun/Deno AS THE RUNTIME is not.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertNodeModuleHooks(versions?: Record<string, string | undefined>): void;
|
|
1
10
|
/**
|
|
2
11
|
* Config loads BEFORE the hooks register: the hooks worker gets no project
|
|
3
12
|
* context of its own, so the compiler section rides in as `register` data —
|
package/dist/register.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAoB,GAAG,IAAI,CAQ3G;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAK7E"}
|
package/dist/register.js
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { register } from "node:module";
|
|
2
|
+
import { Codes } from "@nola-lang/ast";
|
|
2
3
|
import { nolaRuntime } from "@nola-lang/runtime";
|
|
3
4
|
import { loadNolaConfig } from "./config.js";
|
|
5
|
+
/**
|
|
6
|
+
* The loader IS Node's module customization hooks (`module.register`). Bun and
|
|
7
|
+
* Deno expose `node:module` but do not run the hooks (Bun's `register` is a
|
|
8
|
+
* silent no-op), so a `.tsi` import under them fails later with an opaque
|
|
9
|
+
* "export not found". Fail first, with the invocations that do work: every
|
|
10
|
+
* package manager is fine (`bun install`, `bun run start` — the `nola` bin is
|
|
11
|
+
* a Node script by shebang), only Bun/Deno AS THE RUNTIME is not.
|
|
12
|
+
*/
|
|
13
|
+
export function assertNodeModuleHooks(versions = process.versions) {
|
|
14
|
+
const other = versions.bun ? `Bun ${versions.bun}` : versions.deno ? `Deno ${versions.deno}` : undefined;
|
|
15
|
+
if (!other)
|
|
16
|
+
return;
|
|
17
|
+
throw new Error(`${Codes.LoaderHooksUnsupported}: the Nola loader needs Node.js module hooks, which ${other} does not run. ` +
|
|
18
|
+
"Run .tsi code on Node: `bun run start` / `npm start` (the nola bin runs on Node) or " +
|
|
19
|
+
"`node --import nola-lang/register src/main.ts`; `bun --bun` and `bun src/main.ts` cannot load .tsi files.");
|
|
20
|
+
}
|
|
4
21
|
/**
|
|
5
22
|
* Config loads BEFORE the hooks register: the hooks worker gets no project
|
|
6
23
|
* context of its own, so the compiler section rides in as `register` data —
|
|
@@ -8,6 +25,7 @@ import { loadNolaConfig } from "./config.js";
|
|
|
8
25
|
* (Consequence: nola.config.ts itself cannot import `.tsi` modules.)
|
|
9
26
|
*/
|
|
10
27
|
export async function registerNola(opts = {}) {
|
|
28
|
+
assertNodeModuleHooks();
|
|
11
29
|
const config = await loadNolaConfig(opts.dir ?? process.cwd());
|
|
12
30
|
register("./hooks.js", { parentURL: import.meta.url, data: { compiler: config?.compiler } });
|
|
13
31
|
if (config)
|
package/dist/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAyB,EAAE;IAC5D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/D,QAAQ,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GA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AE,EAAE,CAAC,CAAC;IAC7F,IAAI,MAAM;QAAE,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nola-lang/node-loader",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Node module hooks that compile .tsi on the fly (internal; powers nola run and nola-lang/register)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nola"
|
|
7
7
|
],
|
|
8
|
-
"license": "
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
9
|
"author": "Evgen Mykhailenko",
|
|
10
10
|
"homepage": "https://github.com/nola-lang/nola#readme",
|
|
11
11
|
"repository": {
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
"./register": "./dist/register.js"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
|
-
"dist"
|
|
32
|
+
"dist",
|
|
33
|
+
"!dist/.tsbuildinfo"
|
|
33
34
|
],
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@nola-lang/ast": "0.1.
|
|
36
|
-
"@nola-lang/compiler": "0.1.
|
|
37
|
-
"@nola-lang/parser": "0.1.
|
|
38
|
-
"@nola-lang/runtime": "0.1.
|
|
36
|
+
"@nola-lang/ast": "0.1.3",
|
|
37
|
+
"@nola-lang/compiler": "0.1.3",
|
|
38
|
+
"@nola-lang/parser": "0.1.3",
|
|
39
|
+
"@nola-lang/runtime": "0.1.3",
|
|
39
40
|
"@ampproject/remapping": "^2.3.0",
|
|
40
41
|
"@jridgewell/sourcemap-codec": "^1.5.0",
|
|
41
42
|
"esbuild": "^0.25.0"
|
package/dist/debug-prewarm.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debugger-only: force undici's one-time llhttp WebAssembly compile BEFORE
|
|
3
|
-
* user code runs. js-debug wraps WebAssembly.compile with an injected
|
|
4
|
-
* `debugger;` statement (its WASM instrumentation), and when that pause fires
|
|
5
|
-
* MID-STEP — which is exactly what happens when F10 crosses the process's
|
|
6
|
-
* first `ask` and fetch lazily compiles llhttp — js-debug auto-resumes its
|
|
7
|
-
* own pause and V8's pending step dies with it: the step turns into a
|
|
8
|
-
* continue. One loopback round-trip (~2ms, no external network) moves the
|
|
9
|
-
* compile to startup, where the instrumentation pause is harmless.
|
|
10
|
-
* No-op unless an inspector is attached.
|
|
11
|
-
*/
|
|
12
|
-
export declare function prewarmDebuggerHttpStack(): Promise<void>;
|
|
13
|
-
//# sourceMappingURL=debug-prewarm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-prewarm.d.ts","sourceRoot":"","sources":["../src/debug-prewarm.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB9D"}
|
package/dist/debug-prewarm.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import inspector from "node:inspector";
|
|
2
|
-
import net from "node:net";
|
|
3
|
-
/**
|
|
4
|
-
* Debugger-only: force undici's one-time llhttp WebAssembly compile BEFORE
|
|
5
|
-
* user code runs. js-debug wraps WebAssembly.compile with an injected
|
|
6
|
-
* `debugger;` statement (its WASM instrumentation), and when that pause fires
|
|
7
|
-
* MID-STEP — which is exactly what happens when F10 crosses the process's
|
|
8
|
-
* first `ask` and fetch lazily compiles llhttp — js-debug auto-resumes its
|
|
9
|
-
* own pause and V8's pending step dies with it: the step turns into a
|
|
10
|
-
* continue. One loopback round-trip (~2ms, no external network) moves the
|
|
11
|
-
* compile to startup, where the instrumentation pause is harmless.
|
|
12
|
-
* No-op unless an inspector is attached.
|
|
13
|
-
*/
|
|
14
|
-
export async function prewarmDebuggerHttpStack() {
|
|
15
|
-
if (inspector.url() === undefined)
|
|
16
|
-
return;
|
|
17
|
-
try {
|
|
18
|
-
const server = net.createServer((sock) => {
|
|
19
|
-
sock.end("HTTP/1.1 204 No Content\r\nconnection: close\r\n\r\n");
|
|
20
|
-
});
|
|
21
|
-
await new Promise((resolve, reject) => {
|
|
22
|
-
server.once("error", reject);
|
|
23
|
-
server.listen(0, "127.0.0.1", resolve);
|
|
24
|
-
});
|
|
25
|
-
const address = server.address();
|
|
26
|
-
await fetch(`http://127.0.0.1:${address.port}/`).then((r) => r.arrayBuffer());
|
|
27
|
-
server.close();
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// best-effort: a failed prewarm only means stepping may lose the race once
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=debug-prewarm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-prewarm.js","sourceRoot":"","sources":["../src/debug-prewarm.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,IAAI,SAAS,CAAC,GAAG,EAAE,KAAK,SAAS;QAAE,OAAO;IAC1C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;YACvC,IAAI,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAqB,CAAC;QACpD,MAAM,KAAK,CAAC,oBAAoB,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAC9E,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;IAC7E,CAAC;AACH,CAAC"}
|