@datalackey/gas-demodulify-plugin 0.1.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/README.md +605 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/GASDemodulifyPlugin.d.ts +33 -0
- package/dist/plugin/GASDemodulifyPlugin.js +125 -0
- package/dist/plugin/GASDemodulifyPlugin.js.map +1 -0
- package/dist/plugin/Logger.d.ts +22 -0
- package/dist/plugin/Logger.js +64 -0
- package/dist/plugin/Logger.js.map +1 -0
- package/dist/plugin/code-emission/CodeEmitter.d.ts +14 -0
- package/dist/plugin/code-emission/CodeEmitter.js +253 -0
- package/dist/plugin/code-emission/CodeEmitter.js.map +1 -0
- package/dist/plugin/code-emission/shared-types.d.ts +46 -0
- package/dist/plugin/code-emission/shared-types.js +3 -0
- package/dist/plugin/code-emission/shared-types.js.map +1 -0
- package/dist/plugin/code-emission/wildcards-resolution-helpers.d.ts +7 -0
- package/dist/plugin/code-emission/wildcards-resolution-helpers.js +100 -0
- package/dist/plugin/code-emission/wildcards-resolution-helpers.js.map +1 -0
- package/dist/plugin/invariants.d.ts +13 -0
- package/dist/plugin/invariants.js +23 -0
- package/dist/plugin/invariants.js.map +1 -0
- package/dist/plugin/plugin-configuration-options/options.schema.d.ts +41 -0
- package/dist/plugin/plugin-configuration-options/options.schema.js +67 -0
- package/dist/plugin/plugin-configuration-options/options.schema.js.map +1 -0
- package/dist/plugin/plugin-configuration-options/validateAndNormalizePluginOptions.d.ts +5 -0
- package/dist/plugin/plugin-configuration-options/validateAndNormalizePluginOptions.js +12 -0
- package/dist/plugin/plugin-configuration-options/validateAndNormalizePluginOptions.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveTsEntrypoint = resolveTsEntrypoint;
|
|
7
|
+
exports.assertNoWildcardReexports = assertNoWildcardReexports;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const Logger_1 = require("../Logger");
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the single TypeScript-authored entrypoint.
|
|
13
|
+
*/
|
|
14
|
+
function resolveTsEntrypoint(compilation) {
|
|
15
|
+
Logger_1.Logger.debug("Resolving TypeScript entrypoint");
|
|
16
|
+
const candidates = [];
|
|
17
|
+
for (const [entryName, rawEntrypoint] of compilation.entrypoints) {
|
|
18
|
+
Logger_1.Logger.debug(`Inspecting entrypoint '${entryName}'`);
|
|
19
|
+
const entrypoint = rawEntrypoint;
|
|
20
|
+
let chunks = [];
|
|
21
|
+
if (entrypoint.chunks !== undefined) {
|
|
22
|
+
chunks = Array.from(entrypoint.chunks);
|
|
23
|
+
}
|
|
24
|
+
else if (entrypoint.getEntrypointChunk !== undefined) {
|
|
25
|
+
chunks = [entrypoint.getEntrypointChunk()];
|
|
26
|
+
}
|
|
27
|
+
Logger_1.Logger.debug(`Entrypoint '${entryName}' has ${chunks.length} chunk(s)`);
|
|
28
|
+
for (const chunk of chunks) {
|
|
29
|
+
const runtime = chunk.runtime;
|
|
30
|
+
for (const entryModule of compilation.chunkGraph.getChunkEntryModulesIterable(chunk)) {
|
|
31
|
+
const resource = entryModule.resource; // chunk entry module has resource?
|
|
32
|
+
if (typeof resource === "string" &&
|
|
33
|
+
(resource.endsWith(".ts") || resource.endsWith(".tsx"))) {
|
|
34
|
+
Logger_1.Logger.debug(`Found TS entry module for '${entryName}': ${resource}`);
|
|
35
|
+
candidates.push({
|
|
36
|
+
entryName,
|
|
37
|
+
entryModule: entryModule,
|
|
38
|
+
runtime,
|
|
39
|
+
chunks,
|
|
40
|
+
});
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (candidates.length === 0) {
|
|
47
|
+
throw new Error("No TypeScript entrypoint found");
|
|
48
|
+
}
|
|
49
|
+
if (candidates.length > 1) {
|
|
50
|
+
const names = candidates.map(c => c.entryName).join(", ");
|
|
51
|
+
throw new Error(`GASDemodulifyPlugin requires exactly one TypeScript entrypoint, but found ${candidates.length}: [${names}]`);
|
|
52
|
+
}
|
|
53
|
+
const resolved = candidates[0];
|
|
54
|
+
Logger_1.Logger.debug(`Resolved entrypoint '${resolved.entryName}' with ${resolved.chunks.length} chunk(s)`);
|
|
55
|
+
return resolved;
|
|
56
|
+
}
|
|
57
|
+
// Wildcard re-export guard
|
|
58
|
+
const exportStarRe = /export\s*\*\s*(?:as\s+\w+\s*)?(?:from\s+['"]|;)/;
|
|
59
|
+
function assertNoWildcardReexports(compilation, entry) {
|
|
60
|
+
const chunks = entry.chunks;
|
|
61
|
+
for (const chunk of chunks) {
|
|
62
|
+
for (const module of compilation.chunkGraph.getChunkModulesIterable(chunk)) {
|
|
63
|
+
const resource = module.resource;
|
|
64
|
+
if (typeof resource === "string" &&
|
|
65
|
+
(resource.endsWith(".ts") || resource.endsWith(".tsx"))) {
|
|
66
|
+
const abs = path_1.default.isAbsolute(resource)
|
|
67
|
+
? resource
|
|
68
|
+
: path_1.default.resolve(compilation.options?.context ??
|
|
69
|
+
process.cwd(), resource);
|
|
70
|
+
if (fs_1.default.existsSync(abs)) {
|
|
71
|
+
const content = fs_1.default.readFileSync(abs, "utf8");
|
|
72
|
+
if (exportStarRe.test(content)) {
|
|
73
|
+
throw unsupportedWildcardError(`Module: ${abs}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const exportsInfo = compilation.moduleGraph.getExportsInfo(module);
|
|
78
|
+
const other = exportsInfo.otherExportsInfo;
|
|
79
|
+
if (other !== undefined && other.provided === true) {
|
|
80
|
+
const resourceLabel = typeof resource === "string" ? resource : "<synthetic>";
|
|
81
|
+
throw unsupportedWildcardError(`Module: ${resourceLabel}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function unsupportedWildcardError(details) {
|
|
87
|
+
return new Error([
|
|
88
|
+
"Unsupported wildcard re-export detected.",
|
|
89
|
+
"",
|
|
90
|
+
"This build uses a wildcard re-export (`export *` or `export * as ns`), which cannot be safely",
|
|
91
|
+
"flattened into a Google Apps Script global namespace.",
|
|
92
|
+
"",
|
|
93
|
+
"Workaround:",
|
|
94
|
+
"Replace wildcard re-exports with explicit named re-exports:",
|
|
95
|
+
' export { foo, bar } from "./module";',
|
|
96
|
+
"",
|
|
97
|
+
details ?? "",
|
|
98
|
+
].join("\n"));
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=wildcards-resolution-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wildcards-resolution-helpers.js","sourceRoot":"","sources":["../../../src/plugin/code-emission/wildcards-resolution-helpers.ts"],"names":[],"mappings":";;;;;AAsBA,kDA0DC;AAKD,8DAsCC;AAxHD,4CAAoB;AACpB,gDAAwB;AACxB,sCAAmC;AAcnC;;GAEG;AACH,SAAgB,mBAAmB,CAAC,WAAwB;IACxD,eAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAEhD,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;QAC/D,eAAM,CAAC,KAAK,CAAC,0BAA0B,SAAS,GAAG,CAAC,CAAC;QAErD,MAAM,UAAU,GAAG,aAA0C,CAAC;QAC9D,IAAI,MAAM,GAAY,EAAE,CAAC;QACzB,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,GAAG,KAAK,CAAC,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M,wBAAwB,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC;oBACrD,CAAC;gBACL,CAAC;YACL,CAAC;YAED,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnE,MAAM,KAAK,GAAG,WAAW,CAAC,gBAAgB,CAAC;YAC3C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACjD,MAAM,aAAa,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;gBAC9E,MAAM,wBAAwB,CAAC,WAAW,aAAa,EAAE,CAAC,CAAC;YAC/D,CAAC;QACL,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAgB;IAC9C,OAAO,IAAI,KAAK,CACZ;QACI,0CAA0C;QAC1C,EAAE;QACF,+FAA+F;QAC/F,uDAAuD;QACvD,EAAE;QACF,aAAa;QACb,6DAA6D;QAC7D,wCAAwC;QACxC,EAAE;QACF,OAAO,IAAI,EAAE;KAChB,CAAC,IAAI,CAAC,IAAI,CAAC,CACf,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GAS demodulification invariants.
|
|
3
|
+
*
|
|
4
|
+
* These patterns must NEVER appear in emitted GAS output.
|
|
5
|
+
* Their presence indicates leaked Webpack / module-system artifacts.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT:
|
|
8
|
+
* - These are UNANCHORED patterns by design.
|
|
9
|
+
* - We must detect violations anywhere in the output, regardless of formatting.
|
|
10
|
+
* - Might flag false positives in string literals or comments, but that's acceptable
|
|
11
|
+
* since such cases are likely to be rare and indicative of potential issues anyway.
|
|
12
|
+
*/
|
|
13
|
+
export declare const FORBIDDEN_WEBPACK_RUNTIME_PATTERNS: readonly RegExp[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FORBIDDEN_WEBPACK_RUNTIME_PATTERNS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* GAS demodulification invariants.
|
|
6
|
+
*
|
|
7
|
+
* These patterns must NEVER appear in emitted GAS output.
|
|
8
|
+
* Their presence indicates leaked Webpack / module-system artifacts.
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT:
|
|
11
|
+
* - These are UNANCHORED patterns by design.
|
|
12
|
+
* - We must detect violations anywhere in the output, regardless of formatting.
|
|
13
|
+
* - Might flag false positives in string literals or comments, but that's acceptable
|
|
14
|
+
* since such cases are likely to be rare and indicative of potential issues anyway.
|
|
15
|
+
*/
|
|
16
|
+
exports.FORBIDDEN_WEBPACK_RUNTIME_PATTERNS = [
|
|
17
|
+
/__webpack_/i, // any webpack runtime helper
|
|
18
|
+
/\.__esModule\b/i, // ESM interop artifact
|
|
19
|
+
/\bexports\./i, // CommonJS named export
|
|
20
|
+
/\bmodule\.exports\b/i, // CommonJS default export
|
|
21
|
+
/Object\.defineProperty\s*\(\s*exports\b/i, // CJS export descriptor
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=invariants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariants.js","sourceRoot":"","sources":["../../src/plugin/invariants.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACU,QAAA,kCAAkC,GAAsB;IACjE,aAAa,EAAE,6BAA6B;IAC5C,iBAAiB,EAAE,uBAAuB;IAC1C,cAAc,EAAE,wBAAwB;IACxC,sBAAsB,EAAE,0BAA0B;IAClD,0CAA0C,EAAE,wBAAwB;CAC9D,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Public configuration options for GASDemodulifyPlugin.
|
|
4
|
+
*
|
|
5
|
+
* These options are supplied by the consumer when constructing the plugin
|
|
6
|
+
* instance in `webpack.config.js`.
|
|
7
|
+
*
|
|
8
|
+
* They control:
|
|
9
|
+
* - how emitted symbols are namespaced
|
|
10
|
+
* - which logical subsystem is being built
|
|
11
|
+
* - which artifacts are emitted
|
|
12
|
+
* - how much diagnostic output is produced
|
|
13
|
+
*
|
|
14
|
+
* This schema is the single source of truth for:
|
|
15
|
+
* - runtime validation
|
|
16
|
+
* - defaulting behavior
|
|
17
|
+
* - TypeScript type inference
|
|
18
|
+
*/
|
|
19
|
+
export declare const DemodulifyOptionsSchema: z.ZodObject<{
|
|
20
|
+
namespaceRoot: z.ZodDefault<z.ZodString>;
|
|
21
|
+
subsystem: z.ZodDefault<z.ZodString>;
|
|
22
|
+
buildMode: z.ZodDefault<z.ZodEnum<{
|
|
23
|
+
gas: "gas";
|
|
24
|
+
ui: "ui";
|
|
25
|
+
common: "common";
|
|
26
|
+
}>>;
|
|
27
|
+
logLevel: z.ZodDefault<z.ZodEnum<{
|
|
28
|
+
info: "info";
|
|
29
|
+
debug: "debug";
|
|
30
|
+
silent: "silent";
|
|
31
|
+
}>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
/**
|
|
34
|
+
* Fully-resolved, runtime-valid plugin options.
|
|
35
|
+
*
|
|
36
|
+
* Notes:
|
|
37
|
+
* - All fields are guaranteed to be present
|
|
38
|
+
* - Defaults have already been applied
|
|
39
|
+
* - This type should be used internally by the plugin
|
|
40
|
+
*/
|
|
41
|
+
export type GASDemodulifyOptions = z.infer<typeof DemodulifyOptionsSchema>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DemodulifyOptionsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Public configuration options for GASDemodulifyPlugin.
|
|
7
|
+
*
|
|
8
|
+
* These options are supplied by the consumer when constructing the plugin
|
|
9
|
+
* instance in `webpack.config.js`.
|
|
10
|
+
*
|
|
11
|
+
* They control:
|
|
12
|
+
* - how emitted symbols are namespaced
|
|
13
|
+
* - which logical subsystem is being built
|
|
14
|
+
* - which artifacts are emitted
|
|
15
|
+
* - how much diagnostic output is produced
|
|
16
|
+
*
|
|
17
|
+
* This schema is the single source of truth for:
|
|
18
|
+
* - runtime validation
|
|
19
|
+
* - defaulting behavior
|
|
20
|
+
* - TypeScript type inference
|
|
21
|
+
*/
|
|
22
|
+
exports.DemodulifyOptionsSchema = zod_1.z.object({
|
|
23
|
+
/**
|
|
24
|
+
* The root global namespace under which all generated symbols are attached.
|
|
25
|
+
*
|
|
26
|
+
* Example:
|
|
27
|
+
* namespaceRoot: "MYADDON"
|
|
28
|
+
*
|
|
29
|
+
* This value becomes the first segment of every emitted namespace path.
|
|
30
|
+
*/
|
|
31
|
+
namespaceRoot: zod_1.z.string().min(1, "namespaceRoot must be a non-empty string").default("DEFAULT"),
|
|
32
|
+
/**
|
|
33
|
+
* Logical subsystem name.
|
|
34
|
+
*
|
|
35
|
+
* Examples:
|
|
36
|
+
* - "GAS"
|
|
37
|
+
* - "UI"
|
|
38
|
+
* - "COMMON"
|
|
39
|
+
*
|
|
40
|
+
* Combined with `namespaceRoot`, this produces the final namespace
|
|
41
|
+
* used for symbol attachment (e.g. "DEFAULT.GAS").
|
|
42
|
+
*/
|
|
43
|
+
subsystem: zod_1.z.string().min(1, "subsystem must be a non-empty string").default("DEFAULT"),
|
|
44
|
+
/**
|
|
45
|
+
* Controls which artifacts are emitted by the plugin.
|
|
46
|
+
*
|
|
47
|
+
* - "gas" → emit `.gs` only
|
|
48
|
+
* - "ui" → emit `.html` only
|
|
49
|
+
* - "common" → emit both `.gs` and `.html`
|
|
50
|
+
*
|
|
51
|
+
* NOTE:
|
|
52
|
+
* The current implementation wires this option through the plugin API,
|
|
53
|
+
* but artifact branching logic is handled elsewhere.
|
|
54
|
+
*/
|
|
55
|
+
buildMode: zod_1.z.enum(["gas", "ui", "common"]).default("gas"),
|
|
56
|
+
/**
|
|
57
|
+
* Optional logging verbosity.
|
|
58
|
+
*
|
|
59
|
+
* - "silent" → no output
|
|
60
|
+
* - "info" → high-level lifecycle messages
|
|
61
|
+
* - "debug" → detailed internal diagnostics
|
|
62
|
+
*
|
|
63
|
+
* If omitted, logging defaults to "info".
|
|
64
|
+
*/
|
|
65
|
+
logLevel: zod_1.z.enum(["silent", "info", "debug"]).default("info"),
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=options.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.schema.js","sourceRoot":"","sources":["../../../src/plugin/plugin-configuration-options/options.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C;;;;;;;OAOG;IACH,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,0CAA0C,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAE/F;;;;;;;;;;OAUG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sCAAsC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAEvF;;;;;;;;;;OAUG;IACH,SAAS,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAEzD;;;;;;;;OAQG;IACH,QAAQ,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;CAChE,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GASDemodulifyOptions } from "./options.schema";
|
|
2
|
+
/**
|
|
3
|
+
* Parse, validate, and normalize (i.e., apply defaults where field is missing) the user-supplied plugin options.
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateAndNormalizePluginOptions(input?: unknown): GASDemodulifyOptions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAndNormalizePluginOptions = validateAndNormalizePluginOptions;
|
|
4
|
+
const options_schema_1 = require("./options.schema");
|
|
5
|
+
/**
|
|
6
|
+
* Parse, validate, and normalize (i.e., apply defaults where field is missing) the user-supplied plugin options.
|
|
7
|
+
*/
|
|
8
|
+
function validateAndNormalizePluginOptions(input) {
|
|
9
|
+
// If caller passes nothing, we still want schema defaults to apply.
|
|
10
|
+
return options_schema_1.DemodulifyOptionsSchema.parse(input ?? {});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=validateAndNormalizePluginOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateAndNormalizePluginOptions.js","sourceRoot":"","sources":["../../../src/plugin/plugin-configuration-options/validateAndNormalizePluginOptions.ts"],"names":[],"mappings":";;AAKA,8EAGC;AARD,qDAAiF;AAEjF;;GAEG;AACH,SAAgB,iCAAiC,CAAC,KAAe;IAC7D,oEAAoE;IACpE,OAAO,wCAAuB,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@datalackey/gas-demodulify-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Webpack plugin: emits GAS-safe JavaScript with modules flattened & mapped to hierarchical namespaces",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"lint": "eslint 'src/**/*.ts'",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"check": "npm run lint && npm run typecheck",
|
|
15
|
+
"compile": "npx nx run gas-demodulify:compile",
|
|
16
|
+
"format": "prettier --write . --log-level warn",
|
|
17
|
+
"format:check": "prettier --check .",
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"docs:toc:update": "update-markdown-toc --recursive .",
|
|
20
|
+
"docs:toc:check": "update-markdown-toc --check --recursive .",
|
|
21
|
+
"build": "rm -rf dist && npm run lint && npm run format && npm run docs:toc:update && npm run compile && npm run test",
|
|
22
|
+
"package:release": "nx run gas-demodulify:release"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"webpack": "^5.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@datalackey/update-markdown-toc": "^1.0.4",
|
|
29
|
+
"@nx/eslint": "^22.5.0",
|
|
30
|
+
"@nx/jest": "^22.5.0",
|
|
31
|
+
"@nx/js": "^22.5.0",
|
|
32
|
+
"@types/jest": "^30.0.0",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
|
34
|
+
"@typescript-eslint/parser": "^8.53.1",
|
|
35
|
+
"eslint": "^8.57.1",
|
|
36
|
+
"jest": "^29.7.0",
|
|
37
|
+
"nx": "^22.5.0",
|
|
38
|
+
"outdent": "^0.8.0",
|
|
39
|
+
"prettier": "^3.8.1",
|
|
40
|
+
"strip-comments": "^2.0.1",
|
|
41
|
+
"ts-dedent": "^2.2.0",
|
|
42
|
+
"ts-jest": "^29.4.6",
|
|
43
|
+
"ts-loader": "^9.0.0",
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"webpack": "^5.0.0",
|
|
46
|
+
"webpack-cli": "^5.0.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"zod": "^4.3.5"
|
|
50
|
+
}
|
|
51
|
+
}
|