node-opcua-convert-nodeset-to-javascript 2.183.0 → 2.184.0
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/dist/_dataType.d.ts +1 -0
- package/dist/_dataType.d.ts.map +1 -0
- package/dist/_dataType.js +36 -39
- package/dist/_dataType.js.map +1 -1
- package/dist/convert_namespace_to_typescript.d.ts +1 -0
- package/dist/convert_namespace_to_typescript.d.ts.map +1 -0
- package/dist/convert_namespace_to_typescript.js +72 -67
- package/dist/convert_namespace_to_typescript.js.map +1 -1
- package/dist/convert_to_typescript.d.ts +1 -0
- package/dist/convert_to_typescript.d.ts.map +1 -0
- package/dist/convert_to_typescript.js +124 -138
- package/dist/convert_to_typescript.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -19
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +31 -35
- package/dist/main.js.map +1 -1
- package/dist/options.d.ts +1 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +1 -2
- package/dist/package_root.d.ts +1 -0
- package/dist/package_root.d.ts.map +1 -0
- package/dist/package_root.js +4 -10
- package/dist/package_root.js.map +1 -1
- package/dist/private/cache.d.ts +1 -0
- package/dist/private/cache.d.ts.map +1 -0
- package/dist/private/cache.js +35 -48
- package/dist/private/cache.js.map +1 -1
- package/dist/private/fs_retry.d.ts +1 -0
- package/dist/private/fs_retry.d.ts.map +1 -0
- package/dist/private/fs_retry.js +4 -11
- package/dist/private/fs_retry.js.map +1 -1
- package/dist/private/get_corresponding_data_type.d.ts +1 -0
- package/dist/private/get_corresponding_data_type.d.ts.map +1 -0
- package/dist/private/get_corresponding_data_type.js +38 -42
- package/dist/private/get_corresponding_data_type.js.map +1 -1
- package/dist/private/to_filename.d.ts +1 -0
- package/dist/private/to_filename.d.ts.map +1 -0
- package/dist/private/to_filename.js +3 -6
- package/dist/private/to_filename.js.map +1 -1
- package/dist/private/utils.d.ts +1 -0
- package/dist/private/utils.d.ts.map +1 -0
- package/dist/private/utils.js +69 -90
- package/dist/private/utils.js.map +1 -1
- package/dist/private-stuff.d.ts +1 -0
- package/dist/private-stuff.d.ts.map +1 -0
- package/dist/private-stuff.js +4 -20
- package/dist/private-stuff.js.map +1 -1
- package/dist/remove_unused.d.ts +1 -0
- package/dist/remove_unused.d.ts.map +1 -0
- package/dist/remove_unused.js +22 -28
- package/dist/remove_unused.js.map +1 -1
- package/dist/update_parent_tsconfig.d.ts +1 -0
- package/dist/update_parent_tsconfig.d.ts.map +1 -0
- package/dist/update_parent_tsconfig.js +10 -16
- package/dist/update_parent_tsconfig.js.map +1 -1
- package/dist/utils2.d.ts +1 -0
- package/dist/utils2.d.ts.map +1 -0
- package/dist/utils2.js +10 -22
- package/dist/utils2.js.map +1 -1
- package/dist/walk_through.d.ts +1 -0
- package/dist/walk_through.d.ts.map +1 -0
- package/dist/walk_through.js +19 -26
- package/dist/walk_through.js.map +1 -1
- package/package.json +19 -19
- package/source/convert_namespace_to_typescript.ts +15 -2
- package/source/main.ts +1 -0
- package/source/package_root.ts +1 -1
|
@@ -119,6 +119,8 @@ function getReleaseVersion(options: Options): string {
|
|
|
119
119
|
|
|
120
120
|
interface Info {
|
|
121
121
|
files: string[];
|
|
122
|
+
/** the files that emit a runtime value (an enum); every other generated file is types only */
|
|
123
|
+
filesWithValues: Set<string>;
|
|
122
124
|
folder: string;
|
|
123
125
|
module: string;
|
|
124
126
|
dependencies: string[];
|
|
@@ -172,8 +174,11 @@ export async function convertNamespaceTypeToTypescript(
|
|
|
172
174
|
fs.mkdirSync(sourceFolder);
|
|
173
175
|
}
|
|
174
176
|
writeFileSyncRetry(path.join(sourceFolder, `${filename}.ts`), content);
|
|
175
|
-
infos[module] = infos[module] || { folder, dependencies: [], module, files: [] };
|
|
177
|
+
infos[module] = infos[module] || { folder, dependencies: [], module, files: [], filesWithValues: new Set() };
|
|
176
178
|
infos[module].files.push(`${filename}.ts`);
|
|
179
|
+
if (type === "enum") {
|
|
180
|
+
infos[module].filesWithValues.add(`${filename}.ts`);
|
|
181
|
+
}
|
|
177
182
|
infos[module].dependencies = [...new Set([...infos[module].dependencies, ...dependencies])];
|
|
178
183
|
}
|
|
179
184
|
};
|
|
@@ -195,7 +200,11 @@ async function _output_index_ts_file(info: Info): Promise<void> {
|
|
|
195
200
|
if (file.match(/^enum_eration/)) {
|
|
196
201
|
continue;
|
|
197
202
|
}
|
|
198
|
-
|
|
203
|
+
// A types-only file compiles to an empty module, yet `export *` still loads it at
|
|
204
|
+
// runtime: hundreds of them per package, all paid for at startup. `export type *`
|
|
205
|
+
// re-exports the same types and drops the load.
|
|
206
|
+
const keyword = info.filesWithValues.has(file) ? "export" : "export type";
|
|
207
|
+
content.push(`${keyword} * from "./${file.replace(".ts", "")}.js";`);
|
|
199
208
|
}
|
|
200
209
|
fs.writeFileSync(index, content.join("\n"));
|
|
201
210
|
// create package.json
|
|
@@ -228,6 +237,10 @@ async function _output_package_json(info: Info, options: Options): Promise<void>
|
|
|
228
237
|
content2.push(`{`);
|
|
229
238
|
content2.push(` "name": "${info.module}",`);
|
|
230
239
|
content2.push(` "version": "${version}",`);
|
|
240
|
+
// These packages are almost entirely type declarations: what they emit is a handful of
|
|
241
|
+
// enums and an index that re-exports types. ESM costs them nothing and keeps them in
|
|
242
|
+
// step with the rest of the workspace, which is flipping package by package (FEAT-2).
|
|
243
|
+
content2.push(` "type": "module",`);
|
|
231
244
|
content2.push(` "description": "pure nodejs OPCUA SDK - module ${info.module}",`);
|
|
232
245
|
content2.push(` "main": "dist/index.js",`);
|
|
233
246
|
content2.push(` "types": "dist/index.d.ts",`);
|
package/source/main.ts
CHANGED
package/source/package_root.ts
CHANGED
|
@@ -12,7 +12,7 @@ import path from "node:path";
|
|
|
12
12
|
* as a CLI from any directory, and cwd would then resolve somewhere else entirely.
|
|
13
13
|
* A tool has to find its own files relative to itself.
|
|
14
14
|
*/
|
|
15
|
-
const here =
|
|
15
|
+
const here = import.meta.dirname;
|
|
16
16
|
|
|
17
17
|
/** this package's own root, one level above the compiled output */
|
|
18
18
|
export const packageRoot = path.join(here, "..");
|