@signaltree/callable-syntax 4.0.16 → 4.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 CHANGED
@@ -44,11 +44,11 @@ npm install -D @signaltree/callable-syntax
44
44
  ```
45
45
 
46
46
  ```javascript
47
- // webpack.extra.js
48
- const { SignalTreeWebpackPlugin } = require('@signaltree/callable-syntax/webpack');
47
+ // webpack.extra.mjs
48
+ import { SignalTreeSyntaxWebpackPlugin } from '@signaltree/callable-syntax/webpack';
49
49
 
50
- module.exports = {
51
- plugins: [new SignalTreeWebpackPlugin()],
50
+ export default {
51
+ plugins: [new SignalTreeSyntaxWebpackPlugin()],
52
52
  };
53
53
  ```
54
54
 
@@ -64,44 +64,6 @@ export default defineConfig({
64
64
  });
65
65
  ```
66
66
 
67
- ### Webpack
68
-
69
- ````ts
70
- #### Webpack (Manual Setup)
71
-
72
- ```javascript
73
- // webpack.config.js
74
- const { SignalTreeTransform } = require('@signaltree/callable-syntax/transform');
75
-
76
- module.exports = {
77
- module: {
78
- rules: [
79
- {
80
- test: /\.tsx?$/,
81
- use: [
82
- 'ts-loader',
83
- {
84
- loader: 'babel-loader',
85
- options: {
86
- plugins: [SignalTreeTransform]
87
- }
88
- }
89
- ]
90
- }
91
- ]
92
- }
93
- };
94
- ````
95
-
96
- #### Babel Configuration
97
-
98
- ```json
99
- // .babelrc or babel.config.json
100
- {
101
- "plugins": ["@signaltree/callable-syntax/babel-plugin"]
102
- }
103
- ```
104
-
105
67
  ### Development Workflow
106
68
 
107
69
  The transform only affects build output - your TypeScript will still type-check correctly with callable syntax because SignalTree includes the necessary type augmentations.
@@ -155,3 +117,7 @@ No per-file imports required in this repo. Types are loaded via root `tsconfig`:
155
117
 
156
118
  Business Source License 1.1 (BSL-1.1) – converts to MIT on Change Date per root project license.
157
119
  ```
120
+
121
+ ```
122
+
123
+ ```
@@ -0,0 +1 @@
1
+ export * from "./src/augmentation";
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { DEFAULT_ROOT_IDENTIFIERS, transformCode } from './lib/ast-transform.js';
2
+ export { signalTreeSyntaxTransform } from './lib/vite-plugin.js';
3
+ export { SignalTreeSyntaxWebpackPlugin } from './lib/webpack-plugin.js';
@@ -0,0 +1,74 @@
1
+ import generate from '@babel/generator';
2
+ import { parse } from '@babel/parser';
3
+ import traverse from '@babel/traverse';
4
+ import * as t from '@babel/types';
5
+
6
+ const DEFAULT_ROOT_IDENTIFIERS = ['tree'];
7
+ function transformCode(source, options = {}) {
8
+ var _a;
9
+ const rootIds = ((_a = options.rootIdentifiers) === null || _a === void 0 ? void 0 : _a.length) ? options.rootIdentifiers : DEFAULT_ROOT_IDENTIFIERS;
10
+ const ast = parseSourceCode(source);
11
+ let transformCount = 0;
12
+ traverse(ast, {
13
+ CallExpression(path) {
14
+ const {
15
+ node
16
+ } = path;
17
+ if (!t.isCallExpression(node)) return;
18
+ if (shouldTransformCallExpression(node, rootIds)) {
19
+ const transformedCall = createTransformedCall(node);
20
+ path.replaceWith(transformedCall);
21
+ transformCount++;
22
+ }
23
+ }
24
+ });
25
+ const output = generate(ast, {
26
+ retainLines: false,
27
+ comments: true
28
+ }, source);
29
+ if (options.debug && transformCount > 0) {
30
+ console.log(`[signaltree callable-syntax] transformed ${transformCount} calls`);
31
+ }
32
+ return {
33
+ code: output.code,
34
+ transformed: transformCount
35
+ };
36
+ }
37
+ function parseSourceCode(source) {
38
+ return parse(source, {
39
+ sourceType: 'module',
40
+ plugins: ['typescript', 'jsx']
41
+ });
42
+ }
43
+ function shouldTransformCallExpression(node, rootIds) {
44
+ if (!t.isMemberExpression(node.callee)) return false;
45
+ if (node.arguments.length === 0) return false;
46
+ if (isAlreadyTransformed(node.callee)) return false;
47
+ return isRootedSignalAccess(node.callee, rootIds);
48
+ }
49
+ function isAlreadyTransformed(callee) {
50
+ return t.isIdentifier(callee.property) && (callee.property.name === 'set' || callee.property.name === 'update');
51
+ }
52
+ function createTransformedCall(node) {
53
+ const callee = node.callee;
54
+ const method = determineMethod(node.arguments[0]);
55
+ return t.callExpression(t.memberExpression(callee, t.identifier(method)), node.arguments);
56
+ }
57
+ function determineMethod(firstArg) {
58
+ if (t.isFunctionExpression(firstArg) || t.isArrowFunctionExpression(firstArg)) {
59
+ return 'update';
60
+ }
61
+ return 'set';
62
+ }
63
+ function isRootedSignalAccess(expr, roots) {
64
+ let current = expr;
65
+ while (t.isMemberExpression(current)) {
66
+ if (t.isIdentifier(current.object)) {
67
+ return roots.includes(current.object.name);
68
+ }
69
+ current = current.object;
70
+ }
71
+ return false;
72
+ }
73
+
74
+ export { DEFAULT_ROOT_IDENTIFIERS, transformCode };
@@ -0,0 +1 @@
1
+ export * from "./src/lib/vite-plugin";
@@ -0,0 +1,25 @@
1
+ import { transformCode } from './ast-transform.js';
2
+
3
+ function signalTreeSyntaxTransform(options = {}) {
4
+ var _a, _b;
5
+ const include = (_a = options.include) !== null && _a !== void 0 ? _a : /src\/.*\.(t|j)sx?$/;
6
+ const exclude = (_b = options.exclude) !== null && _b !== void 0 ? _b : /node_modules|\.spec\.|\.test\./;
7
+ return {
8
+ name: 'signaltree-callable-syntax',
9
+ enforce: 'pre',
10
+ transform(code, id) {
11
+ if (!include.test(id) || exclude.test(id)) return null;
12
+ const result = transformCode(code, {
13
+ rootIdentifiers: options.rootIdentifiers,
14
+ debug: options.debug
15
+ });
16
+ if (result.transformed === 0) return null;
17
+ return {
18
+ code: result.code,
19
+ map: null
20
+ };
21
+ }
22
+ };
23
+ }
24
+
25
+ export { signalTreeSyntaxTransform };
@@ -0,0 +1 @@
1
+ export * from "./src/lib/webpack-plugin";
@@ -0,0 +1,44 @@
1
+ import { transformCode } from './ast-transform.js';
2
+
3
+ class SignalTreeSyntaxWebpackPlugin {
4
+ constructor(options = {}) {
5
+ this.options = options;
6
+ }
7
+ apply(compiler) {
8
+ var _a, _b;
9
+ const test = (_a = this.options.test) !== null && _a !== void 0 ? _a : /src\/.*\.(t|j)sx?$/;
10
+ const exclude = (_b = this.options.exclude) !== null && _b !== void 0 ? _b : /node_modules|\.spec\.|\.test\./;
11
+ compiler.hooks.emit.tapAsync('SignalTreeSyntaxWebpackPlugin', (compilation, cb) => {
12
+ for (const filename of Object.keys(compilation.assets)) {
13
+ if (!test.test(filename) || exclude.test(filename)) continue;
14
+ const asset = compilation.assets[filename];
15
+ const raw = asset.source();
16
+ let source;
17
+ if (typeof raw === 'string') {
18
+ source = raw;
19
+ } else if (Buffer.isBuffer(raw)) {
20
+ source = raw.toString('utf8');
21
+ } else {
22
+ source = String(raw);
23
+ }
24
+ const {
25
+ code,
26
+ transformed
27
+ } = transformCode(source, {
28
+ rootIdentifiers: this.options.rootIdentifiers,
29
+ debug: this.options.debug
30
+ });
31
+ if (transformed > 0) {
32
+ const updated = code;
33
+ compilation.assets[filename] = {
34
+ source: () => updated,
35
+ size: () => Buffer.byteLength(updated, 'utf8')
36
+ };
37
+ }
38
+ }
39
+ cb();
40
+ });
41
+ }
42
+ }
43
+
44
+ export { SignalTreeSyntaxWebpackPlugin };
package/package.json CHANGED
@@ -1,37 +1,42 @@
1
1
  {
2
2
  "name": "@signaltree/callable-syntax",
3
- "version": "4.0.16",
3
+ "version": "4.1.0",
4
4
  "description": "Optional zero-runtime callable syntax transform for SignalTree unified leaf API.",
5
5
  "license": "BSL-1.1",
6
- "type": "commonjs",
7
- "main": "./src/index.js",
8
- "module": "./src/index.js",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
9
  "types": "./src/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./src/index.d.ts",
13
- "require": "./src/index.js",
14
- "import": "./src/index.js"
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
15
  },
16
16
  "./vite": {
17
17
  "types": "./src/lib/vite-plugin.d.ts",
18
- "require": "./src/lib/vite-plugin.js",
19
- "import": "./src/lib/vite-plugin.js"
18
+ "import": "./dist/lib/vite-plugin.js",
19
+ "default": "./dist/lib/vite-plugin.js"
20
20
  },
21
21
  "./webpack": {
22
22
  "types": "./src/lib/webpack-plugin.d.ts",
23
- "require": "./src/lib/webpack-plugin.js",
24
- "import": "./src/lib/webpack-plugin.js"
23
+ "import": "./dist/lib/webpack-plugin.js",
24
+ "default": "./dist/lib/webpack-plugin.js"
25
25
  },
26
26
  "./augmentation": {
27
27
  "types": "./src/augmentation.d.ts",
28
- "require": "./src/augmentation.js",
29
- "import": "./src/augmentation.js"
28
+ "import": "./dist/augmentation.js",
29
+ "default": "./dist/augmentation.js"
30
30
  }
31
31
  },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
