microtags 0.0.13 → 0.1.1

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.
Files changed (85) hide show
  1. package/README.md +567 -40
  2. package/dist/build.cjs +412 -0
  3. package/dist/build.cjs.map +7 -0
  4. package/dist/build.d.ts +17 -0
  5. package/dist/build.d.ts.map +1 -0
  6. package/dist/build.js +395 -0
  7. package/dist/build.js.map +7 -0
  8. package/dist/builders.d.ts +70 -4
  9. package/dist/builders.d.ts.map +1 -1
  10. package/dist/{chunk-CCYWRJW6.js → chunk-46UEUDVX.js} +4 -26
  11. package/dist/chunk-46UEUDVX.js.map +7 -0
  12. package/dist/chunk-LS4L5QRD.js +26 -0
  13. package/dist/chunk-LS4L5QRD.js.map +7 -0
  14. package/dist/chunk-RKWPTT6P.js +69 -0
  15. package/dist/chunk-RKWPTT6P.js.map +7 -0
  16. package/dist/chunk-ZZ4ZLOQY.js +33 -0
  17. package/dist/chunk-ZZ4ZLOQY.js.map +7 -0
  18. package/dist/cli.cjs +536 -0
  19. package/dist/cli.cjs.map +7 -0
  20. package/dist/context.js +2 -1
  21. package/dist/esbuild.cjs +451 -0
  22. package/dist/esbuild.cjs.map +7 -0
  23. package/dist/esbuild.d.ts +7 -0
  24. package/dist/esbuild.d.ts.map +1 -0
  25. package/dist/esbuild.js +434 -0
  26. package/dist/esbuild.js.map +7 -0
  27. package/dist/factory.d.ts +7 -1
  28. package/dist/factory.d.ts.map +1 -1
  29. package/dist/htm.browser.cjs +591 -0
  30. package/dist/htm.browser.cjs.map +7 -0
  31. package/dist/htm.browser.d.ts +30 -0
  32. package/dist/htm.browser.d.ts.map +1 -0
  33. package/dist/htm.browser.js +498 -0
  34. package/dist/htm.browser.js.map +7 -0
  35. package/dist/htm.browser.min.js +3 -0
  36. package/dist/htm.browser.min.js.map +7 -0
  37. package/dist/htm.cjs +284 -0
  38. package/dist/htm.cjs.map +7 -0
  39. package/dist/htm.d.ts +14 -0
  40. package/dist/htm.d.ts.map +1 -0
  41. package/dist/htm.js +196 -0
  42. package/dist/htm.js.map +7 -0
  43. package/dist/htm.min.js +3 -0
  44. package/dist/htm.min.js.map +7 -0
  45. package/dist/index.cjs +125 -11
  46. package/dist/index.cjs.map +2 -2
  47. package/dist/index.d.ts +3 -1
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +133 -17
  50. package/dist/index.js.map +2 -2
  51. package/dist/index.min.js +1 -1
  52. package/dist/index.min.js.map +3 -3
  53. package/dist/meta.json +411 -26
  54. package/dist/preact-shared.d.ts +61 -0
  55. package/dist/preact-shared.d.ts.map +1 -0
  56. package/dist/preact.browser.d.ts +8 -0
  57. package/dist/preact.browser.d.ts.map +1 -0
  58. package/dist/preact.browser.js +45 -0
  59. package/dist/preact.browser.js.map +7 -0
  60. package/dist/preact.browser.min.js +2 -0
  61. package/dist/preact.browser.min.js.map +7 -0
  62. package/dist/preact.cjs +128 -0
  63. package/dist/preact.cjs.map +7 -0
  64. package/dist/preact.d.ts +9 -0
  65. package/dist/preact.d.ts.map +1 -0
  66. package/dist/preact.js +35 -0
  67. package/dist/preact.js.map +7 -0
  68. package/dist/render-support.cjs +86 -0
  69. package/dist/render-support.cjs.map +7 -0
  70. package/dist/render-support.d.ts +23 -0
  71. package/dist/render-support.d.ts.map +1 -0
  72. package/dist/render-support.js +12 -0
  73. package/dist/render-support.js.map +7 -0
  74. package/dist/render-support.min.js +2 -0
  75. package/dist/render-support.min.js.map +7 -0
  76. package/dist/types.d.ts +8 -0
  77. package/dist/types.d.ts.map +1 -1
  78. package/dist/vite.cjs +448 -0
  79. package/dist/vite.cjs.map +7 -0
  80. package/dist/vite.d.ts +7 -0
  81. package/dist/vite.d.ts.map +1 -0
  82. package/dist/vite.js +429 -0
  83. package/dist/vite.js.map +7 -0
  84. package/package.json +92 -13
  85. package/dist/chunk-CCYWRJW6.js.map +0 -7
