nola-lang 0.1.0-alpha.0 → 0.1.2
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/README.md +10 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +46 -27
- package/dist/build.js.map +1 -1
- package/dist/declarations.d.ts +13 -0
- package/dist/declarations.d.ts.map +1 -0
- package/dist/declarations.js +51 -0
- package/dist/declarations.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +8 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +4 -12
- package/dist/init.js.map +1 -1
- package/dist/main.js +39 -3
- package/dist/main.js.map +1 -1
- package/dist/skill.d.ts +5 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +11 -0
- package/dist/skill.js.map +1 -0
- package/dist/tshost-declarations.d.ts +8 -0
- package/dist/tshost-declarations.d.ts.map +1 -0
- package/dist/tshost-declarations.js +28 -0
- package/dist/tshost-declarations.js.map +1 -0
- package/dist/tshost.d.ts.map +1 -1
- package/dist/tshost.js +5 -1
- package/dist/tshost.js.map +1 -1
- package/package.json +11 -9
- package/skills/nola/SKILL.md +75 -0
- package/skills/nola/references/config.md +227 -0
- package/skills/nola/references/patterns.md +277 -0
- package/skills/nola/references/pitfalls.md +281 -0
- package/skills/nola/references/syntax.md +377 -0
- package/dist/config.d.ts +0 -3
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -2
- package/dist/config.js.map +0 -1
- package/dist/providers.d.ts +0 -3
- package/dist/providers.d.ts.map +0 -1
- package/dist/providers.js +0 -2
- package/dist/providers.js.map +0 -1
- package/dist/runtime.d.ts +0 -3
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -7
- package/dist/runtime.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.
|
package/README.md
CHANGED
|
@@ -30,3 +30,13 @@ node --import nola-lang/register src/main.tsi
|
|
|
30
30
|
|
|
31
31
|
The loader inlines source maps pointing at the on-disk `.tsi`, so VS Code
|
|
32
32
|
breakpoints bind directly in Nola source.
|
|
33
|
+
|
|
34
|
+
## Production builds
|
|
35
|
+
|
|
36
|
+
`nola build` output is self-contained: for app projects (the default) it
|
|
37
|
+
emits `dist/nola.config.js` — your bundled config — and wires every built
|
|
38
|
+
module to load it, so `node dist/<entry>.js` needs no loader and no manual
|
|
39
|
+
`nolaRuntime.configure()`. Library authors set `build: { target: "lib" }`
|
|
40
|
+
in nola.config.ts to skip that wiring; the consuming app configures the
|
|
41
|
+
process. Provider secrets come from the real environment in production —
|
|
42
|
+
`.env` files are a dev-time convenience.
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAKD,wBAAsB,QAAQ,CAAC,MAAM,SAAM,EAAE,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAsHlF"}
|
package/dist/build.js
CHANGED
|
@@ -4,18 +4,22 @@ import { basename, dirname, join, relative, resolve } from "node:path";
|
|
|
4
4
|
import remappingImport from "@ampproject/remapping";
|
|
5
5
|
import { Codes } from "@nola-lang/ast";
|
|
6
6
|
import { companionSourceCandidates, companionSpecifierFor, compileCompanion, compileNola } from "@nola-lang/compiler";
|
|
7
|
-
import { findProjectRoot, loadCompilerOptions } from "@nola-lang/node-loader";
|
|
7
|
+
import { bundleSelfConfiguringConfig, findProjectRoot, loadBuildOptions, loadCompilerOptions, } from "@nola-lang/node-loader";
|
|
8
8
|
import { transformSync } from "esbuild";
|
|
9
|
-
import { collectCompanionEntries } from "./companions.js";
|
|
10
9
|
import { printDiagnostics } from "./diag.js";
|
|
11
|
-
import {
|
|
10
|
+
import { emitDeclarationTexts } from "./tshost-declarations.js";
|
|
12
11
|
import { walkProject } from "./walk.js";
|
|
13
12
|
const remapping = remappingImport;
|
|
13
|
+
/** First line of the emitted config bundle; the overwrite guard keys on it. */
|
|
14
|
+
const CONFIG_BUNDLE_MARKER = "// generated by nola build — self-configuring Nola config bundle";
|
|
14
15
|
export async function cmdBuild(dirArg = ".", outArg = "dist") {
|
|
15
16
|
const dir = resolve(dirArg);
|
|
16
17
|
const out = resolve(outArg);
|
|
17
18
|
const sourceRoot = findProjectRoot(dir);
|
|
18
19
|
const { underivableContextType } = await loadCompilerOptions(dir);
|
|
20
|
+
const { target, configPath } = await loadBuildOptions(dir);
|
|
21
|
+
const wireConfig = target === "app" && configPath !== null;
|
|
22
|
+
const configOutPath = join(out, "nola.config.js");
|
|
19
23
|
const written = [];
|
|
20
24
|
const errors = [];
|
|
21
25
|
const lowered = [];
|
|
@@ -26,6 +30,25 @@ export async function cmdBuild(dirArg = ".", outArg = "dist") {
|
|
|
26
30
|
}
|
|
27
31
|
if (errors.length > 0)
|
|
28
32
|
return { written, errors };
|
|
33
|
+
// App builds ship the config: bundle nola.config.ts (relative imports
|
|
34
|
+
// inlined, packages external) with a self-configuring wrapper, emitted
|
|
35
|
+
// first so a bad config fails the build before any compilation.
|
|
36
|
+
if (wireConfig) {
|
|
37
|
+
if (existsSync(configOutPath) && !(await readFile(configOutPath, "utf8")).startsWith(CONFIG_BUNDLE_MARKER)) {
|
|
38
|
+
errors.push(`${configOutPath}: exists and was not generated by nola build — refusing to overwrite. Is another toolchain compiling nola.config.ts into --out?`);
|
|
39
|
+
return { written, errors };
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const bundled = await bundleSelfConfiguringConfig(configPath);
|
|
43
|
+
await mkdir(out, { recursive: true });
|
|
44
|
+
await writeFile(configOutPath, `${CONFIG_BUNDLE_MARKER}\n${bundled}`);
|
|
45
|
+
written.push(configOutPath);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
errors.push(err instanceof Error ? err.message : String(err));
|
|
49
|
+
return { written, errors };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
29
52
|
for (const file of tsi) {
|
|
30
53
|
const source = await readFile(file, "utf8");
|
|
31
54
|
const result = compileNola(source, file, { sourceRoot, underivableContextType });
|
|
@@ -35,7 +58,17 @@ export async function cmdBuild(dirArg = ".", outArg = "dist") {
|
|
|
35
58
|
}
|
|
36
59
|
lowered.push({ file, loweredCode: result.code });
|
|
37
60
|
metas.push(result.meta.companions);
|
|
38
|
-
|
|
61
|
+
// The wiring import is appended to the TRANSFORM INPUT only — the
|
|
62
|
+
// declarations pass reuses result.code and must never see it. EOF keeps
|
|
63
|
+
// positions intact; the appended line has no counterpart in result.map,
|
|
64
|
+
// so it stays unmapped after the merge.
|
|
65
|
+
const outPath = `${join(out, relative(dir, file))}.js`;
|
|
66
|
+
let emitCode = result.code;
|
|
67
|
+
if (wireConfig) {
|
|
68
|
+
const rel = relative(dirname(outPath), configOutPath).replace(/\\/g, "/");
|
|
69
|
+
emitCode = `${result.code}\nimport ${JSON.stringify(rel.startsWith(".") ? rel : `./${rel}`)};\n`;
|
|
70
|
+
}
|
|
71
|
+
const js = transformSync(emitCode, { loader: "ts", format: "esm", sourcemap: "external", sourcefile: file });
|
|
39
72
|
let consumed = false;
|
|
40
73
|
const merged = remapping(js.map, () => {
|
|
41
74
|
if (consumed)
|
|
@@ -43,7 +76,6 @@ export async function cmdBuild(dirArg = ".", outArg = "dist") {
|
|
|
43
76
|
consumed = true;
|
|
44
77
|
return result.map;
|
|
45
78
|
});
|
|
46
|
-
const outPath = `${join(out, relative(dir, file))}.js`;
|
|
47
79
|
await mkdir(dirname(outPath), { recursive: true });
|
|
48
80
|
await writeFile(outPath, `${js.code}\n//# sourceMappingURL=${basename(outPath)}.map\n`);
|
|
49
81
|
await writeFile(`${outPath}.map`, merged.toString());
|
|
@@ -79,28 +111,15 @@ export async function cmdBuild(dirArg = ".", outArg = "dist") {
|
|
|
79
111
|
written.push(outPath);
|
|
80
112
|
companionQueue.push(...companion.companions.map((c) => ({ importer: src, specifier: c })));
|
|
81
113
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (fileName.endsWith(".d.ts"))
|
|
92
|
-
declarationText = text;
|
|
93
|
-
}, undefined, true);
|
|
94
|
-
if (declarationText) {
|
|
95
|
-
// Next to the built .js in --out (report.tsi.js + report.tsi.d.ts pair
|
|
96
|
-
// under NodeNext), NEVER adjacent to the source: the editor serves
|
|
97
|
-
// .tsi virtually, and an on-disk declaration would only shadow it.
|
|
98
|
-
const dtsPath = `${join(out, relative(dir, entry.file))}.d.ts`;
|
|
99
|
-
await mkdir(dirname(dtsPath), { recursive: true });
|
|
100
|
-
await writeFile(dtsPath, declarationText);
|
|
101
|
-
written.push(dtsPath);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
114
|
+
const texts = await emitDeclarationTexts(lowered, metas, sourceRoot, dir);
|
|
115
|
+
for (const [file, declarationText] of texts) {
|
|
116
|
+
// Next to the built .js in --out (report.tsi.js + report.tsi.d.ts pair
|
|
117
|
+
// under NodeNext), NEVER adjacent to the source: the editor serves
|
|
118
|
+
// .tsi virtually, and an on-disk declaration would only shadow it.
|
|
119
|
+
const dtsPath = `${join(out, relative(dir, file))}.d.ts`;
|
|
120
|
+
await mkdir(dirname(dtsPath), { recursive: true });
|
|
121
|
+
await writeFile(dtsPath, declarationText);
|
|
122
|
+
written.push(dtsPath);
|
|
104
123
|
}
|
|
105
124
|
return { written, errors };
|
|
106
125
|
}
|
package/dist/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,eAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACtH,OAAO,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAA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C,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QACtE,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,cAAc,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,oBAAoB,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IAC1E,KAAK,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,KAAK,EAAE,CAAC;QAC5C,uEAAuE;QACvE,mEAAmE;QACnE,mEAAmE;QACnE,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC;QACzD,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** report.tsi → report.d.tsi.ts, adjacent — TS allowArbitraryExtensions resolves it. */
|
|
2
|
+
export declare function adjacentDeclarationPath(tsiFile: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Emit <base>.d.tsi.ts next to each .tsi so PLAIN tsc (and framework builds
|
|
5
|
+
* like `next build`) resolve .tsi imports via allowArbitraryExtensions.
|
|
6
|
+
* The editor hides these when the sibling .tsi exists; `nola check` excludes
|
|
7
|
+
* them from roots.
|
|
8
|
+
*/
|
|
9
|
+
export declare function emitAdjacentDeclarations(dirArg?: string): Promise<{
|
|
10
|
+
written: string[];
|
|
11
|
+
errors: string[];
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAUA,wFAAwF;AACxF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,SAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAmC7G"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { Codes } from "@nola-lang/ast";
|
|
4
|
+
import { compileNola } from "@nola-lang/compiler";
|
|
5
|
+
import { findProjectRoot, loadCompilerOptions } from "@nola-lang/node-loader";
|
|
6
|
+
import { printDiagnostics } from "./diag.js";
|
|
7
|
+
import { emitDeclarationTexts } from "./tshost-declarations.js";
|
|
8
|
+
import { walkProject } from "./walk.js";
|
|
9
|
+
/** report.tsi → report.d.tsi.ts, adjacent — TS allowArbitraryExtensions resolves it. */
|
|
10
|
+
export function adjacentDeclarationPath(tsiFile) {
|
|
11
|
+
return `${tsiFile.slice(0, -".tsi".length)}.d.tsi.ts`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Emit <base>.d.tsi.ts next to each .tsi so PLAIN tsc (and framework builds
|
|
15
|
+
* like `next build`) resolve .tsi imports via allowArbitraryExtensions.
|
|
16
|
+
* The editor hides these when the sibling .tsi exists; `nola check` excludes
|
|
17
|
+
* them from roots.
|
|
18
|
+
*/
|
|
19
|
+
export async function emitAdjacentDeclarations(dirArg = ".") {
|
|
20
|
+
const dir = resolve(dirArg);
|
|
21
|
+
const sourceRoot = findProjectRoot(dir);
|
|
22
|
+
const { underivableContextType } = await loadCompilerOptions(dir);
|
|
23
|
+
const written = [];
|
|
24
|
+
const errors = [];
|
|
25
|
+
const { tsi, reserved } = await walkProject(dir);
|
|
26
|
+
for (const file of reserved) {
|
|
27
|
+
errors.push(`${file} ${Codes.ReservedCompanionPath}: the *.nola.* filename namespace is reserved for generated companion modules — rename this file`);
|
|
28
|
+
}
|
|
29
|
+
if (errors.length > 0)
|
|
30
|
+
return { written, errors };
|
|
31
|
+
const lowered = [];
|
|
32
|
+
const metas = [];
|
|
33
|
+
for (const file of tsi) {
|
|
34
|
+
const source = await readFile(file, "utf8");
|
|
35
|
+
const result = compileNola(source, file, { sourceRoot, underivableContextType });
|
|
36
|
+
if (result.diagnostics.length > 0) {
|
|
37
|
+
errors.push(printDiagnostics(result.diagnostics, () => source));
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
lowered.push({ file, loweredCode: result.code });
|
|
41
|
+
metas.push(result.meta.companions);
|
|
42
|
+
}
|
|
43
|
+
const texts = await emitDeclarationTexts(lowered, metas, sourceRoot, dir);
|
|
44
|
+
for (const [file, text] of texts) {
|
|
45
|
+
const dtsPath = adjacentDeclarationPath(file);
|
|
46
|
+
await writeFile(dtsPath, text);
|
|
47
|
+
written.push(dtsPath);
|
|
48
|
+
}
|
|
49
|
+
return { written, errors };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=declarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.js","sourceRoot":"","sources":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
2
2
|
export { cmdCheck } from "./check.js";
|
|
3
|
+
export { adjacentDeclarationPath, emitAdjacentDeclarations } from "./declarations.js";
|
|
3
4
|
export { printDiagnostics } from "./diag.js";
|
|
4
5
|
export { codeFrame } from "./frame.js";
|
|
5
6
|
export { cmdRun } from "./run.js";
|
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,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { cmdBuild } from "./build.js";
|
|
2
2
|
export { cmdCheck } from "./check.js";
|
|
3
|
+
export { adjacentDeclarationPath, emitAdjacentDeclarations } from "./declarations.js";
|
|
3
4
|
export { printDiagnostics } from "./diag.js";
|
|
4
5
|
export { codeFrame } from "./frame.js";
|
|
5
6
|
export { cmdRun } from "./run.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAA0C,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAA0C,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/init.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export interface InitOptions {
|
|
2
|
+
template?: string;
|
|
3
|
+
add?: boolean;
|
|
4
|
+
ide?: string;
|
|
5
|
+
agents?: string;
|
|
6
|
+
}
|
|
7
|
+
/** `nola init [dir] [--template <name>|--add] [--ide vscode|none] [--agents <list>]` — the same flow `npm create nola-lang` runs. */
|
|
8
|
+
export declare function cmdInit(dir: string | undefined, opts: InitOptions): Promise<number>;
|
|
3
9
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qIAAqI;AACrI,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzF"}
|
package/dist/init.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** `nola init [dir]` — the same
|
|
3
|
-
export async function cmdInit(dir) {
|
|
4
|
-
|
|
5
|
-
console.log(`Scaffolded a Nola project into ${root} (${files.length} files).`);
|
|
6
|
-
console.log("");
|
|
7
|
-
console.log("Next steps:");
|
|
8
|
-
if (dir !== ".")
|
|
9
|
-
console.log(` cd ${dir}`);
|
|
10
|
-
console.log(" npm install");
|
|
11
|
-
console.log(" npm start # runs offline via the replay ledger — no API key needed");
|
|
12
|
-
return 0;
|
|
1
|
+
import { runFlow } from "create-nola-lang";
|
|
2
|
+
/** `nola init [dir] [--template <name>|--add] [--ide vscode|none] [--agents <list>]` — the same flow `npm create nola-lang` runs. */
|
|
3
|
+
export async function cmdInit(dir, opts) {
|
|
4
|
+
return runFlow({ dir, ...opts }, { intro: "nola init" });
|
|
13
5
|
}
|
|
14
6
|
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C,qIAAqI;AACrI,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAuB,EAAE,IAAiB;IACtE,OAAO,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
package/dist/main.js
CHANGED
|
@@ -2,20 +2,31 @@
|
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
3
|
import { cmdBuild } from "./build.js";
|
|
4
4
|
import { cmdCheck } from "./check.js";
|
|
5
|
+
import { emitAdjacentDeclarations } from "./declarations.js";
|
|
5
6
|
import { cmdInit } from "./init.js";
|
|
6
7
|
import { cmdRun } from "./run.js";
|
|
8
|
+
import { cmdSkill } from "./skill.js";
|
|
7
9
|
const HELP = `nola <command>
|
|
8
10
|
|
|
9
11
|
Commands:
|
|
10
|
-
init [dir]
|
|
12
|
+
init [dir] [--template <t>|--add] [--ide vscode] [--agents <list>] scaffold or retrofit a Nola project
|
|
13
|
+
skill install [--agents <list>] write agent skill files (Claude Code, Cursor, Copilot, AGENTS.md) into the project
|
|
11
14
|
build [dir] [--out <dir>] compile all .tsi files (js+map+d.ts to --out)
|
|
12
15
|
run <entry> run a .tsi/.js entry with the Nola loader + nola.config.ts
|
|
13
16
|
check [dir] type-check lowered .tsi files AND the project's .ts files, positions mapped back
|
|
17
|
+
declarations [dir] [--watch] emit <name>.d.tsi.ts next to each .tsi so plain tsc resolves .tsi imports (allowArbitraryExtensions)
|
|
14
18
|
`;
|
|
15
19
|
async function main() {
|
|
16
20
|
const { positionals, values } = parseArgs({
|
|
17
21
|
allowPositionals: true,
|
|
18
|
-
options: {
|
|
22
|
+
options: {
|
|
23
|
+
out: { type: "string", default: "dist" },
|
|
24
|
+
template: { type: "string" },
|
|
25
|
+
add: { type: "boolean" },
|
|
26
|
+
ide: { type: "string" },
|
|
27
|
+
watch: { type: "boolean" },
|
|
28
|
+
agents: { type: "string" },
|
|
29
|
+
},
|
|
19
30
|
});
|
|
20
31
|
const [command, arg] = positionals;
|
|
21
32
|
switch (command) {
|
|
@@ -37,10 +48,35 @@ async function main() {
|
|
|
37
48
|
console.log("nola check: no errors");
|
|
38
49
|
return 0;
|
|
39
50
|
}
|
|
51
|
+
case "declarations": {
|
|
52
|
+
const run = async () => {
|
|
53
|
+
const { written, errors } = await emitAdjacentDeclarations(arg ?? ".");
|
|
54
|
+
if (errors.length > 0) {
|
|
55
|
+
console.error(errors.join("\n\n"));
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
console.log(`nola declarations: ${written.length} files written`);
|
|
59
|
+
return 0;
|
|
60
|
+
};
|
|
61
|
+
const code = await run();
|
|
62
|
+
if (!values.watch)
|
|
63
|
+
return code;
|
|
64
|
+
const { watch } = await import("node:fs");
|
|
65
|
+
let timer;
|
|
66
|
+
watch(arg ?? ".", { recursive: true }, (_event, name) => {
|
|
67
|
+
if (name?.endsWith(".tsi")) {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
timer = setTimeout(run, 150);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return await new Promise(() => { }); // watch runs until Ctrl-C
|
|
73
|
+
}
|
|
40
74
|
case "run":
|
|
41
75
|
return cmdRun(arg ?? "");
|
|
42
76
|
case "init":
|
|
43
|
-
return cmdInit(arg
|
|
77
|
+
return cmdInit(arg, { template: values.template, add: values.add, ide: values.ide, agents: values.agents });
|
|
78
|
+
case "skill":
|
|
79
|
+
return cmdSkill(arg, { agents: values.agents });
|
|
44
80
|
default:
|
|
45
81
|
console.log(HELP);
|
|
46
82
|
return command ? 1 : 0;
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,IAAI,GAAG;;;;;;;;;CASZ,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QACxC,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACP,GAAG,EA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