32
35
  "files": [
36
+ "dist",
33
37
  "src",
34
- "packages/callable-syntax/README.md"
38
+ "README.md",
39
+ "package.json"
35
40
  ],
36
41
  "sideEffects": false,
37
42
  "dependencies": {
@@ -53,4 +58,4 @@
53
58
  "webpack": "^5.90.0",
54
59
  "@types/webpack": "^5.28.0"
55
60
  }
56
- }
61
+ }
@@ -1,9 +1 @@
1
- /**
2
- * TypeScript module augmentation for callable syntax support
3
- * Since NodeAccessor already has callable signatures, we just need to ensure
4
- * the types are properly imported and available.
5
- *
6
- * Note: The actual type import is commented out during build to avoid
7
- * resolution issues. Users will import '@signaltree/core' in their own code.
8
- */
9
1
  export {};
@@ -1,28 +1,10 @@
1
1
  export interface TransformOptions {
2
- /** Root variable names that contain SignalTree instances (default: ['tree']) */
3
2
  readonly rootIdentifiers?: string[];
4
- /** Enable debug logging for transformed calls */
5
3
  readonly debug?: boolean;
6
4
  }
7
5
  export interface TransformResult {
8
- /** The transformed code */
9
6
  code: string;
10
- /** Number of calls that were transformed */
11
7
  transformed: number;
12
8
  }