@@ -0,0 +1,451 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/esbuild.ts
22
+ var esbuild_exports = {};
23
+ __export(esbuild_exports, {
24
+ microtags: () => microtags
25
+ });
26
+ module.exports = __toCommonJS(esbuild_exports);
27
+ var import_fs = require("fs");
28
+
29
+ // src/build.ts
30
+ var ts;
31
+ try {
32
+ ts = require("typescript");
33
+ } catch (err) {
34
+ const { code, message } = err;
35
+ if (code === "MODULE_NOT_FOUND" && message?.includes("'typescript'")) {
36
+ throw new Error(
37
+ 'microtags/build requires "typescript" as a peer dependency. Install it with: npm install --save-dev typescript'
38
+ );
39
+ }
40
+ throw new Error(
41
+ 'microtags/build could not load "typescript" because `require` is unavailable or unusable here. Load the entry from its built form (microtags/build, or dist/ in this repo) instead of from source.',
42
+ { cause: err }
43
+ );
44
+ }
45
+ function transform(code, options) {
46
+ const keep = options?.keep ?? [];
47
+ const filename = options?.filename;
48
+ const sf = ts.createSourceFile(
49
+ filename ?? "input.ts",
50
+ code,
51
+ ts.ScriptTarget.Latest,
52
+ true
53
+ );
54
+ const defineAliases = findDefineAliases(sf);
55
+ const spans = [];
56
+ const strippedBindings = /* @__PURE__ */ new Set();
57
+ const warnings = [];
58
+ let keptLink = false;
59
+ function visit(node) {
60
+ if (!ts.isCallExpression(node)) {
61
+ ts.forEachChild(node, visit);
62
+ return;
63
+ }
64
+ if (ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === "render") {
65
+ const receiver = node.expression.expression;
66
+ const chainRoot = findChainRoot(receiver);
67
+ if (chainRoot && isDefineCall(chainRoot, defineAliases)) {
68
+ const tagName = getDefineLiteralTag(chainRoot);
69
+ if (tagName === null && keep.length > 0) {
70
+ const line2 = sf.getLineAndCharacterOfPosition(
71
+ chainRoot.getStart()
72
+ ).line + 1;
73
+ warnings.push({
74
+ kind: "non-literal-tag",
75
+ file: filename,
76
+ line: line2,
77
+ message: "define() call with non-literal tag name cannot be matched by --keep"
78
+ });
79
+ }
80
+ if (shouldKeep(node, tagName, keep)) {
81
+ keptLink = true;
82
+ ts.forEachChild(node, visit);
83
+ return;
84
+ }
85
+ const binding = findBindingName(node);
86
+ if (binding) strippedBindings.add(binding);
87
+ spans.push({
88
+ start: dotPosition(node),
89
+ end: node.getEnd()
90
+ });
91
+ return;
92
+ }
93
+ const line = sf.getLineAndCharacterOfPosition(
94
+ node.getStart()
95
+ ).line + 1;
96
+ warnings.push({
97
+ kind: "outside-chain",
98
+ file: filename,
99
+ line,
100
+ message: ".render() call outside a define chain"
101
+ });
102
+ }
103
+ ts.forEachChild(node, visit);
104
+ }
105
+ __name(visit, "visit");
106
+ ts.forEachChild(sf, visit);
107
+ spans.sort((a, b) => b.start - a.start);
108
+ let result = code;
109
+ for (const span of spans) {
110
+ const removed = result.slice(span.start, span.end);
111
+ const newlines = removed.split("\n").length - 1;
112
+ result = result.slice(0, span.start) + "\n".repeat(newlines) + result.slice(span.end);
113
+ }
114
+ if (options?.cascade) {
115
+ result = cascadeRemove(result, filename);
116
+ }
117
+ if (strippedBindings.size > 0) {
118
+ const resultSf = ts.createSourceFile(
119
+ filename ?? "input.ts",
120
+ result,
121
+ ts.ScriptTarget.Latest,
122
+ true
123
+ );
124
+ findStrippedStaticCalls(
125
+ resultSf,
126
+ strippedBindings,
127
+ warnings,
128
+ filename
129
+ );
130
+ }
131
+ if (keptLink && !importsSupport(sf)) {
132
+ result += `
133
+ import '${SUPPORT}'
134
+ `;
135
+ }
136
+ return { code: result, warnings };
137
+ }
138
+ __name(transform, "transform");
139
+ var SUPPORT = "microtags/render-support";
140
+ function importsSupport(sf) {
141
+ return sf.statements.some(
142
+ (node) => ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === SUPPORT
143
+ );
144
+ }
145
+ __name(importsSupport, "importsSupport");
146
+ function findDefineAliases(sf) {
147
+ const aliases = /* @__PURE__ */ new Set();
148
+ ts.forEachChild(sf, (node) => {
149
+ if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === "microtags" && node.importClause?.namedBindings && ts.isNamedImports(
150
+ node.importClause.namedBindings
151
+ )) {
152
+ for (const spec of node.importClause.namedBindings.elements) {
153
+ const origName = spec.propertyName?.text ?? spec.name.text;
154
+ if (origName === "define") {
155
+ aliases.add(spec.name.text);
156
+ }
157
+ }
158
+ }
159
+ });
160
+ return aliases;
161
+ }
162
+ __name(findDefineAliases, "findDefineAliases");
163
+ function findChainRoot(node) {
164
+ if (ts.isCallExpression(node)) {
165
+ if (ts.isIdentifier(node.expression)) {
166
+ return node;
167
+ }
168
+ if (ts.isPropertyAccessExpression(node.expression)) {
169
+ return findChainRoot(
170
+ node.expression.expression
171
+ );
172
+ }
173
+ }
174
+ return null;
175
+ }
176
+ __name(findChainRoot, "findChainRoot");
177
+ function isDefineCall(node, aliases) {
178
+ return ts.isIdentifier(node.expression) && aliases.has(node.expression.text);
179
+ }
180
+ __name(isDefineCall, "isDefineCall");
181
+ function getDefineLiteralTag(node) {
182
+ if (node.arguments.length > 0 && ts.isStringLiteral(node.arguments[0])) {
183
+ return node.arguments[0].text;
184
+ }
185
+ return null;
186
+ }
187
+ __name(getDefineLiteralTag, "getDefineLiteralTag");
188
+ function shouldKeep(renderCall, tagName, keep) {
189
+ if (renderCall.arguments.length >= 2) {
190
+ const opts = renderCall.arguments[1];
191
+ if (ts.isObjectLiteralExpression(opts)) {
192
+ for (const prop of opts.properties) {
193
+ if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name) && prop.name.text === "client" && prop.initializer.kind === ts.SyntaxKind.TrueKeyword) {
194
+ return true;
195
+ }
196
+ }
197
+ }
198
+ }
199
+ if (tagName !== null && keep.includes(tagName)) {
200
+ return true;
201
+ }
202
+ return false;
203
+ }
204
+ __name(shouldKeep, "shouldKeep");
205
+ function dotPosition(renderCall) {
206
+ const pa = renderCall.expression;
207
+ return pa.expression.getEnd();
208
+ }
209
+ __name(dotPosition, "dotPosition");
210
+ function findBindingName(node) {
211
+ let current = node;
212
+ while (current.parent) {
213
+ current = current.parent;
214
+ if (ts.isVariableDeclaration(current) && ts.isIdentifier(current.name)) {
215
+ return current.name.text;
216
+ }
217
+ }
218
+ return null;
219
+ }
220
+ __name(findBindingName, "findBindingName");
221
+ function cascadeRemove(code, filename) {
222
+ let changed = true;
223
+ let result = code;
224
+ while (changed) {
225
+ changed = false;
226
+ const sf = ts.createSourceFile(
227
+ filename ?? "input.ts",
228
+ result,
229
+ ts.ScriptTarget.Latest,
230
+ true
231
+ );
232
+ const refs = collectReferences(sf);
233
+ const removeSpans = [];
234
+ ts.forEachChild(sf, (node) => {
235
+ if (ts.isImportDeclaration(node) && node.importClause) {
236
+ if (isExportedNode(node)) return;
237
+ const nb = node.importClause.namedBindings;
238
+ if (!nb) return;
239
+ if (!ts.isNamedImports(nb)) {
240
+ const name = node.importClause.name;
241
+ if (name && !refs.has(name.text)) {
242
+ removeSpans.push({
243
+ start: node.getStart(),
244
+ end: node.getEnd()
245
+ });
246
+ }
247
+ return;
248
+ }
249
+ const dead = [];
250
+ const live = [];
251
+ for (const el of nb.elements) {
252
+ if (refs.has(el.name.text)) {
253
+ live.push(el);
254
+ } else {
255
+ dead.push(el);
256
+ }
257
+ }
258
+ if (dead.length === 0) return;
259
+ if (live.length === 0) {
260
+ removeSpans.push({
261
+ start: node.getStart(),
262
+ end: node.getEnd()
263
+ });
264
+ } else {
265
+ for (const d of dead) {
266
+ let start = d.getStart();
267
+ let end = d.getEnd();
268
+ const text = result;
269
+ const after = text.slice(end);
270
+ const before = text.slice(0, start);
271
+ if (/^\s*,/.test(after)) {
272
+ end += after.match(
273
+ /^\s*,/
274
+ )[0].length;
275
+ } else if (/,\s*$/.test(before)) {
276
+ start = before.lastIndexOf(",");
277
+ }
278
+ removeSpans.push({ start, end });
279
+ }
280
+ }
281
+ return;
282
+ }
283
+ if (ts.isVariableStatement(node)) {
284
+ if (isExportedNode(node)) return;
285
+ const allDead = node.declarationList.declarations.every(
286
+ (d) => ts.isIdentifier(d.name) && !refs.has(d.name.text)
287
+ );
288
+ if (allDead) {
289
+ removeSpans.push({
290
+ start: node.getStart(),
291
+ end: node.getEnd()
292
+ });
293
+ }
294
+ return;
295
+ }
296
+ if (ts.isFunctionDeclaration(node)) {
297
+ if (isExportedNode(node)) return;
298
+ if (node.name && !refs.has(node.name.text)) {
299
+ removeSpans.push({
300
+ start: node.getStart(),
301
+ end: node.getEnd()
302
+ });
303
+ }
304
+ return;
305
+ }
306
+ if (ts.isClassDeclaration(node)) {
307
+ if (isExportedNode(node)) return;
308
+ if (node.name && !refs.has(node.name.text)) {
309
+ removeSpans.push({
310
+ start: node.getStart(),
311
+ end: node.getEnd()
312
+ });
313
+ }
314
+ }
315
+ });
316
+ if (removeSpans.length === 0) break;
317
+ changed = true;
318
+ removeSpans.sort((a, b) => b.start - a.start);
319
+ for (const span of removeSpans) {
320
+ const removed = result.slice(
321
+ span.start,
322
+ span.end
323
+ );
324
+ const newlines = removed.split("\n").length - 1;
325
+ result = result.slice(0, span.start) + "\n".repeat(newlines) + result.slice(span.end);
326
+ }
327
+ }
328
+ return result;
329
+ }
330
+ __name(cascadeRemove, "cascadeRemove");
331
+ function collectReferences(sf) {
332
+ const refs = /* @__PURE__ */ new Set();
333
+ const declared = /* @__PURE__ */ new Set();
334
+ ts.forEachChild(sf, (node) => {
335
+ if (ts.isImportDeclaration(node)) {
336
+ if (node.importClause?.namedBindings && ts.isNamedImports(
337
+ node.importClause.namedBindings
338
+ )) {
339
+ for (const el of node.importClause.namedBindings.elements) {
340
+ declared.add(el.name.text);
341
+ }
342
+ }
343
+ return;
344
+ }
345
+ if (ts.isVariableStatement(node)) {
346
+ for (const d of node.declarationList.declarations) {
347
+ if (ts.isIdentifier(d.name)) {
348
+ declared.add(d.name.text);
349
+ }
350
+ }
351
+ }
352
+ if (ts.isFunctionDeclaration(node) && node.name) {
353
+ declared.add(node.name.text);
354
+ }
355
+ if (ts.isClassDeclaration(node) && node.name) {
356
+ declared.add(node.name.text);
357
+ }
358
+ });
359
+ function visitRefs(node) {
360
+ if (ts.isIdentifier(node) && declared.has(node.text)) {
361
+ const parent = node.parent;
362
+ if (ts.isImportSpecifier(parent) || ts.isVariableDeclaration(parent) && parent.name === node || ts.isFunctionDeclaration(parent) && parent.name === node || ts.isClassDeclaration(parent) && parent.name === node) {
363
+ return;
364
+ }
365
+ refs.add(node.text);
366
+ }
367
+ ts.forEachChild(node, visitRefs);
368
+ }
369
+ __name(visitRefs, "visitRefs");
370
+ ts.forEachChild(sf, (node) => {
371
+ if (ts.isImportDeclaration(node)) return;
372
+ visitRefs(node);
373
+ });
374
+ return refs;
375
+ }
376
+ __name(collectReferences, "collectReferences");
377
+ function isExportedNode(node) {
378
+ if (!ts.canHaveModifiers(node)) return false;
379
+ const mods = ts.getModifiers(node);
380
+ if (!mods) return false;
381
+ return mods.some(
382
+ (m) => m.kind === ts.SyntaxKind.ExportKeyword
383
+ );
384
+ }
385
+ __name(isExportedNode, "isExportedNode");
386
+ function findStrippedStaticCalls(sf, bindings, warnings, filename) {
387
+ function visit(node) {
388
+ if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(
389
+ node.expression
390
+ ) && node.expression.name.text === "render" && ts.isIdentifier(
391
+ node.expression.expression
392
+ ) && bindings.has(
393
+ node.expression.expression.text
394
+ )) {
395
+ const line = sf.getLineAndCharacterOfPosition(
396
+ node.getStart()
397
+ ).line + 1;
398
+ warnings.push({
399
+ kind: "stripped-static",
400
+ file: filename,
401
+ line,
402
+ message: `${node.expression.expression.text}.render() called but render was stripped`
403
+ });
404
+ }
405
+ ts.forEachChild(node, visit);
406
+ }
407
+ __name(visit, "visit");
408
+ ts.forEachChild(sf, visit);
409
+ }
410
+ __name(findStrippedStaticCalls, "findStrippedStaticCalls");
411
+
412
+ // src/esbuild.ts
413
+ function microtags(options) {
414
+ const filter = options?.filter ?? /\.(ts|js|mjs)$/;
415
+ const cascade = options?.cascade;
416
+ const keep = options?.keep;
417
+ return {
418
+ name: "microtags",
419
+ setup(build) {
420
+ build.onLoad({ filter }, (args) => {
421
+ const code = (0, import_fs.readFileSync)(
422
+ args.path,
423
+ "utf8"
424
+ );
425
+ const result = transform(code, {
426
+ cascade,
427
+ keep,
428
+ filename: args.path
429
+ });
430
+ const warnings = result.warnings.map((w) => ({
431
+ text: w.message,
432
+ location: {
433
+ file: args.path,
434
+ line: w.line
435
+ }
436
+ }));
437
+ return {
438
+ contents: result.code,
439
+ loader: args.path.endsWith(".ts") ? "ts" : "js",
440
+ warnings
441
+ };
442
+ });
443
+ }
444
+ };
445
+ }
446
+ __name(microtags, "microtags");
447
+ // Annotate the CommonJS export names for ESM import in node:
448
+ 0 && (module.exports = {
449
+ microtags
450
+ });
451
+ //# sourceMappingURL=esbuild.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/esbuild.ts", "../src/build.ts"],
4
+ "sourcesContent": ["import type { Plugin, OnLoadArgs, OnLoadResult } from 'esbuild'\nimport { readFileSync } from 'fs'\nimport { transform } from './build.js'\nimport type { TransformOptions } from './build.js'\n\nexport interface MicrotagsEsbuildOptions\n extends TransformOptions {\n filter?:RegExp\n}\n\nexport function microtags (\n options?:MicrotagsEsbuildOptions\n):Plugin {\n const filter = options?.filter ?? /\\.(ts|js|mjs)$/\n const cascade = options?.cascade\n const keep = options?.keep as string[] | undefined\n\n return {\n name: 'microtags',\n setup (build) {\n build.onLoad({ filter }, (args:OnLoadArgs) => {\n const code = readFileSync(\n args.path, 'utf8'\n )\n const result = transform(code, {\n cascade,\n keep,\n filename: args.path,\n })\n\n const warnings = result.warnings.map(w => ({\n text: w.message,\n location: {\n file: args.path,\n line: w.line,\n },\n }))\n\n return {\n contents: result.code,\n loader: args.path.endsWith('.ts') ?\n 'ts' :\n 'js',\n warnings,\n } as OnLoadResult\n })\n },\n }\n}\n", "import type TypeScript from 'typescript'\n\ndeclare const require:(id:string) => unknown\n\nlet ts:typeof TypeScript\ntry {\n ts = require('typescript') as typeof TypeScript\n} catch (err) {\n // Only a failure to resolve the bare name means typescript is\n // missing. Anything else is a context that cannot `require` it:\n // an ESM bundle without `require`, or a Vite config bundle, which\n // hands `require` a file URL.\n const { code, message } = err as { code?:string, message?:string }\n if (\n code === 'MODULE_NOT_FOUND' &&\n message?.includes(\"'typescript'\")\n ) {\n throw new Error(\n 'microtags/build requires \"typescript\" as a peer dependency. ' +\n 'Install it with: npm install --save-dev typescript'\n )\n }\n throw new Error(\n 'microtags/build could not load \"typescript\" because `require` ' +\n 'is unavailable or unusable here. Load the entry from its ' +\n 'built form (microtags/build, or dist/ in this repo) instead ' +\n 'of from source.',\n { cause: err }\n )\n}\n\nexport interface TransformWarning {\n kind:'outside-chain'|'stripped-static'|'non-literal-tag'\n file?:string\n line:number\n message:string\n}\n\nexport interface TransformOptions {\n cascade?:boolean\n keep?:string[]\n filename?:string\n}\n\nexport interface TransformResult {\n code:string\n warnings:TransformWarning[]\n}\n\nexport function transform (\n code:string,\n options?:TransformOptions\n):TransformResult {\n const keep = options?.keep ?? []\n const filename = options?.filename\n\n const sf = ts.createSourceFile(\n filename ?? 'input.ts',\n code,\n ts.ScriptTarget.Latest,\n true\n )\n\n const defineAliases = findDefineAliases(sf)\n const spans:{ start:number, end:number }[] = []\n const strippedBindings:Set<string> = new Set()\n const warnings:TransformWarning[] = []\n let keptLink = false\n\n function visit (node:TypeScript.Node) {\n if (!ts.isCallExpression(node)) {\n ts.forEachChild(node, visit)\n return\n }\n\n if (\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'render'\n ) {\n const receiver = node.expression.expression\n const chainRoot = findChainRoot(receiver)\n\n if (\n chainRoot &&\n isDefineCall(chainRoot, defineAliases)\n ) {\n const tagName = getDefineLiteralTag(chainRoot)\n\n if (tagName === null && keep.length > 0) {\n const line = sf.getLineAndCharacterOfPosition(\n chainRoot.getStart()\n ).line + 1\n warnings.push({\n kind: 'non-literal-tag',\n file: filename,\n line,\n message:\n 'define() call with non-literal ' +\n 'tag name cannot be matched ' +\n 'by --keep',\n })\n }\n\n if (shouldKeep(node, tagName, keep)) {\n keptLink = true\n ts.forEachChild(node, visit)\n return\n }\n\n const binding = findBindingName(node)\n if (binding) strippedBindings.add(binding)\n\n spans.push({\n start: dotPosition(node),\n end: node.getEnd(),\n })\n return\n }\n\n const line = sf.getLineAndCharacterOfPosition(\n node.getStart()\n ).line + 1\n warnings.push({\n kind: 'outside-chain',\n file: filename,\n line,\n message:\n '.render() call outside a define chain',\n })\n }\n\n ts.forEachChild(node, visit)\n }\n\n ts.forEachChild(sf, visit)\n\n spans.sort((a, b) => b.start - a.start)\n\n let result = code\n for (const span of spans) {\n const removed = result.slice(span.start, span.end)\n const newlines = removed.split('\\n').length - 1\n result = result.slice(0, span.start) +\n '\\n'.repeat(newlines) +\n result.slice(span.end)\n }\n\n if (options?.cascade) {\n result = cascadeRemove(result, filename)\n }\n\n if (strippedBindings.size > 0) {\n const resultSf = ts.createSourceFile(\n filename ?? 'input.ts',\n result,\n ts.ScriptTarget.Latest,\n true\n )\n findStrippedStaticCalls(\n resultSf, strippedBindings, warnings, filename\n )\n }\n\n // A kept render link needs the server render support module at\n // runtime (ADR-009). Appended so no existing line moves; imports\n // are hoisted, so its position does not matter.\n if (keptLink && !importsSupport(sf)) {\n result += `\\nimport '${SUPPORT}'\\n`\n }\n\n return { code: result, warnings }\n}\n\nconst SUPPORT = 'microtags/render-support'\n\nfunction importsSupport (sf:TypeScript.SourceFile):boolean {\n return sf.statements.some(node =>\n ts.isImportDeclaration(node) &&\n ts.isStringLiteral(node.moduleSpecifier) &&\n node.moduleSpecifier.text === SUPPORT\n )\n}\n\nfunction findDefineAliases (\n sf:TypeScript.SourceFile\n):Set<string> {\n const aliases = new Set<string>()\n ts.forEachChild(sf, node => {\n if (\n ts.isImportDeclaration(node) &&\n ts.isStringLiteral(node.moduleSpecifier) &&\n node.moduleSpecifier.text === 'microtags' &&\n node.importClause?.namedBindings &&\n ts.isNamedImports(\n node.importClause.namedBindings\n )\n ) {\n for (const spec of\n node.importClause.namedBindings.elements\n ) {\n const origName =\n spec.propertyName?.text ??\n spec.name.text\n if (origName === 'define') {\n aliases.add(spec.name.text)\n }\n }\n }\n })\n return aliases\n}\n\nfunction findChainRoot (\n node:TypeScript.Node\n):TypeScript.CallExpression | null {\n if (ts.isCallExpression(node)) {\n if (ts.isIdentifier(node.expression)) {\n return node\n }\n if (\n ts.isPropertyAccessExpression(node.expression)\n ) {\n return findChainRoot(\n node.expression.expression\n )\n }\n }\n return null\n}\n\nfunction isDefineCall (\n node:TypeScript.CallExpression,\n aliases:Set<string>\n):boolean {\n return ts.isIdentifier(node.expression) &&\n aliases.has(node.expression.text)\n}\n\nfunction getDefineLiteralTag (\n node:TypeScript.CallExpression\n):string | null {\n if (\n node.arguments.length > 0 &&\n ts.isStringLiteral(node.arguments[0])\n ) {\n return node.arguments[0].text\n }\n return null\n}\n\nfunction shouldKeep (\n renderCall:TypeScript.CallExpression,\n tagName:string | null,\n keep:string[]\n):boolean {\n if (renderCall.arguments.length >= 2) {\n const opts = renderCall.arguments[1]\n if (ts.isObjectLiteralExpression(opts)) {\n for (const prop of opts.properties) {\n if (\n ts.isPropertyAssignment(prop) &&\n ts.isIdentifier(prop.name) &&\n prop.name.text === 'client' &&\n prop.initializer.kind ===\n ts.SyntaxKind.TrueKeyword\n ) {\n return true\n }\n }\n }\n }\n\n if (tagName !== null && keep.includes(tagName)) {\n return true\n }\n\n return false\n}\n\nfunction dotPosition (\n renderCall:TypeScript.CallExpression\n):number {\n const pa = renderCall\n .expression as TypeScript.PropertyAccessExpression\n return pa.expression.getEnd()\n}\n\nfunction findBindingName (\n node:TypeScript.Node\n):string | null {\n let current:TypeScript.Node = node\n while (current.parent) {\n current = current.parent\n if (\n ts.isVariableDeclaration(current) &&\n ts.isIdentifier(current.name)\n ) {\n return current.name.text\n }\n }\n return null\n}\n\nfunction cascadeRemove (\n code:string,\n filename?:string\n):string {\n let changed = true\n let result = code\n while (changed) {\n changed = false\n const sf = ts.createSourceFile(\n filename ?? 'input.ts',\n result,\n ts.ScriptTarget.Latest,\n true\n )\n\n const refs = collectReferences(sf)\n const removeSpans:{\n start:number, end:number\n }[] = []\n\n ts.forEachChild(sf, node => {\n if (\n ts.isImportDeclaration(node) &&\n node.importClause\n ) {\n if (isExportedNode(node)) return\n const nb = node.importClause.namedBindings\n if (!nb) return\n if (!ts.isNamedImports(nb)) {\n const name = node.importClause.name\n if (\n name &&\n !refs.has(name.text)\n ) {\n removeSpans.push({\n start: node.getStart(),\n end: node.getEnd(),\n })\n }\n return\n }\n const dead:TypeScript.ImportSpecifier[] = []\n const live:TypeScript.ImportSpecifier[] = []\n for (const el of nb.elements) {\n if (refs.has(el.name.text)) {\n live.push(el)\n } else {\n dead.push(el)\n }\n }\n if (dead.length === 0) return\n if (live.length === 0) {\n removeSpans.push({\n start: node.getStart(),\n end: node.getEnd(),\n })\n } else {\n for (const d of dead) {\n let start = d.getStart()\n let end = d.getEnd()\n const text = result\n const after = text.slice(end)\n const before = text.slice(0, start)\n if (/^\\s*,/.test(after)) {\n end += after.match(\n /^\\s*,/\n )![0].length\n } else if (/,\\s*$/.test(before)) {\n start = before.lastIndexOf(',')\n }\n removeSpans.push({ start, end })\n }\n }\n return\n }\n\n if (ts.isVariableStatement(node)) {\n if (isExportedNode(node)) return\n const allDead = node\n .declarationList\n .declarations\n .every(d =>\n ts.isIdentifier(d.name) &&\n !refs.has(d.name.text)\n )\n if (allDead) {\n removeSpans.push({\n start: node.getStart(),\n end: node.getEnd(),\n })\n }\n return\n }\n\n if (ts.isFunctionDeclaration(node)) {\n if (isExportedNode(node)) return\n if (\n node.name &&\n !refs.has(node.name.text)\n ) {\n removeSpans.push({\n start: node.getStart(),\n end: node.getEnd(),\n })\n }\n return\n }\n\n if (ts.isClassDeclaration(node)) {\n if (isExportedNode(node)) return\n if (\n node.name &&\n !refs.has(node.name.text)\n ) {\n removeSpans.push({\n start: node.getStart(),\n end: node.getEnd(),\n })\n }\n }\n })\n\n if (removeSpans.length === 0) break\n\n changed = true\n removeSpans.sort((a, b) => b.start - a.start)\n for (const span of removeSpans) {\n const removed = result.slice(\n span.start, span.end\n )\n const newlines =\n removed.split('\\n').length - 1\n result = result.slice(0, span.start) +\n '\\n'.repeat(newlines) +\n result.slice(span.end)\n }\n }\n\n return result\n}\n\nfunction collectReferences (\n sf:TypeScript.SourceFile\n):Set<string> {\n const refs = new Set<string>()\n const declared = new Set<string>()\n\n ts.forEachChild(sf, node => {\n if (ts.isImportDeclaration(node)) {\n if (\n node.importClause?.namedBindings &&\n ts.isNamedImports(\n node.importClause.namedBindings\n )\n ) {\n for (const el of\n node.importClause\n .namedBindings.elements\n ) {\n declared.add(el.name.text)\n }\n }\n return\n }\n if (ts.isVariableStatement(node)) {\n for (const d of\n node.declarationList.declarations\n ) {\n if (ts.isIdentifier(d.name)) {\n declared.add(d.name.text)\n }\n }\n }\n if (\n ts.isFunctionDeclaration(node) && node.name\n ) {\n declared.add(node.name.text)\n }\n if (\n ts.isClassDeclaration(node) && node.name\n ) {\n declared.add(node.name.text)\n }\n })\n\n function visitRefs (node:TypeScript.Node) {\n if (\n ts.isIdentifier(node) &&\n declared.has(node.text)\n ) {\n const parent = node.parent\n if (\n ts.isImportSpecifier(parent) ||\n (\n ts.isVariableDeclaration(parent) &&\n parent.name === node\n ) ||\n (\n ts.isFunctionDeclaration(parent) &&\n parent.name === node\n ) ||\n (\n ts.isClassDeclaration(parent) &&\n parent.name === node\n )\n ) {\n return\n }\n refs.add(node.text)\n }\n ts.forEachChild(node, visitRefs)\n }\n\n ts.forEachChild(sf, node => {\n if (ts.isImportDeclaration(node)) return\n visitRefs(node)\n })\n\n return refs\n}\n\nfunction isExportedNode (\n node:TypeScript.Node\n):boolean {\n if (!ts.canHaveModifiers(node)) return false\n const mods = ts.getModifiers(node)\n if (!mods) return false\n return mods.some(\n m => m.kind === ts.SyntaxKind.ExportKeyword\n )\n}\n\nfunction findStrippedStaticCalls (\n sf:TypeScript.SourceFile,\n bindings:Set<string>,\n warnings:TransformWarning[],\n filename?:string\n) {\n function visit (node:TypeScript.Node) {\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(\n node.expression\n ) &&\n node.expression.name.text === 'render' &&\n ts.isIdentifier(\n node.expression.expression\n ) &&\n bindings.has(\n node.expression.expression.text\n )\n ) {\n const line = sf.getLineAndCharacterOfPosition(\n node.getStart()\n ).line + 1\n warnings.push({\n kind: 'stripped-static',\n file: filename,\n line,\n message:\n `${node.expression.expression.text}` +\n '.render() called but render ' +\n 'was stripped',\n })\n }\n ts.forEachChild(node, visit)\n }\n ts.forEachChild(sf, visit)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA6B;;;ACG7B,IAAI;AACJ,IAAI;AACA,OAAK,QAAQ,YAAY;AAC7B,SAAS,KAAK;AAKV,QAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,MACI,SAAS,sBACT,SAAS,SAAS,cAAc,GAClC;AACE,UAAM,IAAI;AAAA,MACN;AAAA,IAEJ;AAAA,EACJ;AACA,QAAM,IAAI;AAAA,IACN;AAAA,IAIA,EAAE,OAAO,IAAI;AAAA,EACjB;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YAC9B,GAAG;AAAA,MACC,KAAK,WAAW;AAAA,IACpB,KACA,SAAS;AAAA,MACL,KAAK,WAAW,WAAW;AAAA,IAC/B,GACF;AACE,YAAM,OAAO,GAAG;AAAA,QACZ,KAAK,SAAS;AAAA,MAClB,EAAE,OAAO;AACT,eAAS,KAAK;AAAA,QACV,MAAM;AAAA,QACN,MAAM;AAAA,QACN;AAAA,QACA,SACI,GAAG,KAAK,WAAW,WAAW,IAAI;AAAA,MAG1C,CAAC;AAAA,IACL;AACA,OAAG,aAAa,MAAM,KAAK;AAAA,EAC/B;AA5BS;AA6BT,KAAG,aAAa,IAAI,KAAK;AAC7B;AApCS;;;AD7gBF,SAAS,UACZ,SACK;AACL,QAAM,SAAS,SAAS,UAAU;AAClC,QAAM,UAAU,SAAS;AACzB,QAAM,OAAO,SAAS;AAEtB,SAAO;AAAA,IACH,MAAM;AAAA,IACN,MAAO,OAAO;AACV,YAAM,OAAO,EAAE,OAAO,GAAG,CAAC,SAAoB;AAC1C,cAAM,WAAO;AAAA,UACT,KAAK;AAAA,UAAM;AAAA,QACf;AACA,cAAM,SAAS,UAAU,MAAM;AAAA,UAC3B;AAAA,UACA;AAAA,UACA,UAAU,KAAK;AAAA,QACnB,CAAC;AAED,cAAM,WAAW,OAAO,SAAS,IAAI,QAAM;AAAA,UACvC,MAAM,EAAE;AAAA,UACR,UAAU;AAAA,YACN,MAAM,KAAK;AAAA,YACX,MAAM,EAAE;AAAA,UACZ;AAAA,QACJ,EAAE;AAEF,eAAO;AAAA,UACH,UAAU,OAAO;AAAA,UACjB,QAAQ,KAAK,KAAK,SAAS,KAAK,IAC5B,OACA;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,EACJ;AACJ;AAtCgB;",
6
+ "names": ["line"]
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { Plugin } from 'esbuild';
2
+ import type { TransformOptions } from './build.js';
3
+ export interface MicrotagsEsbuildOptions extends TransformOptions {
4
+ filter?: RegExp;
5
+ }
6
+ export declare function microtags(options?: MicrotagsEsbuildOptions): Plugin;
7
+ //# sourceMappingURL=esbuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA4B,MAAM,SAAS,CAAA;AAG/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,uBACb,SAAQ,gBAAgB;IACxB,MAAM,CAAC,EAAC,MAAM,CAAA;CACjB;AAED,wBAAgB,SAAS,CACrB,OAAO,CAAC,EAAC,uBAAuB,GAClC,MAAM,CAoCP"}