@astrojs/compiler 0.0.0-module-id-20221123173459

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/CHANGELOG.md ADDED
@@ -0,0 +1,1108 @@
1
+ # @astrojs/compiler
2
+
3
+ ## 0.0.0-module-id-20221123173459
4
+
5
+ ### Minor Changes
6
+
7
+ - cd51d2e: Provide the moduleId of the astro component
8
+
9
+ ## 0.29.17
10
+
11
+ ### Patch Changes
12
+
13
+ - 1e7e098: Add warning for invalid spread attributes
14
+ - 3cc6f55: Fix handling of unterminated template literal attributes
15
+ - 48c5677: Update default `internalURL` to `astro/runtime/server/index.js`
16
+ - 2893f33: Fix a number of `table` and `expression` related bugs
17
+
18
+ ## 0.29.16
19
+
20
+ ### Patch Changes
21
+
22
+ - ec745f4: Self-closing tags will now retreive "end" positional data
23
+ - a6c2822: Fix a few TSX output errors
24
+
25
+ ## 0.29.15
26
+
27
+ ### Patch Changes
28
+
29
+ - 5f6e69b: Fix expression literal handling
30
+
31
+ ## 0.29.14
32
+
33
+ ### Patch Changes
34
+
35
+ - 6ff1d80: Fix regression introduced by https://github.com/withastro/compiler/pull/617
36
+
37
+ ## 0.29.13
38
+
39
+ ### Patch Changes
40
+
41
+ - 8f3e488: Fix regression introduced to `parse` handling in the last patch
42
+
43
+ ## 0.29.12
44
+
45
+ ### Patch Changes
46
+
47
+ - a41982a: Fix expression edge cases, improve literal parsing
48
+
49
+ ## 0.29.11
50
+
51
+ ### Patch Changes
52
+
53
+ - ee907f1: Fix #5308, duplicate style bug when using `define:vars`
54
+
55
+ ## 0.29.10
56
+
57
+ ### Patch Changes
58
+
59
+ - 07a65df: Print `\r` when printing TSX output
60
+ - 1250d0b: Add warning when `define:vars` won't work because of compilation limitations
61
+
62
+ ## 0.29.9
63
+
64
+ ### Patch Changes
65
+
66
+ - 1fe92c0: Fix TSX sourcemaps on Windows (take 4)
67
+
68
+ ## 0.29.8
69
+
70
+ ### Patch Changes
71
+
72
+ - 01b62ea: Fix sourcemap bug on Windows (again x2)
73
+
74
+ ## 0.29.7
75
+
76
+ ### Patch Changes
77
+
78
+ - 108c6c9: Fix TSX sourcemap bug on Windows (again)
79
+
80
+ ## 0.29.6
81
+
82
+ ### Patch Changes
83
+
84
+ - 4b3fafa: Fix TSX sourcemaps on Windows
85
+
86
+ ## 0.29.5
87
+
88
+ ### Patch Changes
89
+
90
+ - 73a2b69: Use an IIFE for define:vars scripts
91
+
92
+ ## 0.29.4
93
+
94
+ ### Patch Changes
95
+
96
+ - 4381efa: Return proper diagnostic code for warnings
97
+
98
+ ## 0.29.3
99
+
100
+ ### Patch Changes
101
+
102
+ - 85e1d31: AST: move `start` position of elements to the first index of their opening tag
103
+
104
+ ## 0.29.2
105
+
106
+ ### Patch Changes
107
+
108
+ - 035829b: AST: move end position of elements to the last index of their end tag
109
+
110
+ ## 0.29.1
111
+
112
+ ### Patch Changes
113
+
114
+ - a99c014: Ensure comment and text nodes have end positions when generating an AST from `parse`
115
+
116
+ ## 0.29.0
117
+
118
+ ### Minor Changes
119
+
120
+ - fd2fc28: Fix some utf8 compatability issues
121
+
122
+ ### Patch Changes
123
+
124
+ - 4b68670: TSX: fix edge case with spread attribute printing
125
+ - 6b204bd: Fix bug with trailing `style` tags being moved into the `html` element
126
+ - 66fe230: Fix: include element end location in `parse` AST
127
+
128
+ ## 0.28.1
129
+
130
+ ### Patch Changes
131
+
132
+ - aac8c89: Fix end tag sourcemappings for TSX mode
133
+ - d7f3288: TSX: Improve self-closing tag behavior and mappings
134
+ - 75dd7cc: Fix spread attribute mappings
135
+
136
+ ## 0.28.0
137
+
138
+ ### Minor Changes
139
+
140
+ - 5da0dc2: Add `resolvePath` option to control hydration path resolution
141
+ - e816a61: Remove metadata export if `resolvePath` option provided
142
+
143
+ ## 0.27.2
144
+
145
+ ### Patch Changes
146
+
147
+ - 959f96b: Fix "missing sourcemap" issue
148
+ - 94f6f3e: Fix edge case with multi-line comment usage
149
+ - 85a654a: Fix `parse` causing a compiler panic when a component with a client directive was imported but didn't have a matching import
150
+ - 5e32cbe: Improvements to TSX output
151
+
152
+ ## 0.27.1
153
+
154
+ ### Patch Changes
155
+
156
+ - cc9f174: fixed regression caused by #546
157
+
158
+ ## 0.27.0
159
+
160
+ ### Minor Changes
161
+
162
+ - c770e7b: The compiler will now return `diagnostics` and unique error codes to be handled by the consumer. For example:
163
+
164
+ ```js
165
+ import type { DiagnosticSeverity, DiagnosticCode } from '@astrojs/compiler/types';
166
+ import { transform } from '@astrojs/compiler';
167
+
168
+ async function run() {
169
+ const { diagnostics } = await transform(file, opts);
170
+
171
+ function log(severity: DiagnosticSeverity, message: string) {
172
+ switch (severity) {
173
+ case DiagnosticSeverity.Error:
174
+ return console.error(message);
175
+ case DiagnosticSeverity.Warning:
176
+ return console.warn(message);
177
+ case DiagnosticSeverity.Information:
178
+ return console.info(message);
179
+ case DiagnosticSeverity.Hint:
180
+ return console.info(message);
181
+ }
182
+ }
183
+
184
+ for (const diagnostic of diagnostics) {
185
+ let message = diagnostic.text;
186
+ if (diagnostic.hint) {
187
+ message += `\n\n[hint] ${diagnostic.hint}`;
188
+ }
189
+
190
+ // Or customize messages for a known DiagnosticCode
191
+ if (diagnostic.code === DiagnosticCode.ERROR_UNMATCHED_IMPORT) {
192
+ message = `My custom message about an unmatched import!`;
193
+ }
194
+ log(diagnostic.severity, message);
195
+ }
196
+ }
197
+ ```
198
+
199
+ ### Patch Changes
200
+
201
+ - 0b24c24: Implement automatic typing for Astro.props in the TSX output
202
+
203
+ ## 0.26.1
204
+
205
+ ### Patch Changes
206
+
207
+ - 920898c: Handle edge case with `noscript` tags
208
+ - 8ee78a6: handle slots that contains the head element
209
+ - 244e43e: Do not hoist import inside object
210
+ - b8cd954: Fix edge case with line comments and export hoisting
211
+ - 52ebfb7: Fix parse/tsx output to gracefully handle invalid HTML (style outside of body, etc)
212
+ - 884efc6: Fix edge case with multi-line export hoisting
213
+
214
+ ## 0.26.0
215
+
216
+ ### Minor Changes
217
+
218
+ - 0be58ab: Improve sourcemap support for TSX output
219
+
220
+ ### Patch Changes
221
+
222
+ - e065e29: Prevent head injection from removing script siblings
223
+
224
+ ## 0.25.2
225
+
226
+ ### Patch Changes
227
+
228
+ - 3a51b8e: Ensure that head injection occurs if there is only a hoisted script
229
+
230
+ ## 0.25.1
231
+
232
+ ### Patch Changes
233
+
234
+ - 41fae67: Do not scope empty style blocks
235
+ - 1ab8280: fix(#517): fix edge case with TypeScript transform
236
+ - a3678f9: Fix import.meta.env usage above normal imports
237
+
238
+ ## 0.25.0
239
+
240
+ ### Minor Changes
241
+
242
+ - 6446ea3: Make Astro styles being printed after user imports
243
+
244
+ ### Patch Changes
245
+
246
+ - 51bc60f: Fix edge cases with `getStaticPaths` where valid JS syntax was improperly handled
247
+
248
+ ## 0.24.0
249
+
250
+ ### Minor Changes
251
+
252
+ - 6ebcb4f: Allow preprocessStyle to return an error
253
+
254
+ ### Patch Changes
255
+
256
+ - abda605: Include filename when calculating scope
257
+
258
+ ## 0.23.5
259
+
260
+ ### Patch Changes
261
+
262
+ - 6bc8e0b: Prevent import assertion from being scanned too soon
263
+
264
+ ## 0.23.4
265
+
266
+ ### Patch Changes
267
+
268
+ - 3b9f0d2: Remove css print escape for experimentalStaticExtraction
269
+
270
+ ## 0.23.3
271
+
272
+ ### Patch Changes
273
+
274
+ - 7693d76: Fix resolution of .jsx modules
275
+
276
+ ## 0.23.2
277
+
278
+ ### Patch Changes
279
+
280
+ - 167ad21: Improve handling of namespaced components when they are multiple levels deep
281
+ - 9283258: Fix quotations in pre-quoted attributes
282
+ - 76fcef3: Better handling for imports which use special characters
283
+
284
+ ## 0.23.1
285
+
286
+ ### Patch Changes
287
+
288
+ - 79376f3: Fix regression with expression rendering
289
+
290
+ ## 0.23.0
291
+
292
+ ### Minor Changes
293
+
294
+ - d8448e2: Prevent printing the doctype in the JS output
295
+
296
+ ### Patch Changes
297
+
298
+ - a28c3d8: Fix handling of unbalanced quotes in expression attributes
299
+ - 28d1d4d: Fix handling of TS generics inside of expressions
300
+ - 356d3b6: Prevent wraping module scripts with scope
301
+
302
+ ## 0.22.1
303
+
304
+ ### Patch Changes
305
+
306
+ - 973103c: Prevents unescaping attribute expressions
307
+
308
+ ## 0.22.0
309
+
310
+ ### Minor Changes
311
+
312
+ - 558c9dd: Generate a stable scoped class that does _NOT_ factor in local styles. This will allow us to safely do style HMR without needing to update the DOM as well.
313
+ - c19cd8c: Update Astro's CSS scoping algorithm to implement zero-specificity scoping, according to [RFC0012](https://github.com/withastro/rfcs/blob/main/proposals/0012-scoped-css-with-preserved-specificity.md).
314
+
315
+ ## 0.21.0
316
+
317
+ ### Minor Changes
318
+
319
+ - 8960d82: New handling for `define:vars` scripts and styles
320
+
321
+ ### Patch Changes
322
+
323
+ - 4b318d5: Do not attempt to hoist styles or scripts inside of `<noscript>`
324
+ - d6ebab6: Fixing missing semicolon on TSX Frontmatter last-entries
325
+
326
+ ## 0.20.0
327
+
328
+ ### Minor Changes
329
+
330
+ - 48d33ff: Removes compiler special casing for the Markdown component
331
+ - 4a5352e: Removes limitation where imports/exports must be at the top of an `.astro` file. Fixes various edge cases around `getStaticPaths` hoisting.
332
+
333
+ ### Patch Changes
334
+
335
+ - 245d73e: Add support for HTML minification by passing `compact: true` to `transform`.
336
+ - 3ecdd24: Update TSX output to also generate TSX-compatible code for attributes containing dots
337
+
338
+ ## 0.19.0
339
+
340
+ ### Minor Changes
341
+
342
+ - fcb4834: Removes fallback for the site configuration
343
+
344
+ ### Patch Changes
345
+
346
+ - 02add77: Fixes many edge cases around tables when used with components, slots, or expressions
347
+ - b23dd4d: Fix handling of unmatched close brace in template literals
348
+ - 9457a91: Fix issue with `{` in template literal attributes
349
+ - c792161: Fix nested expression handling with a proper expression tokenizer stack
350
+
351
+ ## 0.18.2
352
+
353
+ ### Patch Changes
354
+
355
+ - f8547a7: Revert [#448](https://github.com/withastro/compiler/pull/448) for now
356
+
357
+ ## 0.18.1
358
+
359
+ ### Patch Changes
360
+
361
+ - aff2f23: Warning on client: usage on scripts
362
+
363
+ ## 0.18.0
364
+
365
+ ### Minor Changes
366
+
367
+ - 4b02776: Fix handling of `slot` attribute used inside of expressions
368
+
369
+ ### Patch Changes
370
+
371
+ - 62d2a8e: Properly handle nested expressions that return multiple elements
372
+ - 571d6b9: Ensure `html` and `body` elements are scoped
373
+
374
+ ## 0.17.1
375
+
376
+ ### Patch Changes
377
+
378
+ - 3885217: Support `<slot is:inline />` and preserve slot attribute when not inside component
379
+ - ea94a26: Fix issue with fallback content inside of slots
380
+
381
+ ## 0.17.0
382
+
383
+ ### Minor Changes
384
+
385
+ - 3a9d166: Add renderHead injection points
386
+
387
+ ## 0.16.1
388
+
389
+ ### Patch Changes
390
+
391
+ - 9fcc43b: Build JS during the release
392
+
393
+ ## 0.16.0
394
+
395
+ ### Minor Changes
396
+
397
+ - 470efc0: Adds component metadata to the TransformResult
398
+
399
+ ### Patch Changes
400
+
401
+ - c104d4f: Fix #418: duplicate text when only text
402
+
403
+ ## 0.15.2
404
+
405
+ ### Patch Changes
406
+
407
+ - f951822: Fix wasm `parse` to save attribute namespace
408
+ - 5221e09: Fix serialize spread attribute
409
+
410
+ ## 0.15.1
411
+
412
+ ### Patch Changes
413
+
414
+ - 26cbcdb: Prevent side-effectual CSS imports from becoming module metadata
415
+
416
+ ## 0.15.0
417
+
418
+ ### Minor Changes
419
+
420
+ - 702e848: Trailing space at the end of Astro files is now stripped from Component output.
421
+
422
+ ### Patch Changes
423
+
424
+ - 3a1a24b: Fix long-standing bug where a `class` attribute inside of a spread prop will cause duplicate `class` attributes
425
+ - 62faceb: Fixes an issue where curly braces in `<math>` elements would get parsed as expressions instead of raw text.
426
+
427
+ ## 0.14.3
428
+
429
+ ### Patch Changes
430
+
431
+ - 6177620: Fix edge case with expressions inside of tables
432
+ - 79b1ed6: Provides a better error message when we can't match client:only usage to an import statement
433
+ - a4e1957: Fix Astro scoping when `class:list` is used
434
+ - fda859a: Fix json escape
435
+
436
+ ## 0.14.2
437
+
438
+ ### Patch Changes
439
+
440
+ - 6f30e2e: Fix edge case with nested expression inside `<>`
441
+ - 15e3ff8: Fix panic when using a `<slot />` in `head`
442
+ - c048567: Fix edge case with `select` elements and expression children
443
+ - 13d2fc2: Fix #340, fixing behavior of content after an expression inside of `<select>`
444
+ - 9e37a72: Fix issue when multiple client-only components are used
445
+ - 67993d5: Add support for block comment only expressions, block comment only shorthand attributes and block comments in shorthand attributes
446
+ - 59fbea2: Fix #343, edge case with `<tr>` inside component
447
+ - 049dadf: Fix usage of expressions inside `caption` and `colgroup` elements
448
+
449
+ ## 0.14.1
450
+
451
+ ### Patch Changes
452
+
453
+ - 1a82892: Fix bug with `<script src>` not being hoisted
454
+
455
+ ## 0.14.0
456
+
457
+ ### Minor Changes
458
+
459
+ - c0da4fe: Implements [RFC0016](https://github.com/withastro/rfcs/blob/main/proposals/0016-style-script-defaults.md), the new `script` and `style` behavior.
460
+
461
+ ## 0.13.2
462
+
463
+ ### Patch Changes
464
+
465
+ - 014370d: Fix issue with named slots in <head> element
466
+ - da831c1: Fix handling of RegExp literals in frontmatter
467
+
468
+ ## 0.13.1
469
+
470
+ ### Patch Changes
471
+
472
+ - 2f8334c: Update `parse` and `serialize` functions to combine `attributes` and `directives`, fix issue with `serialize` not respecting `attributes`.
473
+ - b308955: Add self-close option to serialize util
474
+
475
+ ## 0.13.0
476
+
477
+ ### Minor Changes
478
+
479
+ - ce3f1a5: Update CSS parser to use `esbuild`, adding support for CSS nesting, `@container`, `@layer`, and other modern syntax features
480
+
481
+ ### Patch Changes
482
+
483
+ - 24a1185: Parser: Always output the `children` property in an element node, even if it has no children
484
+
485
+ ## 0.12.1
486
+
487
+ ### Patch Changes
488
+
489
+ - 097ac47: Parser: Always output the `attribute` property in an element node, even if empty
490
+ - ad62437: Add `serialize` util
491
+ - eb7eb95: Parse: fix escaping of `&` characters in AST output
492
+
493
+ ## 0.12.0
494
+
495
+ ### Minor Changes
496
+
497
+ - c6dd41d: Do not render implicit tags created during the parsing process
498
+ - c6dd41d: Remove "as" option, treats all documents as fragments that generate no implicit tags
499
+ - c6dd41d: Add `parse` function which generates an AST
500
+ - c6dd41d: Adds support for `Astro.self` (as accepted in the [Recursive Components RFC](https://github.com/withastro/rfcs/blob/main/active-rfcs/0000-recursive-components.md)).
501
+
502
+ ### Patch Changes
503
+
504
+ - c6dd41d: Add `fragment` node types to AST definitions, expose Fragment helper to utils
505
+ - c6dd41d: Adds metadata on client:only components
506
+ - c6dd41d: Expose AST types via `@astrojs/compiler/types`
507
+ - c6dd41d: Export `./types` rather than `./types.d.ts`
508
+ - c6dd41d: Fix edge case with Fragment parsing in head, add `fragment` node to AST output
509
+ - c6dd41d: Fix <slot> behavior inside of head
510
+ - c6dd41d: Improve head injection behavior
511
+ - ef0b4b3: Move `typescript` dependency to development dependencies, as it is not needed in the package runtime.
512
+ - c6dd41d: Update exposed types
513
+ - c6dd41d: Remove usage of `escapeHTML` util
514
+ - c6dd41d: Export all types from shared types
515
+ - c6dd41d: Fix `head` behavior and a bug related to ParseFragment
516
+ - c6dd41d: Adds a warning when using an expression with a hoisted script
517
+
518
+ ## 0.12.0-next.9
519
+
520
+ ### Patch Changes
521
+
522
+ - 95ec808: Fix <slot> behavior inside of head
523
+ - 95ec808: Remove usage of `escapeHTML` util
524
+
525
+ ## 0.12.0-next.8
526
+
527
+ ### Patch Changes
528
+
529
+ - 4497628: Improve head injection behavior
530
+
531
+ ## 0.12.0-next.7
532
+
533
+ ### Patch Changes
534
+
535
+ - e26b9d6: Fix edge case with Fragment parsing in head, add `fragment` node to AST output
536
+
537
+ ## 0.12.0-next.6
538
+
539
+ ### Patch Changes
540
+
541
+ - 37ef1c1: Fix `head` behavior and a bug related to ParseFragment
542
+
543
+ ## 0.12.0-next.5
544
+
545
+ ### Patch Changes
546
+
547
+ - 97cf66b: Adds metadata on client:only components
548
+
549
+ ## 0.12.0-next.4
550
+
551
+ ### Patch Changes
552
+
553
+ - e2061dd: Export all types from shared types
554
+
555
+ ## 0.12.0-next.3
556
+
557
+ ### Patch Changes
558
+
559
+ - ef69b74: Export `./types` rather than `./types.d.ts`
560
+
561
+ ## 0.12.0-next.2
562
+
563
+ ### Patch Changes
564
+
565
+ - 073b0f1: Adds a warning when using an expression with a hoisted script
566
+
567
+ ## 0.12.0-next.1
568
+
569
+ ### Patch Changes
570
+
571
+ - a539d53: Update exposed types
572
+
573
+ ## 0.12.0-next.0
574
+
575
+ ### Minor Changes
576
+
577
+ - 8ce39c7: Do not render implicit tags created during the parsing process
578
+ - 41b825a: Remove "as" option, treats all documents as fragments that generate no implicit tags
579
+ - 483b34b: Add `parse` function which generates an AST
580
+ - 9e5e2f8: Adds support for `Astro.self` (as accepted in the [Recursive Components RFC](https://github.com/withastro/rfcs/blob/main/active-rfcs/0000-recursive-components.md)).
581
+
582
+ ### Patch Changes
583
+
584
+ - 16b167c: Expose AST types via `@astrojs/compiler/types`
585
+
586
+ ## 0.11.4
587
+
588
+ ### Patch Changes
589
+
590
+ - 99b5de2: Reset tokenizer state when a raw element that is self-closing is encountered.
591
+
592
+ This fixes the handling of self-closing elements like `<title />` and `<script />` when used with `set:html`.
593
+
594
+ ## 0.11.3
595
+
596
+ ### Patch Changes
597
+
598
+ - dcf15bf: Fixes bug causing a crash when using Astro.resolve on a hoisted script
599
+
600
+ ## 0.11.2
601
+
602
+ ### Patch Changes
603
+
604
+ - 41cc6ef: Fix memory issue caused by duplicate WASM instantiations
605
+
606
+ ## 0.11.1
607
+
608
+ ### Patch Changes
609
+
610
+ - 4039682: Fixes hoist script tracking when passed a variable
611
+
612
+ ## 0.11.0
613
+
614
+ ### Minor Changes
615
+
616
+ - f5d4006: Switch from TinyGo to Go's built-in WASM output. While this is an unfortunate size increase for our `.wasm` file, it should also be significantly more stable and cut down on hard-to-reproduce bugs.
617
+
618
+ Please see https://github.com/withastro/compiler/pull/291 for more details.
619
+
620
+ ## 0.11.0-next--wasm.0
621
+
622
+ ### Minor Changes
623
+
624
+ - 9212ccc: Switch from TinyGo to Go's built-in WASM output. While this is an unfortunate size increase for our `WASM` file, it should also be significantly more stable and cut down on hard-to-reproduce bugs.
625
+
626
+ Please see https://github.com/withastro/compiler/pull/291 for more details.
627
+
628
+ ## 0.10.2
629
+
630
+ ### Patch Changes
631
+
632
+ - 7f7c65c: Fix conditional rendering for special elements like `iframe` and `noscript`
633
+ - 9d789c9: Fix handling of nested template literals inside of expressions
634
+ - 5fa9e53: Fix handling of special characters inside of expressions
635
+ - 8aaa956: Formalize support for magic `data-astro-raw` attribute with new, official `is:raw` directive
636
+ - c698350: Improve MathML support. `{}` inside of `<math>` is now treated as raw text rather than an expression construct.
637
+
638
+ ## 0.10.1
639
+
640
+ ### Patch Changes
641
+
642
+ - 38ae39a: Add support for `set:html` and `set:text` directives, as designed in the [`set:html` RFC](https://github.com/withastro/rfcs/blob/main/active-rfcs/0000-set-html.md).
643
+
644
+ ## 0.10.0
645
+
646
+ ### Minor Changes
647
+
648
+ - 02d41a8: Adds support for `Astro.self` (as accepted in the [Recursive Components RFC](https://github.com/withastro/rfcs/blob/main/active-rfcs/0000-recursive-components.md)).
649
+
650
+ ### Patch Changes
651
+
652
+ - 4fe522b: Fixes inclusion of define:vars scripts/styles using the StaticExtraction flag
653
+
654
+ ## 0.9.2
655
+
656
+ ### Patch Changes
657
+
658
+ - 92cc76b: Fix wasm build for use in Astro
659
+
660
+ ## 0.9.1
661
+
662
+ ### Patch Changes
663
+
664
+ - 85d35a5: Revert previous change that broke Windows
665
+
666
+ ## 0.9.0
667
+
668
+ ### Minor Changes
669
+
670
+ - c1a0172: changing raw_with_expression_loop in tokenizer to only handle string that has '`' differently otherwise it should treat it as normal string
671
+
672
+ ### Patch Changes
673
+
674
+ - 1fa2162: Improved types for TransformResult with hoisted scripts
675
+
676
+ ## 0.8.2
677
+
678
+ ### Patch Changes
679
+
680
+ - 502f8b8: Adds a new property, `scripts`, to `TransformResult`
681
+
682
+ ## 0.8.1
683
+
684
+ ### Patch Changes
685
+
686
+ - cd277e2: Fix bug with data-astro-raw detection
687
+
688
+ ## 0.8.0
689
+
690
+ ### Minor Changes
691
+
692
+ - 3690968: Passes the Pathname to createAstro instead of import.meta.url
693
+
694
+ ## 0.7.4
695
+
696
+ ### Patch Changes
697
+
698
+ - afc1e82: Remove console log (sorry!)
699
+
700
+ ## 0.7.3
701
+
702
+ ### Patch Changes
703
+
704
+ - cc24069: Fix some edge cases with expressions inside of `<table>` elements
705
+ - 086275c: Fix edge case with textarea inside expression
706
+
707
+ ## 0.7.2
708
+
709
+ ### Patch Changes
710
+
711
+ - 899e48d: Fix issue with active formatting elements by marking expressions as unique scopes
712
+
713
+ ## 0.7.1
714
+
715
+ ### Patch Changes
716
+
717
+ - fa039dd: Fix tokenization of attribute expression containing the solidus (`/`) character
718
+ - e365c3c: Fix bug with expressions inside of <table> elements (without reverting a previous fix to expressions inside of <a> elements)
719
+ - 7c5889f: Fix bug with `@keyframes` scoping
720
+ - df74ab3: Fix bug where named grid columns (like `[content-start]`) would be scoped, producing invalid CSS
721
+ - abe37ca: Fix handling of components and expressions inside of `<noscript>`
722
+ - 8961cf4: Fix a logical error with expression tokenization when using nested functions. Previously, only the first brace pair would be respected and following pairs would be treated as expression boundaries.
723
+
724
+ ## 0.7.0
725
+
726
+ ### Minor Changes
727
+
728
+ - 43cbac3: Adds metadata on hydration directives used by the component
729
+
730
+ ## 0.6.2
731
+
732
+ ### Patch Changes
733
+
734
+ - e785310: Fix issue with import assertions creating additional imports
735
+
736
+ ## 0.6.1
737
+
738
+ ### Patch Changes
739
+
740
+ - e40ea9c: Include LICENSE information
741
+
742
+ ## 0.6.0
743
+
744
+ ### Minor Changes
745
+
746
+ - b9e2b4b: Adds option to make CSS be extracted statically
747
+
748
+ ## 0.5.7
749
+
750
+ ### Patch Changes
751
+
752
+ - 75bd730: Fix regression with Components mixed with active formatting elements
753
+
754
+ ## 0.5.6
755
+
756
+ ### Patch Changes
757
+
758
+ - 7ca419e: Improve behavior of empty expressions in body and attributes, where `{}` is equivalent to `{(void 0)}`
759
+
760
+ ## 0.5.5
761
+
762
+ ### Patch Changes
763
+
764
+ - 7a41d7b: Fix `<>` syntax edge case inside of expressions
765
+ - b0d35b9: Fix edge case with conditional scripts
766
+
767
+ ## 0.5.4
768
+
769
+ ### Patch Changes
770
+
771
+ - f2e0322: Do not reconstruct active formatting elements on expression start
772
+ - 0103285: Bugfix: expressions in table context
773
+
774
+ ## 0.5.3
775
+
776
+ ### Patch Changes
777
+
778
+ - 50cbc57: Fix fragment expression behavior edge case
779
+
780
+ ## 0.5.2
781
+
782
+ ### Patch Changes
783
+
784
+ - 8f0e3d7: Fix fragment parsing bugs when frontmatter is missing or top-level expressions are present
785
+
786
+ ## 0.5.1
787
+
788
+ ### Patch Changes
789
+
790
+ - 1f0ba41: Fix bug when fragment parsing frontmatter is missing
791
+
792
+ ## 0.5.0
793
+
794
+ ### Minor Changes
795
+
796
+ - 901faef: Passes projectRoot to createAstro
797
+
798
+ ## 0.4.0
799
+
800
+ ### Minor Changes
801
+
802
+ - 7e1aded: Change behavior of `as: "fragment"` option to support arbitrary `head` and `body` tags
803
+
804
+ ## 0.3.9
805
+
806
+ ### Patch Changes
807
+
808
+ - 2884a82: Bugfix: CSS comments insert semicolon
809
+
810
+ ## 0.3.8
811
+
812
+ ### Patch Changes
813
+
814
+ - 2c8f5d8: Fix another component-only edge case
815
+
816
+ ## 0.3.7
817
+
818
+ ### Patch Changes
819
+
820
+ - eb0d17f: Fix edge case with files that contain a single component
821
+
822
+ ## 0.3.6
823
+
824
+ ### Patch Changes
825
+
826
+ - af003e9: Fix syntax error in transformed output
827
+
828
+ ## 0.3.5
829
+
830
+ ### Patch Changes
831
+
832
+ - bca7e00: Fixed issue where an Astro Components could only add one style or script
833
+ - 2a2f951: Fix regression where leading `<style>` elements could break generated tags
834
+ - db162f8: Fix case-sensitivity of void elements
835
+ - 44ee189: Fixed issue where expressions did not work within SVG elements
836
+ - 9557113: Fix panic when preprocessed style is empty
837
+
838
+ ## 0.3.4
839
+
840
+ ### Patch Changes
841
+
842
+ - 351f298: Fix edge case with with `textarea` inside of a Component when the document generated an implicit `head` tag
843
+ - 0bcfd4b: Fix CSS scoping of \* character inside of calc() expressions
844
+ - 4be512f: Encode double quotes inside of quoted attributes
845
+ - ad865e5: Fix behavior of expressions inside of <table> elements
846
+
847
+ ## 0.3.3
848
+
849
+ ### Patch Changes
850
+
851
+ - 6d2a3c2: Fix handling of top-level component nodes with leading styles
852
+ - 2ce10c6: Fix "call to released function" issue
853
+
854
+ ## 0.3.2
855
+
856
+ ### Patch Changes
857
+
858
+ - 8800f80: Fix comments and strings inside of attribute expressions
859
+
860
+ ## 0.3.1
861
+
862
+ ### Patch Changes
863
+
864
+ - 432eaaf: Fix for compiler regression causing nil pointer
865
+
866
+ ## 0.3.0
867
+
868
+ ### Minor Changes
869
+
870
+ - 1255477: Drop support for elements inside of Frontmatter, which was undefined behavior that caused lots of TypeScript interop problems
871
+
872
+ ### Patch Changes
873
+
874
+ - 44dc0c6: Fixes issue with \x00 character on OSX
875
+ - d74acfa: Fix regression with expressions inside of <select> elements
876
+ - f50ae69: Bugfix: don’t treat import.meta as import statement
877
+
878
+ ## 0.2.27
879
+
880
+ ### Patch Changes
881
+
882
+ - 460c1e2: Use `$metadata.resolvePath` utility to support the `client:only` directive
883
+
884
+ ## 0.2.26
885
+
886
+ ### Patch Changes
887
+
888
+ - 3e5ef91: Implement getStaticPaths hoisting
889
+ - 8a434f9: Fix namespace handling to support attributes like `xmlns:xlink`
890
+
891
+ ## 0.2.25
892
+
893
+ ### Patch Changes
894
+
895
+ - 59f36cb: Fix custom-element slot behavior to remain spec compliant
896
+ - 79b2e6f: Fix style/script ordering
897
+ - 6041ee5: Add support for `client:only` directive
898
+ - 2cd35f6: Fix apostrophe handling inside of elements which are inside of expressions ([#1478](https://github.com/snowpackjs/astro/issues/1478))
899
+
900
+ ## 0.2.24
901
+
902
+ ### Patch Changes
903
+
904
+ - bfd1b94: Fix issue with `style` and `script` processing where siblings would be skipped
905
+ - 726d272: Fix <Fragment> and <> handling
906
+ - f052465: Fix CSS variable parsing in the scoped CSS transform
907
+
908
+ ## 0.2.23
909
+
910
+ ### Patch Changes
911
+
912
+ - 632c29b: Fix nil pointer dereference when every element on page is a component
913
+ - 105a159: Fix bug where text inside of elements inside of an expression was not read properly (https://github.com/snowpackjs/astro/issues/1617)
914
+
915
+ ## 0.2.22
916
+
917
+ ### Patch Changes
918
+
919
+ - 04c1b63: Fix bug with dynamic classes
920
+
921
+ ## 0.2.21
922
+
923
+ ### Patch Changes
924
+
925
+ - 7b46e9f: Revert automatic DOCTYPE injection to fix package
926
+
927
+ ## 0.2.20
928
+
929
+ ### Patch Changes
930
+
931
+ - 39298e4: Fix small bugs with script/style hoisting behavior
932
+ - bd1014a: Bugfix: style tags in SVG
933
+
934
+ ## 0.2.19
935
+
936
+ ### Patch Changes
937
+
938
+ - 318dd69: Fix handling of self-closing "raw" tags like <script /> and <style />
939
+ - 9372c10: Support `define:vars` with root `html` element on pages
940
+ - c4491cd: Fix bug with <script define:vars> when not using the `hoist` attribute
941
+
942
+ ## 0.2.18
943
+
944
+ ### Patch Changes
945
+
946
+ - 2f4b772: Prevents overrunning an array when checking for raw attribute
947
+
948
+ ## 0.2.17
949
+
950
+ ### Patch Changes
951
+
952
+ - 4f9155a: Bugfix: fix character limit of 4096 characters
953
+ - 83df04c: Upgrade to Go 1.17
954
+
955
+ ## 0.2.16
956
+
957
+ ### Patch Changes
958
+
959
+ - 9ad8da7: Allows a data-astro-raw attr to parse children as raw text
960
+ - 61b77de: Bugfix: CSS and selector scoping
961
+
962
+ ## 0.2.15
963
+
964
+ ### Patch Changes
965
+
966
+ - 8fbae5e: Bugfix: fix component detection bug in parser
967
+ - 37b5b6e: Bugfix: wait to release processStyle() until after fn call
968
+
969
+ ## 0.2.14
970
+
971
+ ### Patch Changes
972
+
973
+ - f59c886: Bugfix: allow for detection of void tags (e.g. <img>)
974
+ - 4c8d14a: Fixes textContent containing a forward slash
975
+
976
+ ## 0.2.13
977
+
978
+ ### Patch Changes
979
+
980
+ - f262b61: Fix for string template usage within expressions
981
+
982
+ ## 0.2.12
983
+
984
+ ### Patch Changes
985
+
986
+ - c9fa9eb: Fix for apostrophe within elements
987
+
988
+ ## 0.2.11
989
+
990
+ ### Patch Changes
991
+
992
+ - 27629b2: Reverts the apostrophe change that broke markdown parsing
993
+
994
+ ## 0.2.10
995
+
996
+ ### Patch Changes
997
+
998
+ - 57eb728: Fixes hydrated scripts not recognized when using fragment transformation
999
+
1000
+ ## 0.2.9
1001
+
1002
+ ### Patch Changes
1003
+
1004
+ - 3ea8d8c: Fix for string interpolation within titles
1005
+ - ef7cb1e: Fixes bug with textContent containing apostrophe character
1006
+
1007
+ ## 0.2.8
1008
+
1009
+ ### Patch Changes
1010
+
1011
+ - b2d5564: Fixes wasm build
1012
+
1013
+ ## 0.2.6
1014
+
1015
+ ### Patch Changes
1016
+
1017
+ - fix small issue with `preprocessStyle` handling of `null` or `undefined`
1018
+
1019
+ ## 0.2.5
1020
+
1021
+ ### Patch Changes
1022
+
1023
+ - Fix issue with CI deployment
1024
+
1025
+ ## 0.2.4
1026
+
1027
+ ### Patch Changes
1028
+
1029
+ - 4410c5a: Add support for a `preprocessStyle` function
1030
+ - 934e6a6: Chore: add linting, format code
1031
+
1032
+ ## 0.1.15
1033
+
1034
+ ### Patch Changes
1035
+
1036
+ - 5c02abf: Fix split so it always splits on first non-import/export
1037
+ - 93c1cd9: Bugfix: handle RegExp in Astro files
1038
+ - 94c59fa: Bugfix: tokenizer tries to parse JS comments
1039
+ - 46a5c75: Adds the top-level Astro object
1040
+ - 7ab9148: Improve JS scanning algorithm to be more fault tolerant, less error prone
1041
+
1042
+ ## 0.1.12
1043
+
1044
+ ### Patch Changes
1045
+
1046
+ - 96dc356: Adds hydrationMap support for custom elements
1047
+
1048
+ ## 0.1.11
1049
+
1050
+ ### Patch Changes
1051
+
1052
+ - 939283d: Adds the component export for use in hydration
1053
+
1054
+ ## 0.1.10
1055
+
1056
+ ### Patch Changes
1057
+
1058
+ - 3a336ef: Adds a hydration map to enable hydration within Astro components
1059
+
1060
+ ## 0.1.9
1061
+
1062
+ ### Patch Changes
1063
+
1064
+ - 7d887de: Allows the Astro runtime to create the Astro.slots object
1065
+
1066
+ ## 0.1.8
1067
+
1068
+ ### Patch Changes
1069
+
1070
+ - d159658: Publish via PR
1071
+
1072
+ ## 0.1.7
1073
+
1074
+ ### Patch Changes
1075
+
1076
+ - c52e69b: Include astro.wasm in the package
1077
+
1078
+ ## 0.1.6
1079
+
1080
+ ### Patch Changes
1081
+
1082
+ - bd05f7c: Actually include _any_ files?
1083
+
1084
+ ## 0.1.5
1085
+
1086
+ ### Patch Changes
1087
+
1088
+ - c4ed69e: Includes the wasm binary in the npm package
1089
+
1090
+ ## 0.1.4
1091
+
1092
+ ### Patch Changes
1093
+
1094
+ - 2f1f1b8: Pass custom element tag names to renderComponent as strings
1095
+
1096
+ ## 0.1.3
1097
+
1098
+ ### Patch Changes
1099
+
1100
+ - e4e2de5: Update to [`tinygo@0.20.0`](https://github.com/tinygo-org/tinygo/releases/tag/v0.20.0) and remove `go@1.16.x` restriction.
1101
+ - ae71546: Add support for `fragment` compilation, to be used with components rather than pages
1102
+ - 8c2aaf9: Allow multiple top-level conditional expressions
1103
+
1104
+ ## 0.1.0
1105
+
1106
+ ### Patch Changes
1107
+
1108
+ - c9407cd: Fix for using conditionals at the top-level
package/LICENSE ADDED
@@ -0,0 +1,53 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 [Astro contributors](https://github.com/withastro/compiler/graphs/contributors)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ """
24
+ This license applies to parts of the `internal/` subdirectory originating from
25
+ the https://cs.opensource.google/go/x/net/+/master:html/ repository:
26
+
27
+ Copyright (c) 2009 The Go Authors. All rights reserved.
28
+
29
+ Redistribution and use in source and binary forms, with or without
30
+ modification, are permitted provided that the following conditions are
31
+ met:
32
+
33
+ * Redistributions of source code must retain the above copyright
34
+ notice, this list of conditions and the following disclaimer.
35
+ * Redistributions in binary form must reproduce the above
36
+ copyright notice, this list of conditions and the following disclaimer
37
+ in the documentation and/or other materials provided with the
38
+ distribution.
39
+ * Neither the name of Google Inc. nor the names of its
40
+ contributors may be used to endorse or promote products derived from
41
+ this software without specific prior written permission.
42
+
43
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # Astro Compiler
2
+
3
+ Astro’s [Go](https://golang.org/) + WASM compiler.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ npm install @astrojs/compiler
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ #### Transform `.astro` to valid TypeScript
14
+
15
+ The Astro compiler can convert `.astro` syntax to a TypeScript Module whose default export generates HTML.
16
+
17
+ **Some notes**...
18
+
19
+ - TypeScript is valid `.astro` syntax! The output code may need an additional post-processing step to generate valid JavaScript.
20
+ - `.astro` files rely on a server implementation exposed as `astro/runtime/server/index.js` in the Node ecosystem. Other runtimes currently need to bring their own rendering implementation and reference it via `internalURL`. This is a pain point we're looking into fixing.
21
+
22
+ ```js
23
+ import { transform } from '@astrojs/compiler';
24
+
25
+ const result = await transform(source, {
26
+ site: 'https://mysite.dev',
27
+ sourcefile: '/Users/astro/Code/project/src/pages/index.astro',
28
+ sourcemap: 'both',
29
+ internalURL: 'astro/runtime/server/index.js',
30
+ });
31
+ ```
32
+
33
+ #### Parse `.astro` and return an AST
34
+
35
+ The Astro compiler can emit an AST using the `parse` method.
36
+
37
+ **Some notes**...
38
+
39
+ - Position data is currently incomplete and in some cases incorrect. We're working on it!
40
+ - A `TextNode` can represent both HTML `text` and JavaScript/TypeScript source code.
41
+ - The `@astrojs/compiler/utils` entrypoint exposes a `walk` function that can be used to traverse the AST. It also exposes the `is` helper which can be used as guards to derive the proper types for each `node`.
42
+
43
+ ```js
44
+ import { parse } from '@astrojs/compiler';
45
+ import { walk, is } from '@astrojs/compiler/utils';
46
+
47
+ const result = await parse(source, {
48
+ position: false, // defaults to `true`
49
+ });
50
+
51
+ walk(result.ast, (node) => {
52
+ // `tag` nodes are `element` | `custom-element` | `component`
53
+ if (is.tag(node)) {
54
+ console.log(node.name);
55
+ }
56
+ });
57
+ ```
58
+
59
+ ## Develop
60
+
61
+ ### VSCode / CodeSpaces
62
+
63
+ A `devcontainer` configuration is available for use with VSCode's [Remote Development extension pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) and GitHub CodeSpaces.
64
+
65
+ ## Contributing
66
+
67
+ [CONTRIBUTING.md](./CONTRIBUTING.md)
package/astro.wasm ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@astrojs/compiler",
3
+ "author": "withastro",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "bugs": "https://github.com/withastro/compiler/issues",
7
+ "homepage": "https://astro.build",
8
+ "version": "0.0.0-module-id-20221123173459",
9
+ "main": "./node/index.js",
10
+ "types": "./node",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/withastro/compiler.git"
14
+ },
15
+ "exports": {
16
+ ".": {
17
+ "browser": "./browser/index.js",
18
+ "import": "./node/index.js",
19
+ "default": "./browser/index.js"
20
+ },
21
+ "./utils": {
22
+ "browser": "./browser/utils.js",
23
+ "import": "./node/utils.js",
24
+ "default": "./browser/utils.js"
25
+ },
26
+ "./astro.wasm": "./astro.wasm",
27
+ "./types": "./types.d.ts"
28
+ },
29
+ "devDependencies": {
30
+ "@jridgewell/trace-mapping": "^0.3.16",
31
+ "@types/node": "^16.11.64",
32
+ "@types/sass": "^1.43.1",
33
+ "acorn": "^8.8.1",
34
+ "typescript": "~4.8.4"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc -p ."
38
+ }
39
+ }
package/types.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './shared/types';
package/utils.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './node/utils';