13
9
  export declare const DEFAULT_ROOT_IDENTIFIERS: string[];
14
- /**
15
- * Transforms SignalTree callable syntax to explicit .set/.update method calls
16
- *
17
- * @example
18
- * ```typescript
19
- * // Input:
20
- * tree.$.user.name('John');
21
- * tree.$.count(n => n + 1);
22
- *
23
- * // Output:
24
- * tree.$.user.name.set('John');
25
- * tree.$.count.update(n => n + 1);
26
- * ```
27
- */
28
10
  export declare function transformCode(source: string, options?: TransformOptions): TransformResult;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /**
3
- * TypeScript module augmentation for callable syntax support
4
- * Since NodeAccessor already has callable signatures, we just need to ensure
5
- * the types are properly imported and available.
6
- *
7
- * Note: The actual type import is commented out during build to avoid
8
- * resolution issues. Users will import '@signaltree/core' in their own code.
9
- */
10
- // import type {} from '@signaltree/core';
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- //# sourceMappingURL=augmentation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"augmentation.js","sourceRoot":"","sources":["../../../../packages/callable-syntax/src/augmentation.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AACH,0CAA0C"}
package/src/index.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./lib/ast-transform"), exports);
5
- tslib_1.__exportStar(require("./lib/vite-plugin"), exports);
6
- tslib_1.__exportStar(require("./lib/webpack-plugin"), exports);
7
- tslib_1.__exportStar(require("./augmentation"), exports);
8
- // Augmentation is exported behind a path; users can `import '@signaltree/callable-syntax/augmentation'` if desired.
9
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/callable-syntax/src/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,4DAAkC;AAClC,+DAAqC;AACrC,yDAA+B;AAC/B,oHAAoH"}
@@ -1,114 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_ROOT_IDENTIFIERS = void 0;
4
- exports.transformCode = transformCode;
5
- const tslib_1 = require("tslib");
6
- const generator_1 = tslib_1.__importDefault(require("@babel/generator"));
7
- const parser_1 = require("@babel/parser");
8
- const traverse_1 = tslib_1.__importDefault(require("@babel/traverse"));
9
- const t = tslib_1.__importStar(require("@babel/types"));
10
- exports.DEFAULT_ROOT_IDENTIFIERS = ['tree'];
11
- /**
12
- * Transforms SignalTree callable syntax to explicit .set/.update method calls
13
- *
14
- * @example
15
- * ```typescript
16
- * // Input:
17
- * tree.$.user.name('John');
18
- * tree.$.count(n => n + 1);
19
- *
20
- * // Output:
21
- * tree.$.user.name.set('John');
22
- * tree.$.count.update(n => n + 1);
23
- * ```
24
- */
25
- function transformCode(source, options = {}) {
26
- var _a;
27
- const rootIds = ((_a = options.rootIdentifiers) === null || _a === void 0 ? void 0 : _a.length)
28
- ? options.rootIdentifiers
29
- : exports.DEFAULT_ROOT_IDENTIFIERS;
30
- const ast = parseSourceCode(source);
31
- let transformCount = 0;
32
- (0, traverse_1.default)(ast, {
33
- CallExpression(path) {
34
- const { node } = path;
35
- if (!t.isCallExpression(node))
36
- return;
37
- if (shouldTransformCallExpression(node, rootIds)) {
38
- const transformedCall = createTransformedCall(node);
39
- path.replaceWith(transformedCall);
40
- transformCount++;
41
- }
42
- },
43
- });
44
- const output = (0, generator_1.default)(ast, { retainLines: false, comments: true }, source);
45
- if (options.debug && transformCount > 0) {
46
- console.log(`[signaltree callable-syntax] transformed ${transformCount} calls`);
47
- }
48
- return { code: output.code, transformed: transformCount };
49
- }
50
- /**
51
- * Parses TypeScript/JSX source code into an AST
52
- */
53
- function parseSourceCode(source) {
54
- return (0, parser_1.parse)(source, {
55
- sourceType: 'module',
56
- plugins: ['typescript', 'jsx'],
57
- });
58
- }
59
- /**
60
- * Determines if a call expression should be transformed
61
- */
62
- function shouldTransformCallExpression(node, rootIds) {
63
- // Must be a member expression call (e.g., obj.prop())
64
- if (!t.isMemberExpression(node.callee))
65
- return false;
66
- // Skip getter calls (no arguments)
67
- if (node.arguments.length === 0)
68
- return false;
69
- // Skip if already calling .set or .update
70
- if (isAlreadyTransformed(node.callee))
71
- return false;
72
- // Must be accessing a signal from one of the root identifiers
73
- return isRootedSignalAccess(node.callee, rootIds);
74
- }
75
- /**
76
- * Checks if the call is already transformed (.set or .update)
77
- */
78
- function isAlreadyTransformed(callee) {
79
- return (t.isIdentifier(callee.property) &&
80
- (callee.property.name === 'set' || callee.property.name === 'update'));
81
- }
82
- /**
83
- * Creates the transformed call expression with .set or .update
84
- */
85
- function createTransformedCall(node) {
86
- const callee = node.callee;
87
- const method = determineMethod(node.arguments[0]);
88
- return t.callExpression(t.memberExpression(callee, t.identifier(method)), node.arguments);
89
- }
90
- /**
91
- * Determines whether to use 'set' or 'update' based on the argument type
92
- */
93
- function determineMethod(firstArg) {
94
- if (t.isFunctionExpression(firstArg) ||
95
- t.isArrowFunctionExpression(firstArg)) {
96
- return 'update';
97
- }
98
- return 'set';
99
- }
100
- /**
101
- * Checks if the member expression ultimately accesses a signal from a root identifier
102
- */
103
- function isRootedSignalAccess(expr, roots) {
104
- let current = expr;
105
- // Traverse up the member expression chain to find the root identifier
106
- while (t.isMemberExpression(current)) {
107
- if (t.isIdentifier(current.object)) {
108
- return roots.includes(current.object.name);
109
- }
110
- current = current.object;
111
- }
112
- return false;
113
- }
114
- //# sourceMappingURL=ast-transform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ast-transform.js","sourceRoot":"","sources":["../../../../../packages/callable-syntax/src/lib/ast-transform.ts"],"names":[],"mappings":";;;AAmCA,sCAgCC;;AAnED,yEAAwC;AACxC,0CAAsC;AACtC,uEAAuC;AACvC,wDAAkC;AAgBrB,QAAA,wBAAwB,GAAG,CAAC,MAAM,CAAC,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,SAAgB,aAAa,CAC3B,MAAc,EACd,UAA4B,EAAE;;IAE9B,MAAM,OAAO,GAAG,CAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,MAAM;QAC7C,CAAC,CAAC,OAAO,CAAC,eAAe;QAC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EAAsE;IACtE,OAAO,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,MAAsB,CAAC;IAC3C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.syntaxTransform = void 0;
4
- // Deprecated placeholder kept to avoid breaking the initial test; actual exports moved.
5
- const syntaxTransform = () => 'callable-syntax';
6
- exports.syntaxTransform = syntaxTransform;
7
- //# sourceMappingURL=syntax-transform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syntax-transform.js","sourceRoot":"","sources":["../../../../../packages/callable-syntax/src/lib/syntax-transform.ts"],"names":[],"mappings":";;;AAAA,wFAAwF;AACjF,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC;AAA1C,QAAA,eAAe,mBAA2B"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.signalTreeSyntaxTransform = signalTreeSyntaxTransform;
4
- const ast_transform_1 = require("./ast-transform");
5
- function signalTreeSyntaxTransform(options = {}) {
6
- var _a, _b;
7
- const include = (_a = options.include) !== null && _a !== void 0 ? _a : /src\/.*\.(t|j)sx?$/;
8
- const exclude = (_b = options.exclude) !== null && _b !== void 0 ? _b : /node_modules|\.spec\.|\.test\./;
9
- return {
10
- name: 'signaltree-callable-syntax',
11
- enforce: 'pre',
12
- transform(code, id) {
13
- if (!include.test(id) || exclude.test(id))
14
- return null;
15
- const result = (0, ast_transform_1.transformCode)(code, {
16
- rootIdentifiers: options.rootIdentifiers,
17
- debug: options.debug,
18
- });
19
- if (result.transformed === 0)
20
- return null;
21
- return { code: result.code, map: null };
22
- },
23
- };
24
- }
25
- //# sourceMappingURL=vite-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-plugin.js","sourceRoot":"","sources":["../../../../../packages/callable-syntax/src/lib/vite-plugin.ts"],"names":[],"mappings":";;AAgBA,8DAmBC;AAnCD,mDAAgD;AAgBhD,SAAgB,yBAAyB,CACvC,UAAuC,EAAE;;IAEzC,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,oBAAoB,CAAC;IACxD,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,gCAAgC,CAAC;IAEpE,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,KAAK;QACd,SAAS,CAAC,IAAY,EAAE,EAAU;YAChC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAAE,OAAO,IAAI,CAAC;YACvD,MAAM,MAAM,GAAG,IAAA,6BAAa,EAAC,IAAI,EAAE;gBACjC,eAAe,EAAE,OAAO,CAAC,eAAe;gBACxC,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,WAAW,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SignalTreeSyntaxWebpackPlugin = void 0;
4
- const ast_transform_1 = require("./ast-transform");
5
- class SignalTreeSyntaxWebpackPlugin {
6
- constructor(options = {}) {
7
- this.options = options;
8
- }
9
- apply(compiler) {
10
- var _a, _b;
11
- const test = (_a = this.options.test) !== null && _a !== void 0 ? _a : /src\/.*\.(t|j)sx?$/;
12
- const exclude = (_b = this.options.exclude) !== null && _b !== void 0 ? _b : /node_modules|\.spec\.|\.test\./;
13
- compiler.hooks.emit.tapAsync('SignalTreeSyntaxWebpackPlugin', (compilation, cb) => {
14
- for (const filename of Object.keys(compilation.assets)) {
15
- if (!test.test(filename) || exclude.test(filename))
16
- continue;
17
- const asset = compilation.assets[filename];
18
- const raw = asset.source();
19
- // Handle different source types from webpack assets
20
- let source;
21
- if (typeof raw === 'string') {
22
- source = raw;
23
- }
24
- else if (Buffer.isBuffer(raw)) {
25
- source = raw.toString('utf8');
26
- }
27
- else {
28
- source = String(raw);
29
- }
30
- const { code, transformed } = (0, ast_transform_1.transformCode)(source, {
31
- rootIdentifiers: this.options.rootIdentifiers,
32
- debug: this.options.debug,
33
- });
34
- if (transformed > 0) {
35
- const updated = code;
36
- // Webpack 5 source compatibility minimal implementation
37
- compilation.assets[filename] = {
38
- source: () => updated,
39
- size: () => Buffer.byteLength(updated, 'utf8'),
40
- };
41
- }
42
- }
43
- cb();
44
- });
45
- }
46
- }
47
- exports.SignalTreeSyntaxWebpackPlugin = SignalTreeSyntaxWebpackPlugin;
48
- //# sourceMappingURL=webpack-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack-plugin.js","sourceRoot":"","sources":["../../../../../packages/callable-syntax/src/lib/webpack-plugin.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAwBhD,MAAa,6BAA6B;IACxC,YAA6B,UAA0C,EAAE;QAA5C,YAAO,GAAP,OAAO,CAAqC;IAAG,CAAC;IAE7E,KAAK,CAAC,QAAsB;;QAC1B,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,IAAI,mCAAI,oBAAoB,CAAC;QACvD,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,OAAO,mCAAI,gCAAgC,CAAC;QAEzE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAC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