solid-optimizer 0.1.1 → 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.
@@ -1,16 +1,23 @@
1
1
  // src/index.ts
2
- import * as t2 from "@babel/types";
2
+ import * as t from "@babel/types";
3
3
 
4
4
  // src/unwrap-node.ts
5
- import * as t from "@babel/types";
6
5
  function unwrapNode(node, key) {
7
6
  if (key(node)) {
8
7
  return node;
9
8
  }
10
- if (t.isParenthesizedExpression(node) || t.isTypeCastExpression(node) || t.isTSAsExpression(node) || t.isTSSatisfiesExpression(node) || t.isTSNonNullExpression(node) || t.isTSTypeAssertion(node) || t.isTSInstantiationExpression(node)) {
11
- return unwrapNode(node.expression, key);
9
+ switch (node.type) {
10
+ case "ParenthesizedExpression":
11
+ case "TypeCastExpression":
12
+ case "TSAsExpression":
13
+ case "TSSatisfiesExpression":
14
+ case "TSNonNullExpression":
15
+ case "TSTypeAssertion":
16
+ case "TSInstantiationExpression":
17
+ return unwrapNode(node.expression, key);
18
+ default:
19
+ return void 0;
12
20
  }
13
- return void 0;
14
21
  }
15
22
 
16
23
  // src/index.ts
@@ -36,23 +43,24 @@ var TRACKED = {
36
43
  };
37
44
  var MODULES = new Set(Object.keys(TRACKED));
38
45
  function isValidSpecifier(specifier, name) {
39
- return t2.isIdentifier(specifier.imported) && specifier.imported.name === name || t2.isStringLiteral(specifier.imported) && specifier.imported.value === name;
46
+ return t.isIdentifier(specifier.imported) && specifier.imported.name === name || t.isStringLiteral(specifier.imported) && specifier.imported.value === name;
40
47
  }
41
48
  function extractImportIdentifiers(ctx, path) {
42
- if (MODULES.has(path.node.source.value)) {
43
- const modulePath = path.node.source.value;
44
- for (let i = 0, len = path.node.specifiers.length; i < len; i += 1) {
45
- const specifier = path.node.specifiers[i];
46
- if (t2.isImportSpecifier(specifier)) {
47
- const ids = TRACKED[modulePath];
48
- for (const key of Object.keys(ids)) {
49
- if (isValidSpecifier(specifier, key)) {
50
- ctx.identifiers[modulePath][key].add(specifier.local);
51
- }
49
+ if (!MODULES.has(path.node.source.value)) {
50
+ return;
51
+ }
52
+ const modulePath = path.node.source.value;
53
+ for (let i = 0, len = path.node.specifiers.length; i < len; i += 1) {
54
+ const specifier = path.node.specifiers[i];
55
+ if (t.isImportSpecifier(specifier)) {
56
+ const ids = TRACKED[modulePath];
57
+ for (const key of Object.keys(ids)) {
58
+ if (isValidSpecifier(specifier, key)) {
59
+ ctx.identifiers[modulePath][key].add(specifier.local);
52
60
  }
53
- } else if (t2.isImportNamespaceSpecifier(specifier)) {
54
- ctx.namespaces[modulePath].add(specifier.local);
55
61
  }
62
+ } else if (t.isImportNamespaceSpecifier(specifier)) {
63
+ ctx.namespaces[modulePath].add(specifier.local);
56
64
  }
57
65
  }
58
66
  }
@@ -83,32 +91,28 @@ function transformOnMount(path) {
83
91
  path.remove();
84
92
  }
85
93
  function transformGetListener(path) {
86
- path.replaceWith(t2.nullLiteral());
94
+ path.replaceWith(t.nullLiteral());
87
95
  }
88
96
  function transformBatch(path) {
89
97
  const arg = path.node.arguments[0];
90
- if (t2.isExpression(arg)) {
91
- const trueArrow = unwrapNode(arg, t2.isArrowFunctionExpression);
98
+ if (t.isExpression(arg)) {
99
+ const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);
92
100
  if (trueArrow) {
93
- if (t2.isExpression(trueArrow.body)) {
101
+ if (t.isExpression(trueArrow.body)) {
94
102
  path.replaceWith(trueArrow.body);
95
103
  } else {
96
- path.replaceWith(t2.callExpression(trueArrow, []));
104
+ path.replaceWith(t.callExpression(trueArrow, []));
97
105
  }
98
106
  return;
99
107
  }
100
- const trueFunc = unwrapNode(arg, t2.isFunctionExpression);
108
+ const trueFunc = unwrapNode(arg, t.isFunctionExpression);
101
109
  if (trueFunc) {
102
110
  path.replaceWith(trueFunc.body);
103
111
  }
104
- } else if (t2.isSpreadElement(arg)) {
112
+ } else if (t.isSpreadElement(arg)) {
105
113
  path.replaceWith(
106
- t2.callExpression(
107
- t2.memberExpression(
108
- arg.argument,
109
- t2.numericLiteral(0),
110
- true
111
- ),
114
+ t.callExpression(
115
+ t.memberExpression(arg.argument, t.numericLiteral(0), true),
112
116
  []
113
117
  )
114
118
  );
@@ -116,28 +120,24 @@ function transformBatch(path) {
116
120
  }
117
121
  function transformUntrack(path) {
118
122
  const arg = path.node.arguments[0];
119
- if (t2.isExpression(arg)) {
120
- const trueArrow = unwrapNode(arg, t2.isArrowFunctionExpression);
123
+ if (t.isExpression(arg)) {
124
+ const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);
121
125
  if (trueArrow) {
122
- if (t2.isExpression(trueArrow.body)) {
126
+ if (t.isExpression(trueArrow.body)) {
123
127
  path.replaceWith(trueArrow.body);
124
128
  } else {
125
- path.replaceWith(t2.callExpression(trueArrow, []));
129
+ path.replaceWith(t.callExpression(trueArrow, []));
126
130
  }
127
131
  return;
128
132
  }
129
- const trueFunc = unwrapNode(arg, t2.isFunctionExpression);
133
+ const trueFunc = unwrapNode(arg, t.isFunctionExpression);
130
134
  if (trueFunc) {
131
135
  path.replaceWith(trueFunc.body);
132
136
  }
133
- } else if (t2.isSpreadElement(arg)) {
137
+ } else if (t.isSpreadElement(arg)) {
134
138
  path.replaceWith(
135
- t2.callExpression(
136
- t2.memberExpression(
137
- arg.argument,
138
- t2.numericLiteral(0),
139
- true
140
- ),
139
+ t.callExpression(
140
+ t.memberExpression(arg.argument, t.numericLiteral(0), true),
141
141
  []
142
142
  )
143
143
  );
@@ -145,28 +145,24 @@ function transformUntrack(path) {
145
145
  }
146
146
  function transformStartTransition(path) {
147
147
  const arg = path.node.arguments[0];
148
- if (t2.isExpression(arg)) {
149
- const trueArrow = unwrapNode(arg, t2.isArrowFunctionExpression);
148
+ if (t.isExpression(arg)) {
149
+ const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);
150
150
  if (trueArrow) {
151
- if (t2.isExpression(trueArrow.body)) {
151
+ if (t.isExpression(trueArrow.body)) {
152
152
  path.replaceWith(trueArrow.body);
153
153
  } else {
154
- path.replaceWith(t2.callExpression(trueArrow, []));
154
+ path.replaceWith(t.callExpression(trueArrow, []));
155
155
  }
156
156
  return;
157
157
  }
158
- const trueFunc = unwrapNode(arg, t2.isFunctionExpression);
158
+ const trueFunc = unwrapNode(arg, t.isFunctionExpression);
159
159
  if (trueFunc) {
160
160
  path.replaceWith(trueFunc.body);
161
161
  }
162
- } else if (t2.isSpreadElement(arg)) {
162
+ } else if (t.isSpreadElement(arg)) {
163
163
  path.replaceWith(
164
- t2.callExpression(
165
- t2.memberExpression(
166
- arg.argument,
167
- t2.numericLiteral(0),
168
- true
169
- ),
164
+ t.callExpression(
165
+ t.memberExpression(arg.argument, t.numericLiteral(0), true),
170
166
  []
171
167
  )
172
168
  );
@@ -174,104 +170,111 @@ function transformStartTransition(path) {
174
170
  }
175
171
  function transformCreateDeferred(path) {
176
172
  const arg = path.node.arguments[0];
177
- if (t2.isExpression(arg)) {
173
+ if (t.isExpression(arg)) {
178
174
  path.replaceWith(arg);
179
- } else if (t2.isSpreadElement(arg)) {
175
+ } else if (t.isSpreadElement(arg)) {
180
176
  path.replaceWith(
181
- t2.memberExpression(
182
- arg.argument,
183
- t2.numericLiteral(0),
184
- true
185
- )
177
+ t.memberExpression(arg.argument, t.numericLiteral(0), true)
186
178
  );
187
179
  }
188
180
  }
189
181
  function runTransform(path, targetName) {
190
182
  switch (targetName) {
191
- case "createEffect":
183
+ case "createEffect": {
192
184
  transformCreateEffect(path);
193
185
  break;
194
- case "onMount":
186
+ }
187
+ case "onMount": {
195
188
  transformOnMount(path);
196
189
  break;
197
- case "getListener":
190
+ }
191
+ case "getListener": {
198
192
  transformGetListener(path);
199
193
  break;
200
- case "untrack":
194
+ }
195
+ case "untrack": {
201
196
  transformUntrack(path);
202
197
  break;
203
- case "batch":
198
+ }
199
+ case "batch": {
204
200
  transformBatch(path);
205
201
  break;
206
- case "startTransition":
202
+ }
203
+ case "startTransition": {
207
204
  transformStartTransition(path);
208
205
  break;
209
- case "createDeferred":
206
+ }
207
+ case "createDeferred": {
210
208
  transformCreateDeferred(path);
211
209
  break;
212
- default:
213
- break;
210
+ }
211
+ }
212
+ }
213
+ function transformCallExpression(ctx, path) {
214
+ const trueIdentifier = unwrapNode(path.node.callee, t.isIdentifier);
215
+ if (trueIdentifier) {
216
+ const binding = path.scope.getBindingIdentifier(trueIdentifier.name);
217
+ if (binding) {
218
+ const targetName = checkValidIdentifierImport(ctx, binding);
219
+ if (targetName) {
220
+ runTransform(path, targetName);
221
+ }
222
+ }
223
+ return;
224
+ }
225
+ const trueMemberExpr = unwrapNode(path.node.callee, t.isMemberExpression);
226
+ if (trueMemberExpr && t.isIdentifier(trueMemberExpr.property) && !trueMemberExpr.computed) {
227
+ const source = unwrapNode(trueMemberExpr.object, t.isIdentifier);
228
+ if (source) {
229
+ const targetName = trueMemberExpr.property.name;
230
+ const binding = path.scope.getBindingIdentifier(source.name);
231
+ if (binding && checkValidNamespaceImport(ctx, binding, targetName)) {
232
+ runTransform(path, targetName);
233
+ }
234
+ }
214
235
  }
215
236
  }
216
237
  function solidOptimizerPlugin() {
217
238
  return {
218
239
  name: "solid-optimizer",
219
- pre() {
220
- this.ctx = {
221
- hooks: /* @__PURE__ */ new Map(),
222
- identifiers: {
223
- "solid-js": {
224
- createEffect: /* @__PURE__ */ new Set(),
225
- onMount: /* @__PURE__ */ new Set(),
226
- getListener: /* @__PURE__ */ new Set(),
227
- untrack: /* @__PURE__ */ new Set(),
228
- batch: /* @__PURE__ */ new Set(),
229
- startTransition: /* @__PURE__ */ new Set(),
230
- createDeferred: /* @__PURE__ */ new Set()
231
- },
232
- "solid-js/web": {
233
- createEffect: /* @__PURE__ */ new Set(),
234
- onMount: /* @__PURE__ */ new Set(),
235
- getListener: /* @__PURE__ */ new Set(),
236
- untrack: /* @__PURE__ */ new Set(),
237
- batch: /* @__PURE__ */ new Set(),
238
- startTransition: /* @__PURE__ */ new Set(),
239
- createDeferred: /* @__PURE__ */ new Set()
240
- }
241
- },
242
- namespaces: {
243
- "solid-js": /* @__PURE__ */ new Set(),
244
- "solid-js/web": /* @__PURE__ */ new Set()
245
- }
246
- };
247
- },
248
240
  visitor: {
249
- ImportDeclaration(path, state) {
250
- extractImportIdentifiers(state.ctx, path);
251
- },
252
- CallExpression(path, state) {
253
- const trueIdentifier = unwrapNode(path.node.callee, t2.isIdentifier);
254
- if (trueIdentifier) {
255
- const binding = path.scope.getBindingIdentifier(trueIdentifier.name);
256
- if (binding) {
257
- const targetName = checkValidIdentifierImport(state.ctx, binding);
258
- if (targetName) {
259
- runTransform(path, targetName);
241
+ Program(program) {
242
+ const ctx = {
243
+ identifiers: {
244
+ "solid-js": {
245
+ createEffect: /* @__PURE__ */ new Set(),
246
+ onMount: /* @__PURE__ */ new Set(),
247
+ getListener: /* @__PURE__ */ new Set(),
248
+ untrack: /* @__PURE__ */ new Set(),
249
+ batch: /* @__PURE__ */ new Set(),
250
+ startTransition: /* @__PURE__ */ new Set(),
251
+ createDeferred: /* @__PURE__ */ new Set()
252
+ },
253
+ "solid-js/web": {
254
+ createEffect: /* @__PURE__ */ new Set(),
255
+ onMount: /* @__PURE__ */ new Set(),
256
+ getListener: /* @__PURE__ */ new Set(),
257
+ untrack: /* @__PURE__ */ new Set(),
258
+ batch: /* @__PURE__ */ new Set(),
259
+ startTransition: /* @__PURE__ */ new Set(),
260
+ createDeferred: /* @__PURE__ */ new Set()
260
261
  }
262
+ },
263
+ namespaces: {
264
+ "solid-js": /* @__PURE__ */ new Set(),
265
+ "solid-js/web": /* @__PURE__ */ new Set()
261
266
  }
262
- return;
263
- }
264
- const trueMemberExpr = unwrapNode(path.node.callee, t2.isMemberExpression);
265
- if (trueMemberExpr && t2.isIdentifier(trueMemberExpr.property) && !trueMemberExpr.computed) {
266
- const source = unwrapNode(trueMemberExpr.object, t2.isIdentifier);
267
- if (source) {
268
- const targetName = trueMemberExpr.property.name;
269
- const binding = path.scope.getBindingIdentifier(source.name);
270
- if (binding && checkValidNamespaceImport(state.ctx, binding, targetName)) {
271
- runTransform(path, targetName);
272
- }
267
+ };
268
+ program.traverse({
269
+ ImportDeclaration(path) {
270
+ extractImportIdentifiers(ctx, path);
273
271
  }
274
- }
272
+ });
273
+ program.traverse({
274
+ CallExpression(path) {
275
+ transformCallExpression(ctx, path);
276
+ }
277
+ });
275
278
  }
276
279
  }
277
280
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts", "../../../src/unwrap-node.ts"],
4
- "sourcesContent": ["import { NodePath, PluginObj, PluginPass } from '@babel/core';\nimport * as t from '@babel/types';\nimport unwrapNode from './unwrap-node';\n\nconst TRACKED: Record<string, Record<string, boolean>> = {\n 'solid-js': {\n createEffect: true,\n onMount: true,\n getListener: true,\n untrack: true,\n batch: true,\n startTransition: true,\n createDeferred: true,\n },\n 'solid-js/web': {\n createEffect: true,\n onMount: true,\n getListener: true,\n untrack: true,\n batch: true,\n startTransition: true,\n createDeferred: true,\n },\n};\n\nconst MODULES = new Set(Object.keys(TRACKED));\n\ninterface StateContext {\n hooks: Map<string, t.Identifier>;\n identifiers: Record<string, Record<string, Set<t.Identifier>>>;\n namespaces: Record<string, Set<t.Identifier>>;\n}\n\nfunction isValidSpecifier(\n specifier: t.ImportSpecifier,\n name: string,\n): boolean {\n return (\n (t.isIdentifier(specifier.imported) && specifier.imported.name === name)\n || (t.isStringLiteral(specifier.imported) && specifier.imported.value === name)\n );\n}\n\nfunction extractImportIdentifiers(\n ctx: StateContext,\n path: NodePath<t.ImportDeclaration>,\n) {\n if (MODULES.has(path.node.source.value)) {\n const modulePath = path.node.source.value;\n for (let i = 0, len = path.node.specifiers.length; i < len; i += 1) {\n const specifier = path.node.specifiers[i];\n if (t.isImportSpecifier(specifier)) {\n const ids = TRACKED[modulePath];\n\n for (const key of Object.keys(ids)) {\n if (isValidSpecifier(specifier, key)) {\n ctx.identifiers[modulePath][key].add(specifier.local);\n }\n }\n } else if (t.isImportNamespaceSpecifier(specifier)) {\n ctx.namespaces[modulePath].add(specifier.local);\n }\n }\n }\n}\n\nfunction checkValidIdentifierImport(\n ctx: StateContext,\n identifier: t.Identifier,\n) {\n for (const mod of MODULES) {\n const identifiers = ctx.identifiers[mod];\n for (const key of Object.keys(identifiers)) {\n if (identifiers[key].has(identifier)) {\n return key;\n }\n }\n }\n return undefined;\n}\n\nfunction checkValidNamespaceImport(\n ctx: StateContext,\n object: t.Identifier,\n property: string,\n) {\n for (const mod of MODULES) {\n const namespace = ctx.namespaces[mod];\n if (namespace.has(object) && property in TRACKED[mod]) {\n return true;\n }\n }\n return false;\n}\n\nfunction transformCreateEffect(\n path: NodePath<t.CallExpression>,\n) {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L78\n // Just remove it\n path.remove();\n}\n\nfunction transformOnMount(\n path: NodePath<t.CallExpression>,\n) {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L131\n // Just remove it\n path.remove();\n}\n\nfunction transformGetListener(\n path: NodePath<t.CallExpression>,\n) {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L157\n path.replaceWith(t.nullLiteral());\n}\n\nfunction transformBatch(\n path: NodePath<t.CallExpression>,\n) {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L107\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);\n if (trueArrow) {\n if (t.isExpression(trueArrow.body)) {\n path.replaceWith(trueArrow.body);\n } else {\n path.replaceWith(t.callExpression(trueArrow, []));\n }\n return;\n }\n const trueFunc = unwrapNode(arg, t.isFunctionExpression);\n if (trueFunc) {\n path.replaceWith(trueFunc.body);\n }\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.callExpression(\n t.memberExpression(\n arg.argument,\n t.numericLiteral(0),\n true,\n ),\n [],\n ),\n );\n }\n}\n\nfunction transformUntrack(\n path: NodePath<t.CallExpression>,\n) {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L111\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);\n if (trueArrow) {\n if (t.isExpression(trueArrow.body)) {\n path.replaceWith(trueArrow.body);\n } else {\n path.replaceWith(t.callExpression(trueArrow, []));\n }\n return;\n }\n const trueFunc = unwrapNode(arg, t.isFunctionExpression);\n if (trueFunc) {\n path.replaceWith(trueFunc.body);\n }\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.callExpression(\n t.memberExpression(\n arg.argument,\n t.numericLiteral(0),\n true,\n ),\n [],\n ),\n );\n }\n}\n\nfunction transformStartTransition(\n path: NodePath<t.CallExpression>,\n) {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/rendering.ts#L488\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);\n if (trueArrow) {\n if (t.isExpression(trueArrow.body)) {\n path.replaceWith(trueArrow.body);\n } else {\n path.replaceWith(t.callExpression(trueArrow, []));\n }\n return;\n }\n const trueFunc = unwrapNode(arg, t.isFunctionExpression);\n if (trueFunc) {\n path.replaceWith(trueFunc.body);\n }\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.callExpression(\n t.memberExpression(\n arg.argument,\n t.numericLiteral(0),\n true,\n ),\n [],\n ),\n );\n }\n}\n\nfunction transformCreateDeferred(\n path: NodePath<t.CallExpression>,\n) {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L99\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n path.replaceWith(arg);\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.memberExpression(\n arg.argument,\n t.numericLiteral(0),\n true,\n ),\n );\n }\n}\n\ninterface State extends PluginPass {\n ctx: StateContext;\n}\n\nfunction runTransform(path: NodePath<t.CallExpression>, targetName: string) {\n switch (targetName) {\n case 'createEffect':\n transformCreateEffect(path);\n break;\n case 'onMount':\n transformOnMount(path);\n break;\n case 'getListener':\n transformGetListener(path);\n break;\n case 'untrack':\n transformUntrack(path);\n break;\n case 'batch':\n transformBatch(path);\n break;\n case 'startTransition':\n transformStartTransition(path);\n break;\n case 'createDeferred':\n transformCreateDeferred(path);\n break;\n default:\n break;\n }\n}\n\nexport default function solidOptimizerPlugin(): PluginObj<State> {\n return {\n name: 'solid-optimizer',\n pre() {\n this.ctx = {\n hooks: new Map(),\n identifiers: {\n 'solid-js': {\n createEffect: new Set(),\n onMount: new Set(),\n getListener: new Set(),\n untrack: new Set(),\n batch: new Set(),\n startTransition: new Set(),\n createDeferred: new Set(),\n },\n 'solid-js/web': {\n createEffect: new Set(),\n onMount: new Set(),\n getListener: new Set(),\n untrack: new Set(),\n batch: new Set(),\n startTransition: new Set(),\n createDeferred: new Set(),\n },\n },\n namespaces: {\n 'solid-js': new Set(),\n 'solid-js/web': new Set(),\n },\n };\n },\n visitor: {\n ImportDeclaration(path, state) {\n extractImportIdentifiers(state.ctx, path);\n },\n CallExpression(path, state) {\n const trueIdentifier = unwrapNode(path.node.callee, t.isIdentifier);\n if (trueIdentifier) {\n const binding = path.scope.getBindingIdentifier(trueIdentifier.name);\n if (binding) {\n const targetName = checkValidIdentifierImport(state.ctx, binding);\n if (targetName) {\n runTransform(path, targetName);\n }\n }\n return;\n }\n const trueMemberExpr = unwrapNode(path.node.callee, t.isMemberExpression);\n if (\n trueMemberExpr\n && t.isIdentifier(trueMemberExpr.property)\n && !trueMemberExpr.computed\n ) {\n const source = unwrapNode(trueMemberExpr.object, t.isIdentifier);\n if (source) {\n const targetName = trueMemberExpr.property.name;\n const binding = path.scope.getBindingIdentifier(source.name);\n if (binding && checkValidNamespaceImport(state.ctx, binding, targetName)) {\n runTransform(path, targetName);\n }\n }\n }\n },\n },\n };\n}\n", "import * as t from '@babel/types';\n\ntype TypeCheck<K> =\n K extends (node: t.Node) => node is (infer U extends t.Node)\n ? U\n : never;\n\ntype TypeFilter = (node: t.Node) => boolean;\n\nexport default function unwrapNode<K extends TypeFilter>(\n node: t.Node,\n key: K,\n): TypeCheck<K> | undefined {\n if (key(node)) {\n return node as TypeCheck<K>;\n }\n if (\n t.isParenthesizedExpression(node)\n || t.isTypeCastExpression(node)\n || t.isTSAsExpression(node)\n || t.isTSSatisfiesExpression(node)\n || t.isTSNonNullExpression(node)\n || t.isTSTypeAssertion(node)\n || t.isTSInstantiationExpression(node)\n ) {\n return unwrapNode(node.expression, key);\n }\n return undefined;\n}\n"],
5
- "mappings": ";AACA,YAAYA,QAAO;;;ACDnB,YAAY,OAAO;AASJ,SAAR,WACL,MACA,KAC0B;AAC1B,MAAI,IAAI,IAAI,GAAG;AACb,WAAO;AAAA,EACT;AACA,MACI,4BAA0B,IAAI,KAC3B,uBAAqB,IAAI,KACzB,mBAAiB,IAAI,KACrB,0BAAwB,IAAI,KAC5B,wBAAsB,IAAI,KAC1B,oBAAkB,IAAI,KACtB,8BAA4B,IAAI,GACrC;AACA,WAAO,WAAW,KAAK,YAAY,GAAG;AAAA,EACxC;AACA,SAAO;AACT;;;ADxBA,IAAM,UAAmD;AAAA,EACvD,YAAY;AAAA,IACV,cAAc;AAAA,IACd,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,EAClB;AAAA,EACA,gBAAgB;AAAA,IACd,cAAc;AAAA,IACd,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,EAClB;AACF;AAEA,IAAM,UAAU,IAAI,IAAI,OAAO,KAAK,OAAO,CAAC;AAQ5C,SAAS,iBACP,WACA,MACS;AACT,SACK,gBAAa,UAAU,QAAQ,KAAK,UAAU,SAAS,SAAS,QAC7D,mBAAgB,UAAU,QAAQ,KAAK,UAAU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nB;AACA,gBAAM,SAAS,WAAW,eAAe,QAAU,eAAY;AAC/D,cAAI,QAAQ;AACV,kBAAM,aAAa,eAAe,SAAS;AAC3C,kBAAM,UAAU,KAAK,MAAM,qBAAqB,OAAO,IAAI;AAC3D,gBAAI,WAAW,0BAA0B,MAAM,KAAK,SAAS,UAAU,GAAG;AACxE,2BAAa,MAAM,UAAU;AAAA,YAC/B;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": ["t"]
4
+ "sourcesContent": ["import type { NodePath, PluginObj, PluginPass } from '@babel/core';\nimport * as t from '@babel/types';\nimport unwrapNode from './unwrap-node';\n\nconst TRACKED: Record<string, Record<string, boolean>> = {\n 'solid-js': {\n createEffect: true,\n onMount: true,\n getListener: true,\n untrack: true,\n batch: true,\n startTransition: true,\n createDeferred: true,\n },\n 'solid-js/web': {\n createEffect: true,\n onMount: true,\n getListener: true,\n untrack: true,\n batch: true,\n startTransition: true,\n createDeferred: true,\n },\n};\n\nconst MODULES = new Set(Object.keys(TRACKED));\n\ninterface StateContext {\n identifiers: Record<string, Record<string, Set<t.Identifier>>>;\n namespaces: Record<string, Set<t.Identifier>>;\n}\n\nfunction isValidSpecifier(specifier: t.ImportSpecifier, name: string): boolean {\n return (\n (t.isIdentifier(specifier.imported) && specifier.imported.name === name) ||\n (t.isStringLiteral(specifier.imported) && specifier.imported.value === name)\n );\n}\n\nfunction extractImportIdentifiers(\n ctx: StateContext,\n path: NodePath<t.ImportDeclaration>,\n): void {\n if (!MODULES.has(path.node.source.value)) {\n return;\n }\n const modulePath = path.node.source.value;\n for (let i = 0, len = path.node.specifiers.length; i < len; i += 1) {\n const specifier = path.node.specifiers[i];\n if (t.isImportSpecifier(specifier)) {\n const ids = TRACKED[modulePath];\n\n for (const key of Object.keys(ids)) {\n if (isValidSpecifier(specifier, key)) {\n ctx.identifiers[modulePath][key].add(specifier.local);\n }\n }\n } else if (t.isImportNamespaceSpecifier(specifier)) {\n ctx.namespaces[modulePath].add(specifier.local);\n }\n }\n}\n\nfunction checkValidIdentifierImport(\n ctx: StateContext,\n identifier: t.Identifier,\n): string | undefined {\n for (const mod of MODULES) {\n const identifiers = ctx.identifiers[mod];\n for (const key of Object.keys(identifiers)) {\n if (identifiers[key].has(identifier)) {\n return key;\n }\n }\n }\n return undefined;\n}\n\nfunction checkValidNamespaceImport(\n ctx: StateContext,\n object: t.Identifier,\n property: string,\n): boolean {\n for (const mod of MODULES) {\n const namespace = ctx.namespaces[mod];\n if (namespace.has(object) && property in TRACKED[mod]) {\n return true;\n }\n }\n return false;\n}\n\nfunction transformCreateEffect(path: NodePath<t.CallExpression>): void {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L78\n // Just remove it\n path.remove();\n}\n\nfunction transformOnMount(path: NodePath<t.CallExpression>): void {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L131\n // Just remove it\n path.remove();\n}\n\nfunction transformGetListener(path: NodePath<t.CallExpression>): void {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L157\n path.replaceWith(t.nullLiteral());\n}\n\nfunction transformBatch(path: NodePath<t.CallExpression>): void {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L107\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);\n if (trueArrow) {\n if (t.isExpression(trueArrow.body)) {\n path.replaceWith(trueArrow.body);\n } else {\n path.replaceWith(t.callExpression(trueArrow, []));\n }\n return;\n }\n const trueFunc = unwrapNode(arg, t.isFunctionExpression);\n if (trueFunc) {\n path.replaceWith(trueFunc.body);\n }\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.callExpression(\n t.memberExpression(arg.argument, t.numericLiteral(0), true),\n [],\n ),\n );\n }\n}\n\nfunction transformUntrack(path: NodePath<t.CallExpression>): void {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L111\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);\n if (trueArrow) {\n if (t.isExpression(trueArrow.body)) {\n path.replaceWith(trueArrow.body);\n } else {\n path.replaceWith(t.callExpression(trueArrow, []));\n }\n return;\n }\n const trueFunc = unwrapNode(arg, t.isFunctionExpression);\n if (trueFunc) {\n path.replaceWith(trueFunc.body);\n }\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.callExpression(\n t.memberExpression(arg.argument, t.numericLiteral(0), true),\n [],\n ),\n );\n }\n}\n\nfunction transformStartTransition(path: NodePath<t.CallExpression>): void {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/rendering.ts#L488\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n const trueArrow = unwrapNode(arg, t.isArrowFunctionExpression);\n if (trueArrow) {\n if (t.isExpression(trueArrow.body)) {\n path.replaceWith(trueArrow.body);\n } else {\n path.replaceWith(t.callExpression(trueArrow, []));\n }\n return;\n }\n const trueFunc = unwrapNode(arg, t.isFunctionExpression);\n if (trueFunc) {\n path.replaceWith(trueFunc.body);\n }\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.callExpression(\n t.memberExpression(arg.argument, t.numericLiteral(0), true),\n [],\n ),\n );\n }\n}\n\nfunction transformCreateDeferred(path: NodePath<t.CallExpression>): void {\n // https://github.com/solidjs/solid/blob/main/packages/solid/src/server/reactive.ts#L99\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n path.replaceWith(arg);\n } else if (t.isSpreadElement(arg)) {\n path.replaceWith(\n t.memberExpression(arg.argument, t.numericLiteral(0), true),\n );\n }\n}\n\ninterface State extends PluginPass {\n ctx: StateContext;\n}\n\nfunction runTransform(\n path: NodePath<t.CallExpression>,\n targetName: string,\n): void {\n switch (targetName) {\n case 'createEffect': {\n transformCreateEffect(path);\n break;\n }\n case 'onMount': {\n transformOnMount(path);\n break;\n }\n case 'getListener': {\n transformGetListener(path);\n break;\n }\n case 'untrack': {\n transformUntrack(path);\n break;\n }\n case 'batch': {\n transformBatch(path);\n break;\n }\n case 'startTransition': {\n transformStartTransition(path);\n break;\n }\n case 'createDeferred': {\n transformCreateDeferred(path);\n break;\n }\n }\n}\n\nfunction transformCallExpression(\n ctx: StateContext,\n path: NodePath<t.CallExpression>,\n): void {\n const trueIdentifier = unwrapNode(path.node.callee, t.isIdentifier);\n if (trueIdentifier) {\n const binding = path.scope.getBindingIdentifier(trueIdentifier.name);\n if (binding) {\n const targetName = checkValidIdentifierImport(ctx, binding);\n if (targetName) {\n runTransform(path, targetName);\n }\n }\n return;\n }\n const trueMemberExpr = unwrapNode(path.node.callee, t.isMemberExpression);\n if (\n trueMemberExpr &&\n t.isIdentifier(trueMemberExpr.property) &&\n !trueMemberExpr.computed\n ) {\n const source = unwrapNode(trueMemberExpr.object, t.isIdentifier);\n if (source) {\n const targetName = trueMemberExpr.property.name;\n const binding = path.scope.getBindingIdentifier(source.name);\n if (binding && checkValidNamespaceImport(ctx, binding, targetName)) {\n runTransform(path, targetName);\n }\n }\n }\n}\n\nexport default function solidOptimizerPlugin(): PluginObj<State> {\n return {\n name: 'solid-optimizer',\n visitor: {\n Program(program) {\n const ctx: StateContext = {\n identifiers: {\n 'solid-js': {\n createEffect: new Set(),\n onMount: new Set(),\n getListener: new Set(),\n untrack: new Set(),\n batch: new Set(),\n startTransition: new Set(),\n createDeferred: new Set(),\n },\n 'solid-js/web': {\n createEffect: new Set(),\n onMount: new Set(),\n getListener: new Set(),\n untrack: new Set(),\n batch: new Set(),\n startTransition: new Set(),\n createDeferred: new Set(),\n },\n },\n namespaces: {\n 'solid-js': new Set(),\n 'solid-js/web': new Set(),\n },\n };\n program.traverse({\n ImportDeclaration(path): void {\n extractImportIdentifiers(ctx, path);\n },\n });\n program.traverse({\n CallExpression(path): void {\n transformCallExpression(ctx, path);\n },\n });\n },\n },\n };\n}\n", "import type * as t from '@babel/types';\n\ntype BroadTypeFilter<K extends t.Node> = (node: t.Node) => node is K;\ntype TypeCheck<K> = K extends BroadTypeFilter<infer U> ? U : never;\n\ntype TypeFilter = (node: t.Node) => boolean;\n\nexport default function unwrapNode<K extends TypeFilter>(\n node: t.Node,\n key: K,\n): TypeCheck<K> | undefined {\n if (key(node)) {\n return node as TypeCheck<K>;\n }\n switch (node.type) {\n case 'ParenthesizedExpression':\n case 'TypeCastExpression':\n case 'TSAsExpression':\n case 'TSSatisfiesExpression':\n case 'TSNonNullExpression':\n case 'TSTypeAssertion':\n case 'TSInstantiationExpression':\n return unwrapNode(node.expression, key);\n default:\n return undefined;\n }\n}\n"],
5
+ "mappings": ";AACA,YAAY,OAAO;;;ACMJ,SAAR,WACL,MACA,KAC0B;AAC1B,MAAI,IAAI,IAAI,GAAG;AACb,WAAO;AAAA,EACT;AACA,UAAQ,KAAK,MAAM;AAAA,IACjB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,WAAW,KAAK,YAAY,GAAG;AAAA,IACxC;AACE,aAAO;AAAA,EACX;AACF;;;ADtBA,IAAM,UAAmD;AAAA,EACvD,YAAY;AAAA,IACV,cAAc;AAAA,IACd,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,EAClB;AAAA,EACA,gBAAgB;AAAA,IACd,cAAc;AAAA,IACd,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,EAClB;AACF;AAEA,IAAM,UAAU,IAAI,IAAI,OAAO,KAAK,OAAO,CAAC;AAO5C,SAAS,iBAAiB,WAA8B,MAAuB;AAC7E,SACK,eAAa,UAAU,QAAQ,KAAK,UAAU,SAAS,SAAS,QAChE,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AAAA,cACrB,SAAS,oBAAI,IAAI;AAAA,cACjB,OAAO,oBAAI,IAAI;AAAA,cACf,iBAAiB,oBAAI,IAAI;AAAA,cACzB,gBAAgB,oBAAI,IAAI;AAAA,YAC1B;AAAA,UACF;AAAA,UACA,YAAY;AAAA,YACV,YAAY,oBAAI,IAAI;AAAA,YACpB,gBAAgB,oBAAI,IAAI;AAAA,UAC1B;AAAA,QACF;AACA,gBAAQ,SAAS;AAAA,UACf,kBAAkB,MAAY;AAC5B,qCAAyB,KAAK,IAAI;AAAA,UACpC;AAAA,QACF,CAAC;AACD,gBAAQ,SAAS;AAAA,UACf,eAAe,MAAY;AACzB,oCAAwB,KAAK,IAAI;AAAA,UACnC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
7
  }
@@ -1 +1 @@
1
- import*as t from"@babel/types";import*as s from"@babel/types";function o(e,r){if(r(e))return e;if(s.isParenthesizedExpression(e)||s.isTypeCastExpression(e)||s.isTSAsExpression(e)||s.isTSSatisfiesExpression(e)||s.isTSNonNullExpression(e)||s.isTSTypeAssertion(e)||s.isTSInstantiationExpression(e))return o(e.expression,r)}var u={"solid-js":{createEffect:!0,onMount:!0,getListener:!0,untrack:!0,batch:!0,startTransition:!0,createDeferred:!0},"solid-js/web":{createEffect:!0,onMount:!0,getListener:!0,untrack:!0,batch:!0,startTransition:!0,createDeferred:!0}},l=new Set(Object.keys(u));function m(e,r){return t.isIdentifier(e.imported)&&e.imported.name===r||t.isStringLiteral(e.imported)&&e.imported.value===r}function x(e,r){if(l.has(r.node.source.value)){let n=r.node.source.value;for(let i=0,a=r.node.specifiers.length;i<a;i+=1){let c=r.node.specifiers[i];if(t.isImportSpecifier(c)){let f=u[n];for(let d of Object.keys(f))m(c,d)&&e.identifiers[n][d].add(c.local)}else t.isImportNamespaceSpecifier(c)&&e.namespaces[n].add(c.local)}}}function E(e,r){for(let n of l){let i=e.identifiers[n];for(let a of Object.keys(i))if(i[a].has(r))return a}}function S(e,r,n){for(let i of l)if(e.namespaces[i].has(r)&&n in u[i])return!0;return!1}function b(e){e.remove()}function g(e){e.remove()}function w(e){e.replaceWith(t.nullLiteral())}function k(e){let r=e.node.arguments[0];if(t.isExpression(r)){let n=o(r,t.isArrowFunctionExpression);if(n){t.isExpression(n.body)?e.replaceWith(n.body):e.replaceWith(t.callExpression(n,[]));return}let i=o(r,t.isFunctionExpression);i&&e.replaceWith(i.body)}else t.isSpreadElement(r)&&e.replaceWith(t.callExpression(t.memberExpression(r.argument,t.numericLiteral(0),!0),[]))}function y(e){let r=e.node.arguments[0];if(t.isExpression(r)){let n=o(r,t.isArrowFunctionExpression);if(n){t.isExpression(n.body)?e.replaceWith(n.body):e.replaceWith(t.callExpression(n,[]));return}let i=o(r,t.isFunctionExpression);i&&e.replaceWith(i.body)}else t.isSpreadElement(r)&&e.replaceWith(t.callExpression(t.memberExpression(r.argument,t.numericLiteral(0),!0),[]))}function I(e){let r=e.node.arguments[0];if(t.isExpression(r)){let n=o(r,t.isArrowFunctionExpression);if(n){t.isExpression(n.body)?e.replaceWith(n.body):e.replaceWith(t.callExpression(n,[]));return}let i=o(r,t.isFunctionExpression);i&&e.replaceWith(i.body)}else t.isSpreadElement(r)&&e.replaceWith(t.callExpression(t.memberExpression(r.argument,t.numericLiteral(0),!0),[]))}function N(e){let r=e.node.arguments[0];t.isExpression(r)?e.replaceWith(r):t.isSpreadElement(r)&&e.replaceWith(t.memberExpression(r.argument,t.numericLiteral(0),!0))}function p(e,r){switch(r){case"createEffect":b(e);break;case"onMount":g(e);break;case"getListener":w(e);break;case"untrack":y(e);break;case"batch":k(e);break;case"startTransition":I(e);break;case"createDeferred":N(e);break;default:break}}function C(){return{name:"solid-optimizer",pre(){this.ctx={hooks:new Map,identifiers:{"solid-js":{createEffect:new Set,onMount:new Set,getListener:new Set,untrack:new Set,batch:new Set,startTransition:new Set,createDeferred:new Set},"solid-js/web":{createEffect:new Set,onMount:new Set,getListener:new Set,untrack:new Set,batch:new Set,startTransition:new Set,createDeferred:new Set}},namespaces:{"solid-js":new Set,"solid-js/web":new Set}}},visitor:{ImportDeclaration(e,r){x(r.ctx,e)},CallExpression(e,r){let n=o(e.node.callee,t.isIdentifier);if(n){let a=e.scope.getBindingIdentifier(n.name);if(a){let c=E(r.ctx,a);c&&p(e,c)}return}let i=o(e.node.callee,t.isMemberExpression);if(i&&t.isIdentifier(i.property)&&!i.computed){let a=o(i.object,t.isIdentifier);if(a){let c=i.property.name,f=e.scope.getBindingIdentifier(a.name);f&&S(r.ctx,f,c)&&p(e,c)}}}}}}export{C as default};
1
+ import*as t from"@babel/types";function s(e,r){if(r(e))return e;switch(e.type){case"ParenthesizedExpression":case"TypeCastExpression":case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"TSInstantiationExpression":return s(e.expression,r);default:return}}var d={"solid-js":{createEffect:!0,onMount:!0,getListener:!0,untrack:!0,batch:!0,startTransition:!0,createDeferred:!0},"solid-js/web":{createEffect:!0,onMount:!0,getListener:!0,untrack:!0,batch:!0,startTransition:!0,createDeferred:!0}},f=new Set(Object.keys(d));function p(e,r){return t.isIdentifier(e.imported)&&e.imported.name===r||t.isStringLiteral(e.imported)&&e.imported.value===r}function m(e,r){if(!f.has(r.node.source.value))return;let n=r.node.source.value;for(let i=0,o=r.node.specifiers.length;i<o;i+=1){let a=r.node.specifiers[i];if(t.isImportSpecifier(a)){let c=d[n];for(let l of Object.keys(c))p(a,l)&&e.identifiers[n][l].add(a.local)}else t.isImportNamespaceSpecifier(a)&&e.namespaces[n].add(a.local)}}function x(e,r){for(let n of f){let i=e.identifiers[n];for(let o of Object.keys(i))if(i[o].has(r))return o}}function E(e,r,n){for(let i of f)if(e.namespaces[i].has(r)&&n in d[i])return!0;return!1}function b(e){e.remove()}function S(e){e.remove()}function g(e){e.replaceWith(t.nullLiteral())}function y(e){let r=e.node.arguments[0];if(t.isExpression(r)){let n=s(r,t.isArrowFunctionExpression);if(n){t.isExpression(n.body)?e.replaceWith(n.body):e.replaceWith(t.callExpression(n,[]));return}let i=s(r,t.isFunctionExpression);i&&e.replaceWith(i.body)}else t.isSpreadElement(r)&&e.replaceWith(t.callExpression(t.memberExpression(r.argument,t.numericLiteral(0),!0),[]))}function w(e){let r=e.node.arguments[0];if(t.isExpression(r)){let n=s(r,t.isArrowFunctionExpression);if(n){t.isExpression(n.body)?e.replaceWith(n.body):e.replaceWith(t.callExpression(n,[]));return}let i=s(r,t.isFunctionExpression);i&&e.replaceWith(i.body)}else t.isSpreadElement(r)&&e.replaceWith(t.callExpression(t.memberExpression(r.argument,t.numericLiteral(0),!0),[]))}function C(e){let r=e.node.arguments[0];if(t.isExpression(r)){let n=s(r,t.isArrowFunctionExpression);if(n){t.isExpression(n.body)?e.replaceWith(n.body):e.replaceWith(t.callExpression(n,[]));return}let i=s(r,t.isFunctionExpression);i&&e.replaceWith(i.body)}else t.isSpreadElement(r)&&e.replaceWith(t.callExpression(t.memberExpression(r.argument,t.numericLiteral(0),!0),[]))}function N(e){let r=e.node.arguments[0];t.isExpression(r)?e.replaceWith(r):t.isSpreadElement(r)&&e.replaceWith(t.memberExpression(r.argument,t.numericLiteral(0),!0))}function u(e,r){switch(r){case"createEffect":{b(e);break}case"onMount":{S(e);break}case"getListener":{g(e);break}case"untrack":{w(e);break}case"batch":{y(e);break}case"startTransition":{C(e);break}case"createDeferred":{N(e);break}}}function k(e,r){let n=s(r.node.callee,t.isIdentifier);if(n){let o=r.scope.getBindingIdentifier(n.name);if(o){let a=x(e,o);a&&u(r,a)}return}let i=s(r.node.callee,t.isMemberExpression);if(i&&t.isIdentifier(i.property)&&!i.computed){let o=s(i.object,t.isIdentifier);if(o){let a=i.property.name,c=r.scope.getBindingIdentifier(o.name);c&&E(e,c,a)&&u(r,a)}}}function I(){return{name:"solid-optimizer",visitor:{Program(e){let r={identifiers:{"solid-js":{createEffect:new Set,onMount:new Set,getListener:new Set,untrack:new Set,batch:new Set,startTransition:new Set,createDeferred:new Set},"solid-js/web":{createEffect:new Set,onMount:new Set,getListener:new Set,untrack:new Set,batch:new Set,startTransition:new Set,createDeferred:new Set}},namespaces:{"solid-js":new Set,"solid-js/web":new Set}};e.traverse({ImportDeclaration(n){m(r,n)}}),e.traverse({CallExpression(n){k(r,n)}})}}}}export{I as default};
@@ -1,12 +1,12 @@
1
- import { PluginObj, PluginPass } from '@babel/core';
2
- import * as t from '@babel/types';
3
- interface StateContext {
4
- hooks: Map<string, t.Identifier>;
5
- identifiers: Record<string, Record<string, Set<t.Identifier>>>;
6
- namespaces: Record<string, Set<t.Identifier>>;
7
- }
8
- interface State extends PluginPass {
9
- ctx: StateContext;
10
- }
11
- export default function solidOptimizerPlugin(): PluginObj<State>;
12
- export {};
1
+ import type { PluginObj, PluginPass } from '@babel/core';
2
+ import * as t from '@babel/types';
3
+ interface StateContext {
4
+ identifiers: Record<string, Record<string, Set<t.Identifier>>>;
5
+ namespaces: Record<string, Set<t.Identifier>>;
6
+ }
7
+ interface State extends PluginPass {
8
+ ctx: StateContext;
9
+ }
10
+ export default function solidOptimizerPlugin(): PluginObj<State>;
11
+ export {};
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AA0BlC,UAAU,YAAY;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC/D,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CAC/C;AA4KD,UAAU,KAAM,SAAQ,UAAU;IAChC,GAAG,EAAE,YAAY,CAAC;CACnB;AAsED,MAAM,CAAC,OAAO,UAAU,oBAAoB,IAAI,SAAS,CAAC,KAAK,CAAC,CA4C/D"}
@@ -0,0 +1,7 @@
1
+ import type * as t from '@babel/types';
2
+ type BroadTypeFilter<K extends t.Node> = (node: t.Node) => node is K;
3
+ type TypeCheck<K> = K extends BroadTypeFilter<infer U> ? U : never;
4
+ type TypeFilter = (node: t.Node) => boolean;
5
+ export default function unwrapNode<K extends TypeFilter>(node: t.Node, key: K): TypeCheck<K> | undefined;
6
+ export {};
7
+ //# sourceMappingURL=unwrap-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrap-node.d.ts","sourceRoot":"","sources":["../../src/unwrap-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAC;AAEvC,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC;AACrE,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEnE,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;AAE5C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,SAAS,UAAU,EACrD,IAAI,EAAE,CAAC,CAAC,IAAI,EACZ,GAAG,EAAE,CAAC,GACL,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAgB1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-optimizer",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -14,30 +14,26 @@
14
14
  "pridepack"
15
15
  ],
16
16
  "dependencies": {
17
- "@babel/helper-module-imports": "^7.18.6",
18
- "@babel/traverse": "^7.21.0",
19
- "@babel/types": "^7.21.0"
17
+ "@babel/traverse": "^7.23.9",
18
+ "@babel/types": "^7.23.9"
20
19
  },
21
20
  "devDependencies": {
22
- "@babel/core": "^7.21.0",
23
- "@types/babel__core": "^7.20.0",
24
- "@types/babel__traverse": "^7.18.3",
25
- "@types/node": "^18.14.0",
26
- "eslint": "^8.34.0",
27
- "eslint-config-lxsmnsyc": "^0.4.8",
28
- "pridepack": "2.4.1",
29
- "tslib": "^2.5.0",
30
- "typescript": "^4.9.5",
31
- "vitest": "^0.28.5"
21
+ "@babel/core": "^7.23.9",
22
+ "@types/babel__core": "^7.20.5",
23
+ "@types/babel__traverse": "^7.20.5",
24
+ "@types/node": "^20.11.8",
25
+ "pridepack": "2.6.0",
26
+ "tslib": "^2.6.2",
27
+ "typescript": "^5.3.3",
28
+ "vitest": "^1.2.2"
32
29
  },
33
30
  "peerDependencies": {
34
- "@babel/core": "^7.19"
31
+ "@babel/core": "^7.23"
35
32
  },
36
33
  "scripts": {
37
34
  "prepublishOnly": "pridepack clean && pridepack build",
38
35
  "build": "pridepack build",
39
36
  "type-check": "pridepack check",
40
- "lint": "pridepack lint",
41
37
  "clean": "pridepack clean",
42
38
  "watch": "pridepack watch",
43
39
  "start": "pridepack start",
@@ -58,7 +54,7 @@
58
54
  },
59
55
  "author": "Alexis Munsayac",
60
56
  "private": false,
61
- "types": "./dist/types/src/index.d.ts",
57
+ "types": "./dist/types/index.d.ts",
62
58
  "main": "./dist/cjs/production/index.cjs",
63
59
  "module": "./dist/esm/production/index.mjs",
64
60
  "exports": {
@@ -69,11 +65,11 @@
69
65
  },
70
66
  "require": "./dist/cjs/production/index.cjs",
71
67
  "import": "./dist/esm/production/index.mjs",
72
- "types": "./dist/types/src/index.d.ts"
68
+ "types": "./dist/types/index.d.ts"
73
69
  }
74
70
  },
75
71
  "typesVersions": {
76
72
  "*": {}
77
73
  },
78
- "gitHead": "661c2f5db00eadf06074fc3cdf74f58658d8eba2"
74
+ "gitHead": "da5bbc1d570c2398fe2002b39305c225ed0e74dc"
79
75
  }