diff --git a/packages/ts-optimizer/BENCHMARKS.md b/packages/ts-optimizer/BENCHMARKS.md new file mode 100644 index 00000000000..acacd6d2e5c --- /dev/null +++ b/packages/ts-optimizer/BENCHMARKS.md @@ -0,0 +1,259 @@ +# Performance Benchmark History + +Wall-time perf comparison of the TypeScript optimizer (this repo) against the SWC reference (`@qwik.dev/optimizer`'s NAPI binding). Use this doc to spot regressions and to track whether perf-targeted work is moving the needle. + +The numbers come from `tests/benchmark/optimizer-benchmark.test.ts`. Append a row whenever you've shipped (or are about to ship) a change that could plausibly affect throughput. + +--- + +## What's measured + +Two benchmarks defined in `tests/benchmark/optimizer-benchmark.test.ts`, both running over real Qwik source: + +| Benchmark | Input | Description | +| ------------ | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| **BENCH-01** | `$QWIK_HOME/packages/**/*.{ts,tsx,js,jsx}` (excluding `node_modules`/`dist`/`.turbo`) — currently ~1391 files | "Whole monorepo" pass — exercises file-discovery + per-file batching cost | +| **BENCH-02** | `$QWIK_HOME/packages/qwik/src/core/tests/component.spec.tsx` — 3860 lines | Worst-case single file — a heavy component-spec that stresses extraction + segment generation | + +Each benchmark warms up once, then takes the **min wall-time** across `MEASURED_RUNS = 2` measured runs. The `Ratio` column is `TS time ÷ SWC time`. + +The current CI assertion caps are **1.15×** for BENCH-01 and **1.5×** for BENCH-02 — neither has been hit yet (see "Trend so far" below). + +--- + +## How to add a new data point + +1. Make sure the SWC reference binding is fresh: + + ``` + cd "$QWIK_HOME" && pnpm build.platform + ``` + + This rebuilds `$QWIK_HOME/packages/optimizer/bindings/qwik..node`. Skip if the qwik checkout hasn't moved since your last run. + +2. From this repo: + + ``` + BENCH=1 pnpm vitest run tests/benchmark/optimizer-benchmark.test.ts --no-file-parallelism + ``` + +3. Both benchmarks will print `SWC time:`, `TS time:`, and `Ratio:` lines. Both will assertion-fail (the caps haven't been met) — that's expected; the goal is to capture the numbers, not pass. + +4. Prepend a row to each table below with: date, the merge SHA your numbers describe, a short workstream label, the three numbers, and any notes. + +5. If your run targeted perf, append a one-line entry to the **"Trend so far"** section explaining what moved. + +> **If the SWC binding was rebuilt against a different qwik commit since the last row,** note this in the Notes column. Both numerator and denominator change in that case, so SWC and TS times across rows are no longer apples-to-apples — only Ratio remains comparable. + +--- + +## Methodology caveats + +- **Numbers carry ~5–15% machine-state variance.** Running the same commit twice on the same machine produced 1465ms vs 1526ms on BENCH-01 (4% spread) and 91ms vs 96ms on BENCH-02 (5% spread). Don't read narrow row-to-row deltas as signal — only deltas that hold across multiple runs, or that exceed the variance band, mean anything. +- The reference SWC binding is rebuilt rarely; SWC times across rows are expected to be roughly constant at ~550ms for BENCH-01 and ~20ms for BENCH-02. **TS times are the meaningful axis.** +- Measurements are taken on `darwin-arm64` (Apple M-series). Other platforms will have different absolute timings — ratios should be roughly comparable. If you add a row from a different platform, mark it in the Notes column. +- The benchmark does _not_ isolate CPU governor, freeze interrupts, or pin to performance cores. It's a quick wall-time check, not a microbenchmark. For perf-targeted work, run the benchmark several times and take the minimum. + +--- + +## BENCH-01 — Full monorepo (~1391 files) + +| Date | Commit | Workstream | SWC ms | TS ms | Ratio | Notes | +| -------------- | ----------------------------------- | -------------------------------------------------------------------------------- | ------ | ----- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **2026-06-11** | **OSS-496 branch** | **Phase-1 extraction fused into the gather walk + marker prefilter** | 568 | 1346 | **2.42×** | Interleaved same-session pairs (3×): branch 1346–1368ms vs `main` 1370–1477ms — consistent direction every pair, **−1.7% min wall** (at the variance edge, not over-claimed). An intermediate fusion-only build measured **+5%** (non-trigger modules newly paying tracker + buffers); the marker prefilter + lazy lexical frames + zero-extraction classification/scope-entry skips clawed it back below `main`. Census: walks 1,999 → **826** (−58.7%); trigger + jsx-only at 1 walk/module, 565/783 passthrough modules skip the walk entirely. Pre-merge SHA. | +| **2026-06-11** | **OSS-495 branch** | **ScopeTracker builds during the gather walk (build walk deleted)** | 553 | 1343 | **2.43×** | Min of 3 (1343–1414ms, 2.43–2.59×). Same-session `main`: 1366–1401ms, 2.48–2.54× — bands overlap, **within variance** (spike projected ≈neutral: eliminated-walk savings ~28ms vs ~16ms new unconditional bookkeeping). The win is the census: total program walks 2,477 → 1,999 (−19.3%); trigger modules 3 → 2 walks (478 standalone build walks gone). Pre-merge SHA. | +| **2026-06-11** | **OSS-491 branch** | **Phase-0.5 flatten prefilter + lazy MagicString** | 563 | 1387 | **2.46×** | Min of 3 (1387–1456ms, 2.46–2.58×). Same-session `main`: 1410–1431ms, 2.51–2.53× — bands overlap, **within variance**. The win is the census: monorepo Phase-0.5 walks 1,391 → 485 (−65%), MagicString ctors 1,391 → 12 (−99%). Pre-merge SHA. | +| **2026-06-11** | **OSS-490 branch** | **MagicString churn: JSX write memo + lazy session edits + skip-range index** | 562 | 1428 | **2.54×** | Min of 3 (1428–1445ms, 2.54–2.62×). Same-session `main`: 1487–1496ms, 2.63–2.66× — bands don't overlap; **−4.0% TS wall**. Pre-merge SHA. | +| **2026-06-11** | **OSS-489 branch** | **session churn: combined field-map extractor + memo cap 16 + w-call prefilter** | 554 | 1454 | **2.62×** | Min of 3 (1454–1486ms, 2.62–2.72×). Same-session `main`: 1464–1495ms, 2.69–2.72× — bands overlap, **within variance** (session parses were ~5% of self-time). The win is the census: monorepo session parses 6,289 → 5,646 (−10.2%), sessions 13,428 → 12,502. | +| **2026-06-10** | **OSS-488 branch** | **scope-bindings walk fused into gather walk** | 553 | 1456 | **2.63×** | Min of 3 (1456–1568ms, 2.63–2.85×). Same-session `main`: 1474–1600ms, 2.69–2.91× — bands overlap, **within variance** (as the ticket predicted for one walk per module). The win is the census: standalone bindings walks 1,994 → 1,404 (−590, one per parent JSX module). Pre-merge SHA. | +| **2026-06-10** | **OSS-487 branch** | **perf micros: segment-usage sweep + wireMigration subtree walk + regex hoists** | 549 | 1482 | **2.69×** | Min of 3 (1482–1495ms, 2.69–2.72×). Same-session `main`: 1528–1609ms, 2.80–2.91× — −3% TS wall, at the variance edge; not claimed as a win. Pre-merge SHA. | +| **2026-06-10** | **OSS-486 step-2 branch** | **group-2 session threading (parse memo + canonical wrapper)** | 548 | 1623 | **2.96×** | First wall movement of the track: all 3 runs (2.94–3.00×) below the baseline band (3.04–3.08×). Parses −47% (18,109 → 9,572 mono). Pre-merge SHA. | +| **2026-06-10** | **OSS-486 step-1 branch (PR #261)** | **group-1 walk fusion (`computeClosureFreeIdentifiers`)** | 550 | 1684 | **3.06×** | Wall-neutral (min of 3: 1684–1718ms). Walk invocations −35% (30,344 → 19,824 mono); the eliminated walks were closure-subtree-sized, so count ≠ wall. Pre-merge SHA. | +| **2026-06-10** | **`6204de8`** | **post #257 — OSS-485 fix; Track D baseline** | 546 | 1674 | **3.06×** | First measurable BENCH-01 run since 2026-05-13 (OSS-485's whole-buffer-overwrite crash blocked it). Min of 3 runs (TS 1674–1687ms, ratio 3.04–3.08×). ~7% TS-wall growth vs the last row is accumulated feature-work cost — see "Update 2026-06-10". | +| **2026-05-13** | **`b792bf6`** | **PR #56 branch HEAD — post-OSS-365 + F8c crash fix** | 552 | 1568 | **2.83×** | code-health #2: shared AST across module-cleanup post-process pipeline + substring re-parse eliminated. Includes flatten-destructures crash fix. Pre-merge — SHA will change on squash. | +| 2026-05-13 | `1df6b8d` | post #54 — OSS-364 | 547 | 1576 | 2.88× | code-health #1: event-capture-promotion walks 5→2 via pre-collection. Crash fix applied for measurement (same fix as the b792bf6 row). | +| 2026-05-13 | `ee3be65` | post #52 — F8c / OSS-363 | 552 | 1549 | 2.80× | F8c: new `flatten-destructures.ts` Phase 0.5 step + rawProps gate + compound-destructure const classification. Crash fix applied for measurement (BENCH-01 crashes on plain HEAD due to the magic-string overwrite bug). | +| 2026-05-09 | `dbe32d2` | post #36 — pre-F1b/F8/code-health | 549 | 1475 | **2.69×** | post-Sub-C — refactor track v2 fully closed; orchestrator at 34 lines | +| 2026-05-09 | `e8a705b` | post #34 — OSS-357 (Sub-B) | 552 | 1485 | 2.69× | migration-wiring + nested call-sites + nested QRL decls extracted | +| 2026-05-09 | `42ef260` | post #32 — OSS-356 (Sub-A) | 548 | 1549 | 2.83× | Prep + inline-strategy + shared rawProps helper extracted (single noisy run; Sub-B + Sub-C re-stabilise) | +| 2026-05-09 | `4673e07` | post #27 — pre-track-v2 baseline | 550 | 1465 | 2.66× | post-OSS-355 + post-merge-routine codification | +| 2026-05-09 | `854f04b` | post #23 — OSS-354 | 557 | 1514 | 2.72× | closure-form `resolveConstLiterals` + prod-rename sync | +| 2026-05-08 | `29a439e` | post #22 — OSS-353 | 582 | 1571 | 2.70× | closure-node threading; per-extraction body re-parse dropped | +| 2026-05-08 | `3b8eac6` | post #18 — OSS-350 | 574 | 1589 | 2.77× | `preParsedModule` plumbing — single shared parse | +| 2026-05-08 | `b903652` | post #14 — OSS-346 | 571 | 1618 | 2.83× | `generateSegmentCode` 9-phase sequencer extracted | +| 2026-05-07 | `d3f4387` | post #11 — OSS-340 | 575 | 1567 | 2.72× | refactor v1 close — predicates module | +| 2026-05-07 | `dd450a6` | post #7 — OSS-341 | 574 | 1572 | 2.74× | CI infrastructure landed | +| 2026-05-07 | `e98cbff` | post #5 — F1 fix | 572 | 1635 | 2.86× | first TS optimizer code change — `_ref` indirection | +| 2026-05-06 | `d3226c3` | pre-code baseline | 553 | 1558 | 2.82× | "Group All Convergence Failures" — last commit before code work | + +## BENCH-02 — Worst-case single file (`component.spec.tsx`, 3860 lines) + +| Date | Commit | Workstream | SWC ms | TS ms | Ratio | Notes | +| -------------- | ----------------------------------- | -------------------------------------------------------------------------------- | ------ | ----- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **2026-06-11** | **OSS-496 branch** | **Phase-1 extraction fused into the gather walk + marker prefilter** | 19 | 65 | **3.28×** | Interleaved same-session pairs (3×): branch 65–73ms vs `main` 67–69ms — bands overlap, **within variance** (the worst-case file is a single trigger module: its two walks become one, but handler work dominates traversal on one file). Pre-merge SHA. | +| **2026-06-11** | **OSS-495 branch** | **ScopeTracker builds during the gather walk (build walk deleted)** | 19 | 63 | **3.21×** | Min of 3 (63–71ms, 3.21–3.63×). Same-session `main`: 66–69ms, 3.31–3.47× — bands overlap, **within variance** (one eliminated walk on a single trigger file is below the noise floor). Pre-merge SHA. | +| **2026-06-11** | **OSS-491 branch** | **Phase-0.5 flatten prefilter + lazy MagicString** | 20 | 64 | **3.20×** | Min of 3 (64–67ms, 3.20–3.30×). Same-session `main`: 65–68ms, 3.33–3.42× — bands overlap, **within variance**, as the ticket predicted (the worst-case file is `component$`-dense, so its walk survives the prefilter; only the per-module ctor is saved). 30-iter harness identical (2132 vs 2124ms). Pre-merge SHA. | +| **2026-06-11** | **OSS-490 branch** | **MagicString churn: JSX write memo + lazy session edits + skip-range index** | 19 | 64 | **3.28×** | Min of 3 (64–66ms, 3.28–3.42×). Same-session `main`: 74–78ms, 3.93–3.99× — bands clearly separate; **−13.5% min wall**, matching the ~13% combined self-time the profile attributed to the three fixed sites. 30-iter harness: 2375 → 2108ms (−11.2%). Pre-merge SHA. | +| **2026-06-11** | **OSS-489 branch** | **session churn: combined field-map extractor + memo cap 16 + w-call prefilter** | 21 | 72 | **3.48×** | Min of 3 (72–76ms, 3.48–4.01×). Same-session `main`: 75ms ×3 (3.78–3.95×) — bands overlap, **within variance**. Worst-case file: session misses 487 → 417 (−14%), cap-eviction waste 80 → 10; the residual 407 are one-shot parses of genuinely distinct text versions (the architecture's floor without batching). | +| **2026-06-10** | **OSS-488 branch** | **scope-bindings walk fused into gather walk** | 20 | 75 | **3.72×** | Min of 3 (75–79ms, 3.72–4.31×). Same-session `main`: 76–82ms, 3.99–4.14× — bands overlap, **within variance**, expected: the per-segment bindings walks are untouched (each runs once per body; no duplication to eliminate — see OSS-488's segment-side verdict). | +| **2026-06-10** | **OSS-487 branch** | **perf micros: segment-usage sweep + wireMigration subtree walk + regex hoists** | 20 | 75 | **3.83×** | Min of 3 (75–79ms, 3.83–4.09×). Same-session `main`: 80–84ms, 4.29–4.38× — bands don't overlap; −6% min wall matches the 2026-06-10 profile's combined inclusive share for the two fixed sites on this shape (segment-usage 4.2% + wireMigration 2.3%). | +| **2026-06-10** | **OSS-486 step-2 branch** | **group-2 session threading (parse memo + canonical wrapper)** | 20 | 87 | **4.34×** | Parses −50% on this file (1,191 → 596). 30-iteration harness: 2,842 → 2,668ms (−6%; −9% cumulative from the Track D baseline). | +| **2026-06-10** | **OSS-486 step-1 branch (PR #261)** | **group-1 walk fusion (`computeClosureFreeIdentifiers`)** | 20 | 90 | **4.62×** | Wall-neutral (min of 3: 90–96ms; 30-iteration harness shows ~−3%, at the noise edge). Walk invocations −52% on this file (1,706 → 812). Pre-merge SHA. | +| **2026-06-10** | **`6204de8`** | **post #257 — OSS-485 fix; Track D baseline** | 20 | 89 | **4.56×** | Min of 3 runs (TS 89–92ms, ratio 4.48–4.60×). Slightly below the 2026-05-13 row (96ms) — within the historical 91–102ms band. | +| **2026-05-13** | **`b792bf6`** | **PR #56 branch HEAD — post-OSS-365 + F8c crash fix** | 19 | 96 | **5.11×** | code-health #2. Pre-merge — SHA will change on squash. | +| 2026-05-13 | `1df6b8d` | post #54 — OSS-364 | 20 | 97 | 5.02× | code-health #1: event-capture-promotion walks 5→2. | +| 2026-05-13 | `ee3be65` | post #52 — F8c / OSS-363 | 19 | 97 | 5.03× | F8c destructure-flattening landed. | +| 2026-05-09 | `dbe32d2` | post #36 — pre-F1b/F8/code-health | 19 | 94 | **4.87×** | post-Sub-C — refactor track v2 fully closed | +| 2026-05-09 | `e8a705b` | post #34 — OSS-357 (Sub-B) | 19 | 91 | 4.72× | migration-wiring + nested call-sites + nested QRL decls extracted | +| 2026-05-09 | `42ef260` | post #32 — OSS-356 (Sub-A) | 19 | 95 | 4.88× | Prep + inline-strategy + shared rawProps helper extracted | +| 2026-05-09 | `4673e07` | post #27 — pre-track-v2 baseline | 19 | 91 | 4.67× | post-OSS-355 + post-merge-routine codification | +| 2026-05-09 | `854f04b` | post #23 — OSS-354 | 20 | 93 | 4.65× | closure-form `resolveConstLiterals` + prod-rename sync | +| 2026-05-08 | `29a439e` | post #22 — OSS-353 | 20 | 102 | 5.09× | closure-node threading; per-extraction body re-parse dropped | +| 2026-05-08 | `3b8eac6` | post #18 — OSS-350 | 20 | 98 | 4.87× | `preParsedModule` plumbing | +| 2026-05-08 | `b903652` | post #14 — OSS-346 | 19 | 102 | 5.27× | `generateSegmentCode` sequencer extracted | +| 2026-05-07 | `d3f4387` | post #11 — OSS-340 | 20 | 98 | 5.03× | refactor v1 close — predicates module | +| 2026-05-07 | `dd450a6` | post #7 — OSS-341 | 20 | 101 | 5.15× | CI infrastructure landed | +| 2026-05-07 | `e98cbff` | post #5 — F1 fix | 21 | 102 | 4.93× | first code change — `_ref` indirection | +| 2026-05-06 | `d3226c3` | pre-code baseline | 20 | 95 | 4.75× | pre-code baseline | + +--- + +## Visual trend + +Both charts plot **TS / SWC ratio** (the dimensionless regression signal — lower is better) across the same commits the tables above describe, oldest → newest. The y-axes are intentionally narrow so within-noise movement is visible; widening them to start at 0 would flatten the trend and hide the ~10% spread. + +### BENCH-01 ratio over time + +```mermaid +xychart-beta + title "BENCH-01 — TS / SWC ratio (lower is better; CI cap = 1.15×)" + x-axis ["d3226c3", "e98cbff", "dd450a6", "d3f4387", "b903652", "3b8eac6", "29a439e", "854f04b", "4673e07", "42ef260", "e8a705b", "dbe32d2", "ee3be65", "1df6b8d", "b792bf6", "6204de8"] + y-axis "Ratio (×)" 2.5 --> 3.2 + line [2.82, 2.86, 2.74, 2.72, 2.83, 2.77, 2.70, 2.72, 2.66, 2.83, 2.69, 2.69, 2.80, 2.88, 2.83, 3.06] +``` + +### BENCH-02 ratio over time + +```mermaid +xychart-beta + title "BENCH-02 — TS / SWC ratio (lower is better; CI cap = 1.5×)" + x-axis ["d3226c3", "e98cbff", "dd450a6", "d3f4387", "b903652", "3b8eac6", "29a439e", "854f04b", "4673e07", "42ef260", "e8a705b", "dbe32d2", "ee3be65", "1df6b8d", "b792bf6", "6204de8"] + y-axis "Ratio (×)" 4.4 --> 5.5 + line [4.75, 4.93, 5.15, 5.03, 5.27, 4.87, 5.09, 4.65, 4.67, 4.88, 4.72, 4.87, 5.03, 5.02, 5.11, 4.56] +``` + +> The CI caps (1.15× and 1.5×) sit well below the visible y-axis ranges and aren't drawn. Mermaid's `xychart-beta` doesn't support reference lines — caps stay textual in each chart's title. The tables above remain the source of truth; the charts are a visual aid. + +--- + +## Trend so far + +**Over the 4 days from 2026-05-06 → 2026-05-09 the TS optimizer is unchanged in perf within noise.** Refactor track v2 (OSS-343) closed in this window — `generateAllSegmentModules` went from 580 lines to a 34-line orchestrator over named helpers, ~94% reduction — and the four final ratios (pre-Sub-A, post-Sub-A, post-Sub-B, post-Sub-C) all sit inside the variance band: + +- **BENCH-01 TS time** moves between 1465 and 1635 ms across all 12 rows (~10% spread). The four track-v2 boundary rows are 1465 / 1549 / 1485 / 1475 — Sub-A's 1549 reading is a single noisy run; Sub-B and Sub-C come back down to the pre-track baseline. +- **BENCH-02 TS time** moves between 91 and 102 ms across all 12 rows (~10% spread). The four track-v2 boundary rows are 91 / 95 / 91 / 94 — same pattern. +- **Ratios** (TS ÷ SWC) cluster at **~2.7×** for BENCH-01 and **~4.8×** for BENCH-02 — nowhere near the 1.15× and 1.5× CI caps. Track v2's start (4673e07) and end (dbe32d2) ratios are 2.66× → 2.69× and 4.67× → 4.87× — both inside noise. + +**The refactor track was explicitly not perf-targeted.** Its goal was code-quality / structural cleanup to make subsequent feature _and_ perf work cheaper. The flat-within-noise outcome is the expected outcome; if track v2 had moved either ratio meaningfully, it would have been a surprise (and worth investigating which extraction caused it). + +What track v2 _did_ do for future perf work: + +- **Named helpers expose seams for profiling.** Pre-track, `generateAllSegmentModules` was 580 lines of inline phases; post-track, it's six named helpers with documented mutation surfaces. Profiling can target a specific helper rather than narrowing into an opaque mega-function. +- **The immutable `SegmentGenerationPrep` record** confines per-call setup costs to one well-defined block; cache-line / memory-layout tweaks have a single owner. +- **Two backlog candidates surfaced** (eliminate per-iteration `ext` mutation; split the 28-field `SegmentGenerationContext`) that _could_ unlock perf wins by enabling structural sharing or reducing destructure overhead. Neither has been measured. + +To meaningfully move the ratios: + +- BENCH-02 (worst-case file) is dominated by per-extraction work — that's where AST-walking optimizations like OSS-353's body-reparse drop should show up most. The numbers hint at this; profiling would confirm. +- BENCH-01 is dominated by file-discovery + parsing across the batch. Throughput here is more about the parse → walk → emit cycle than any single phase. + +When perf-targeted tickets get filed, link them here and add a row before/after each one to make the impact visible. + +### Update 2026-05-13 — F8c + code-health pass + +Three new rows added today isolating F8c ([OSS-363](https://linear.app/kunai/issue/OSS-363), PR #52), OSS-364 (PR #54), OSS-365 + flatten-destructures crash fix (PR #56 branch HEAD). All measurements taken on the same machine, same SWC binding, in sequence. + +| Boundary | BENCH-01 ratio | BENCH-02 ratio | +| ---------------------------------------- | -------------- | -------------- | +| `dbe32d2` (pre-F8c baseline, 2026-05-09) | 2.69× | 4.87× | +| `ee3be65` (post-F8c) | 2.80× | 5.03× | +| `1df6b8d` (post-OSS-364, walks 5→2) | 2.88× | 5.02× | +| `b792bf6` (post-OSS-365, parse-sharing) | 2.83× | 5.11× | + +**Takeaways:** + +1. **F8c added ~4% to BENCH-01** (2.69× → 2.80×). The new `flatten-destructures.ts` Phase 0.5 step is a real cost: one extra `walk(program, ...)` to identify candidate decls and (when changes apply) a re-parse of the rewritten source. F8c was a parity fix, not perf-targeted; this overhead is expected. +2. **OSS-364 and OSS-365 (the code-health pass) had no measurable effect.** Both PRs reduced redundant walks / parses (5→2 in `event-capture-promotion`, 4→1 in the `module-cleanup` post-process), matching the rule's "parse once, walk once" intent — but the per-walk/per-parse cost is dwarfed by the rest of the pipeline. Final ratio 2.83× is inside the variance band relative to the 2.80× post-F8c row (3 runs each: 2.79–2.88 vs 2.79–2.88 vs 2.83–2.86 — all overlapping). The work was a code-quality investment, not a throughput win. +3. **BENCH-02 (worst-case single file) is essentially flat across all four points.** The savings from the code-health PRs don't show up here because the worst-case file doesn't exercise the redundant-walk code paths in `event-capture-promotion` or the post-process pipeline as heavily as the full monorepo does. +4. **Crash discovered.** Running BENCH-01 on the post-F8c commit (`ee3be65`) crashed in `flatten-destructures.ts` with `Cannot split a chunk that has already been edited (45:10 – "{ url }")` — a real bug that convergence tests missed because the failing shape (two flattenable decls in the same scope, second decl's pattern containing an Identifier whose name matches the first's substitution) wasn't in the snapshot corpus. Fix bundled in PR #56 (commit `b792bf6`); regression test pinned in `tests/optimizer/flatten-destructures.test.ts`. **The benchmark suite caught a correctness bug, not just a perf number** — useful precedent for adding benchmark-style runs to CI on real source corpora. + +### Update 2026-06-10 — Track D baseline + CPU profile + +First rows in ~4 weeks. BENCH-01 was **unmeasurable** for the whole gap: it crashed on `repl-console.tsx` from the moment the trigger shape existed in the corpus ("Cannot use replaced character … as slice start anchor" — the `applySignalHoistRenames` whole-buffer overwrite, fixed by OSS-485 / PR #257). Second time the benchmark corpus caught a correctness bug the convergence snapshots missed (first: the flatten-destructures crash above). + +Numbers at `6204de8` (min of 3 sequential runs, same machine, same SWC binding — SWC times still in the ~550ms / ~20ms bands, so rows remain comparable): + +| | SWC ms | TS ms | Ratio | vs last row (2026-05-13) | +| -------- | ------ | ----- | ----- | ----------------------------------------------------------- | +| BENCH-01 | 546 | 1674 | 3.06× | TS +7% (1568 → 1674); above the historical 1465–1635ms band | +| BENCH-02 | 20 | 89 | 4.56× | TS −7% (96 → 89); within the historical 91–102ms band | + +**The BENCH-01 growth is real, not noise** — all 4 runs (3.04–3.08×) sit above every prior row's ratio. It's the accumulated cost of a month of parity/feature work (F2/F5/F6/F9/F10 closures, router parity incl. the `_jsxDEV` Property-extraction branch, `repairInput` probe-parsing, q:p walks), none of it perf-targeted. BENCH-02's slight improvement is consistent with the hygiene refactors trimming per-extraction overhead on the worst-case file. + +**CPU profile (inclusive on-stack %, V8 sampling via `--cpu-prof` over the built dist, 30 worst-case iterations / 2 monorepo passes):** + +| Phase / cost center | BENCH-02 shape | BENCH-01 shape | +| ----------------------------------------- | -------------- | -------------- | +| `generateSegments` (Phase 5) | 37.2% | 35.5% | +| `rewriteParent` (Phase 4) | 28.5% | 16.9% | +| — `transformAllJsx` (both callers) | 20.2% | 10.3% | +| `analyzeModuleCaptures` (Phase 2) | 10.3% | 10.1% | +| `extractModuleSegments` (Phase 1) | 8.0% | 16.7% | +| `prepareModuleInput` (Phase 0/0.5) | 2.9% | 8.7% | +| **`parseWithRawTransfer` (all parses)** | **13.4%** | **16.5%** | +| **`_walk` (oxc-walker, all walks)** | **48.0%** | **40.9%** | +| `computeSegmentUsage` (catalogued D1) | 4.2% | 2.0% | +| `wireMigration` (catalogued D2b) | 2.3% | 0.6% | +| `countJsxKeyConsumption` (catalogued D2a) | 1.6% | 1.8% | + +**Group-1 walk fusion (OSS-486 step 1, same day):** replacing the per-closure `getUndeclaredIdentifiersInFunction` calls in capture analysis, C02 diagnostics, and event-handler capture promotion with one module-wide `computeClosureFreeIdentifiers` map cut walk _invocations_ by 52% on the worst-case file and 35% on the monorepo — but wall time stayed inside the variance band (~−3% at best on the 30-iteration harness). Lesson recorded: invocation count was a misleading proxy; the eliminated walks were closure-subtree-sized while the heavy traversals (program walks, JSX walks, per-segment text re-parses) remain. The wall expectations for OSS-486 sit with the per-segment parse consolidation (group 2) and the per-module walk fusion (group 3). + +**Group-2 session threading (OSS-486 step 2, same day):** unified every body-text edit/analysis helper onto the canonical `TransformSession` wrapper and added a last-4 parse memo keyed by the exact wrapped source, so consecutive helpers operating on the same body-text version share one parse. Parses −47–50% in both shapes; **first wall movement of the track** — BENCH-01 2.96× (all runs below the baseline band), BENCH-02 87ms min, 30-iteration worst-case harness −9% cumulative from the Track D baseline. The `countJsxKeyConsumption` pre-count also stopped re-parsing (walks the Phase-1 closure node), closing one of the catalogued micro items below. One behavior split made explicit along the way: previously-direct-parse analysis sites tolerate recoverable parse errors (`tolerateErrors`), edit-applying sites stay strict — pinned by unit test after a strip-mode fixture caught the difference. + +**Group-3 gather-walk fusion (OSS-486 step 3, same day):** the canonical per-module gather walk (`analysis/module-gather-walk.ts`) folds the five remaining per-module full-program walks — lexical scope chains, extraction loop map, scope entries, segment usage, passive-conflict detection — into the group-1 free-identifier walk (ScopeTracker build + one gather traversal; 7 program walks → 2 per extraction module), and the peer-tool jsx-call-transform drops from four program walks to two (gather + act). Census with identical chokepoint counters on both sides: monorepo walks **19,836 → 16,920 (−14.7%)**, worst-case file 812 → 801 (that shape's walks are dominated by per-segment body walks); parses unchanged, as expected for a walk-only step. Wall (same-session min-of-3 vs `main`): **BENCH-01 2.96× → 2.71×** (TS 1630 → 1519ms, −6.8%; main's three runs 2.91–2.97× all sit above the branch's 2.71–2.90×, so the movement is outside the overlap); BENCH-02 min 89 → 83ms with overlapping ratio bands (4.45–4.51 vs 4.27–4.58) — within variance, consistent with the single-module shape barely losing walks. Replaced walk functions are retained as differential oracles, pinned by a per-projection corpus parity test. + +**Profile verdict on the catalogued Track D items:** D1 + D2 + D3 combined have a ceiling under ~8% in either shape — not needle-movers at the current ratios (the roadmap's "profile to confirm" caveat confirmed in the negative). What actually dominates is structural: AST walking is on-stack for 40–48% of wall (many separate full-program walks per module across phases), and parsing is 13–17% (probe/repair parses, flatten re-parse, per-segment body parses, post-process transform parses). Perf-targeted work should aim there; D1 remains worth fixing eventually for its quadratic blowup _risk_ (it's input-shape-sensitive), not for its current cost. + +**OSS-489 session-churn step 1 (2026-06-11):** the churn census (per-site session counts with memo hit/miss and seen-text split) found 487 worst-case session parses decomposing into 407 one-shots (first parse of a genuinely new text version) and 80 cap-eviction re-parses — 60 of those from `extractDestructuredFieldDefaultsMap` re-parsing exactly the bodies its sibling `extractDestructuredFieldMap` had parsed one full loop earlier. Landed: a combined `extractDestructuredFieldInfo` (both projections from one parse; the two old extractors survive as thin wrappers), parse-memo cap 4 → 16 (the 4-cap thrashed under interleaved parent/nested pipelines), and a sound textual prefilter on `consolidateRawPropsInWCalls` (bare `_rawProps` + `.w(` — the dotted form would wrongly gate out computed members). Census: monorepo session parses **6,289 → 5,646 (−10.2%)**; worst-case misses 487 → 417, waste 80 → 10. Wall within variance both shapes, as expected at ~5% parse self-time. The 407 one-shot floor is the architecture's: each committed edit produces a new text version needing one parse — reducing it means batching transforms onto shared sessions (ticket stage 2, deferred pending appetite: correctness-bearing edit ordering for a bounded win). A `simplifyExpression` prefilter was evaluated and rejected — folds trigger on `true`/`false`/`null`/parenthesized operand shapes with no sound textual gate. + +**OSS-488 scope-bindings fusion (same day):** `transformAllJsx`'s standalone `collectScopeAwareBindings` pre-walk became a projection of the canonical gather walk on the parent path (per-node logic shared via `createScopeBindingsCollector`; standalone walk retained as the differential oracle, compared on the consumer contract — `classify()` at every identifier position). Census: standalone bindings walks **1,994 → 1,404 (−590)** on the monorepo pass — one per parent JSX module. Wall: within variance on both shapes (same-session bands overlap), as the ticket predicted for a one-walk-per-module reduction. Segment-side memo investigated and dropped: each segment/inline body collects bindings exactly once, so a per-text-version memo has nothing to dedupe. + +**OSS-487 micros (same day):** the catalogued principle/risk fixes landed — the segment-usage projection's per-visit scan over every extraction (the quadratic the gather walk inherited from `computeSegmentUsage`) replaced by a sorted range-stack sweep in `classifySegmentUsage`, `wireMigration`'s per-move-decision full-program walk narrowed to the decl's enclosing top-level statement, `ifBracelessPattern` hoisted out of the DCE iteration loop, and the sCall-placement `\b\b` testers cached. Same-session A/B vs `main`: **BENCH-02 −6% min wall** (80 → 75ms; ratio bands 4.29–4.38 vs 3.83–4.09, outside overlap) — consistent with the profile's combined 4.2% + 2.3% inclusive share for the two fixed sites on this shape; BENCH-01 −3% (1528 → 1482ms), at the variance edge, not claimed. The `countJsxKeyConsumption` re-parse item was already closed by group 2; the quadratic fix is bounded-behavior-pinned by a Proxy-counted unit test (200-extraction synthetic input: ~7k range reads vs ~600k+ for the per-visit scan). + +**OSS-491 Phase-0.5 flatten prefilter (2026-06-11):** the last unfiled OSS-486 census deferral closed. `flattenDestructureUseCalls` ran one full program walk + an eager `MagicString` construction per module, but can only act on modules containing a _literal_ `component$` callee (the name check is exact; renamed imports never flattened) — so a bare `source.includes('component$')` gate is exactly sound, and the MagicString now materializes on first overwrite. Census: monorepo Phase-0.5 walks **1,391 → 485 (−65%)**, ctors **1,391 → 12 (−99%)**; the worst-case file keeps its walk (component$-dense) but drops the ctor. Wall: **within variance both shapes** (same-session bands overlap; 30-iter harness identical) — recorded honestly: the flatten walk's per-node work is two type checks and the saved ctors are mostly small files. Prefilter soundness pinned by renamed-import + token-in-comment tests. + +**OSS-496 extraction fusion + marker prefilter (2026-06-11, closes the OSS-492 arc):** the Phase-1 extraction walk became a composable collector hosted in the canonical gather walk — one program traversal per module produces the extraction set and every gathered fact; the Phase-1/2 boundary in `transformOneModule` merged. The fusion-only intermediate build cost **+5% BENCH-01 wall** (783 passthrough modules newly paying tracker bookkeeping, identifier buffering, and per-node projection dispatch they never had under the lean extract walk) — clawed back below `main` by three gates: a sound marker prefilter (`sourceMayContainMarkers`: a token-final `$` is never followed by `{` in valid syntax, so template-only modules skip the walk _entirely_), lazy lexical-scope frame materialization, and zero-extraction skips for usage classification + scope-entry building. Final census: monorepo program walks **1,999 → 826 (−58.7% this step; 2,477 → 826, −66.6% across the arc — beating the umbrella's −43.8% full-fusion projection because the prefilter takes most passthrough modules to zero walks)**. Wall: BENCH-01 **−1.7% min** with consistent direction across 3 interleaved same-session pairs (variance edge, not over-claimed); BENCH-02 within variance. Standalone `extractSegments` retained as the differential oracle, pinned by a corpus parity test over every `ExtractionResult` field + `closureNodes` identity × three flag combos. + +**OSS-490 MagicString churn (2026-06-11):** the post-OSS-489 profile's three MagicString cost centers fixed — (1) `processOneChild` and the prop-value slicers no longer pay `MagicString.slice`'s chunk-list walk to read back already-rewritten JSX subtrees: `writeJsxCall` records every overwrite in an exact-range memo (`start → {end, content}`) that `sliceTransformed` consults first (sound because the walk writes bottom-up through a single write path — an exact-range hit is the last edit inside that range); (2) `TransformSession.edits` constructs its MagicString lazily on first access, so read-only sessions skip it and unedited `toSource()` short-circuits to the original text; (3) `transformAllJsx` builds a sorted contained-range-free skip-range index once and `isInSkipRange` does one binary-search probe per node (differential unit test pins parity with the linear scan over nested/overlapping/duplicate sets). After-profile (same methodology, built dist, 30 worst-case iterations): `MagicString.slice` **8.1% → 2.6%** self, `MagicString` ctor **4.0% → 1.0%**, `isInSkipRange` **2.5% → 0.2%**. Wall (same-session min-of-3 vs `main`): **BENCH-02 74 → 64ms (−13.5%)**, bands clearly separate, matching the addressed self-time share; **BENCH-01 1487 → 1428ms (−4.0%)**, bands non-overlapping; 30-iter worst-case harness 2375 → 2108ms (−11.2%). + +--- + +## Hardware / environment context + +| | | +| ------------- | ------------------------------------------------------------------------------------------------------------- | +| Hardware | Apple M-series (`darwin-arm64`) | +| Node | ≥22 (per `package.json` `engines.node`) | +| pnpm | v10.x | +| SWC binding | `qwik_napi` v0.1.0 / `qwik-core` v2.0.0, `release` profile, built via `pnpm build.platform` from `$QWIK_HOME` | +| Qwik checkout | `$QWIK_HOME` ([`.claude/rules/GENERAL.md`](.claude/rules/GENERAL.md)) | + +Future rows from different hardware should mark the platform in the Notes column. If the SWC binding has been rebuilt against a different qwik commit, also note that — only the Ratio column remains comparable across rebuilds. + +--- + +## Methodology — backfilling history + +This doc was bootstrapped on 2026-05-09 by checking out 9 historical commits in an isolated `git worktree`, replacing each commit's `tests/benchmark/optimizer-benchmark.test.ts` with the current portable version (older versions of the file had hard-coded paths and a different env-var contract that wouldn't run on a fresh machine), running `pnpm install --frozen-lockfile` per commit, and capturing the numbers. + +The same procedure works for any future backfill. Don't try to backfill commits older than `d3226c3` — earlier commits predate the convergence-failures grouping work and the optimizer surface may diverge. diff --git a/packages/ts-optimizer/DESIGN.md b/packages/ts-optimizer/DESIGN.md new file mode 100644 index 00000000000..1f1d900bacb --- /dev/null +++ b/packages/ts-optimizer/DESIGN.md @@ -0,0 +1,3 @@ +The idea is that we should hold operations performed in a virtual representation, then at the end we do a write with magic string. This allows us to hold all the AST information and only need to parse once. + +We should try to avoid cases where we have to reparse or do strange cases of looping over characters and words to make diffs. On the other hand, we should avoid using a printer approach with codegen that is exhaustive and leads to complexity and difficult changes. diff --git a/packages/ts-optimizer/LICENSE b/packages/ts-optimizer/LICENSE new file mode 100644 index 00000000000..5a8a0e25c4f --- /dev/null +++ b/packages/ts-optimizer/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2024 QwikDev +Copyright (c) 2021 BuilderIO + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/ts-optimizer/README.md b/packages/ts-optimizer/README.md new file mode 100644 index 00000000000..9255de80d0c --- /dev/null +++ b/packages/ts-optimizer/README.md @@ -0,0 +1,170 @@ +# @qwik.dev/ts-optimizer + +A TypeScript implementation of the [Qwik](https://qwik.dev) optimizer. + +It takes a Qwik source file, finds every `$()` closure, lifts each one into its +own lazy-loadable module, and rewrites the original file so the closures become +`qrl(() => import(...))` references — the runtime then loads each chunk only +when the user actually triggers it. + +> **Status: experimental.** This is a from-scratch TypeScript port of the Rust +> SWC optimizer that ships with Qwik core, built on [OXC](https://oxc.rs). It +> currently matches **~96%** of the reference optimizer's snapshot suite. APIs +> may change before a 1.0. + +## Why + +The optimizer is the heart of Qwik's resumability model: every `$()` boundary +becomes a separately loadable chunk, so the browser downloads code lazily as +interaction demands it instead of hydrating the whole app up front. This package +makes that transform available as a pure-TypeScript, [OXC](https://oxc.rs)-based +library — no native SWC binding required for the transform logic itself (the +parser/transformer it builds on, `oxc-parser` / `oxc-transform`, do ship native +bindings). + +## Install + +```sh +npm install @qwik.dev/ts-optimizer +# or +pnpm add @qwik.dev/ts-optimizer +``` + +**Requires Node `>=22`** — `oxc-parser`'s raw-transfer path throws on Node 20. +ESM-only. + +## Usage + +There are two entry points: a synchronous core (`transformModule`) and an +async, SWC-NAPI-compatible factory (`createOptimizer`) for drop-in use inside a +bundler. + +### `transformModule` — synchronous core + +```ts +import { transformModule, mkFilePath, mkSourceText } from '@qwik.dev/ts-optimizer'; + +const result = transformModule({ + input: [ + { + path: mkFilePath('components/counter.tsx'), + code: mkSourceText(` + import { component$, useSignal } from '@qwik.dev/core'; + export const Counter = component$(() => { + const count = useSignal(0); + return ; + }); + `), + }, + ], + srcDir: mkFilePath('/app/src/'), + entryStrategy: { type: 'segment' }, + minify: 'simplify', +}); + +for (const mod of result.modules) { + console.log(mod.path, mod.kind); // 'parent' | 'segment' + // mod.code — emitted source + // mod.segment — segment metadata (name, hash, ctxKind, captures, …) on segments +} + +console.log(result.diagnostics); // [] when clean +``` + +Each input file is transformed independently into **one parent module** (the +original file rewritten so its `$()` calls become `qrl(...)` references) plus +**zero or more segment modules** (each lifted closure body as its own +lazy-loadable file). + +### `createOptimizer` — async, bundler-facing + +Mirrors the surface of Qwik's SWC optimizer (`@qwik.dev/optimizer`'s +`createOptimizer().transformModules(...)`), so it can be swapped in by a bundler +adapter. Takes and returns plain strings (no branded types at the boundary): + +```ts +import { createOptimizer } from '@qwik.dev/ts-optimizer'; + +const optimizer = createOptimizer(); +const output = await optimizer.transformModules({ + srcDir: '/app/src', + input: [{ path: 'components/counter.tsx', code: source }], + entryStrategy: { type: 'smart' }, +}); +``` + +## What it emits — before / after + +**Input** (`test.tsx`): + +```tsx +import { $, component } from '@qwik.dev/core'; + +export const renderHeader = $(() => { + return
console.log(ctx))} />; +}); +``` + +**Output** — a rewritten parent plus one segment per `$()` body: + +```ts +// test.tsx (parent — closures replaced by lazy QRL references) +import { qrl } from '@qwik.dev/core'; +const q_renderHeader_jMxQsjbyDss = /*#__PURE__*/ qrl( + () => import('./test.tsx_renderHeader_jMxQsjbyDss'), + 'renderHeader_jMxQsjbyDss' +); +export const renderHeader = q_renderHeader_jMxQsjbyDss; +``` + +```ts +// test.tsx_renderHeader_jMxQsjbyDss.tsx (segment — the lifted body) +export const renderHeader_jMxQsjbyDss = () => { + return
; +}; +``` + +The nested `onClick` closure is lifted again into its own leaf segment, loaded +only after the user clicks. That granularity — each `$()` boundary a separate +chunk — is the whole point. + +## How it works + +`transformModule` runs each file through a fixed pipeline: + +| Phase | Does | +| ------------------------- | --------------------------------------------------------------------------------------------------- | +| **0 — Prepare** | Repair recoverable parse errors, flatten destructures, parse once with OXC | +| **1 — Extract** | Walk the AST, find every `$(...)` / marker call, capture each closure body + naming context | +| **2 — Captures** | Determine which outer-scope variables each closure closes over | +| **3 — Migrate** | Decide where each module-level binding lives: stay in the parent, move into a segment, or re-export | +| **4 — Rewrite parent** | Replace each `$(closure)` with a generated `qrl(...)` reference; apply migration | +| **5 — Generate segments** | Emit one lazy-loadable module per extracted closure | +| **6 — Post-process** | TypeScript strip, dead-code elimination, unused-import cleanup | + +Symbol names are content-addressed: a closure's exported name is composed from +its call-site context (`renderHeader_div_onClick`) plus an 11-character +SipHash-1-3 suffix, so the same source always produces the same chunk names the +runtime will fetch. + +The marker family the optimizer recognizes (`component$`, `useTask$`, +`useStyles$`, `useVisibleTask$`, `server$`, event handlers like `onClick$`, …) +is detected **structurally** — any call whose callee's imported name ends in `$` +extracts — so library-defined `name$` functions work automatically. + +## Public API + +| Export | Kind | Purpose | +| ------------------------------------------------------------------ | --------- | ----------------------------------------------- | +| `transformModule(options)` | function | Synchronous core transform → `TransformOutput` | +| `createOptimizer()` | function | Async, SWC-NAPI-compatible optimizer instance | +| `mk*` (e.g. `mkFilePath`, `mkSourceText`) | functions | Smart constructors for the branded string types | +| `TransformModulesOptions`, `TransformOutput`, `TransformModule`, … | types | Input/output contracts | +| `SymbolName`, `Hash`, `FilePath`, `SourceText`, … | types | Branded identifier types | + +All other modules are internal and not part of the public contract. + +## License + +[MIT](./LICENSE) — matching [Qwik](https://github.com/QwikDev/qwik) core, of +which this is a derivative. Copyright © QwikDev and BuilderIO. diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__component_level_self_referential_qrl.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__component_level_self_referential_qrl.snap new file mode 100644 index 00000000000..a901b95c0de --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__component_level_self_referential_qrl.snap @@ -0,0 +1,178 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 5854 +expression: output +--- +==INPUT== + + +import { component$, useAsync$ } from '@qwik.dev/core'; + +// Component-level self-referential component +export const Foo = component$((props) => { + const sig = useAsync$(async ({cleanup}) => { + const timer = setInterval(() => { + sig.value++; + }, 1000); + cleanup(() => clearInterval(timer)); + return 0; + }); + const other = useAsync$(async ({cleanup}) => { + const timer = setInterval(() => { + other.value++; + }, 900); + cleanup(() => clearInterval(timer)); + return 0; + }); + return ( +
+ {other.value} +
+ ); +}); + +============================= test.tsx_Foo_component_HTDRsvUbLiE.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +import { useAsyncQrl } from "@qwik.dev/core"; +// +const q_Foo_component_other_useAsync_fsHooibmyyE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_other_useAsync_fsHooibmyyE"), "Foo_component_other_useAsync_fsHooibmyyE"); +const q_Foo_component_sig_useAsync_f0BGwWm4eeY = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_sig_useAsync_f0BGwWm4eeY"), "Foo_component_sig_useAsync_f0BGwWm4eeY"); +// +export const Foo_component_HTDRsvUbLiE = (props)=>{ + const _ref = {}; + _ref.sig = useAsyncQrl(q_Foo_component_sig_useAsync_f0BGwWm4eeY.w([ + _ref.sig + ])); + const { sig } = _ref; + _ref.other = useAsyncQrl(q_Foo_component_other_useAsync_fsHooibmyyE.w([ + _ref.other + ])); + const { other } = _ref; + return
+ {other.value} +
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;yCAI8B,CAAC;IAC9B;eAAY;;;IAAZ,QAAM;iBAOQ;;;IAAd,QAAM;IAON,QACE,IAAI;GACJ,CAAC,MAAM,KAAK,CAAC;EACd,EAAE;AAEJ\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 137, + 534 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_Foo_component_other_useAsync_fsHooibmyyE.tsx (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const Foo_component_other_useAsync_fsHooibmyyE = async (_rawProps)=>{ + const other = _captures[0]; + const timer = setInterval(()=>{ + other.value++; + }, 900); + _rawProps.cleanup(()=>clearInterval(timer)); + return 0; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;wDAYyB;;IACvB,MAAM,QAAQ,YAAY;QACzB,MAAM,KAAK;IACZ,GAAG;IACH,UAJ+B,QAIvB,IAAM,cAAc;IAC5B,OAAO\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_other_useAsync_fsHooibmyyE", + "entry": null, + "displayName": "test.tsx_Foo_component_other_useAsync", + "hash": "fsHooibmyyE", + "canonicalFilename": "test.tsx_Foo_component_other_useAsync_fsHooibmyyE", + "path": "", + "extension": "tsx", + "parent": "Foo_component_HTDRsvUbLiE", + "ctxKind": "function", + "ctxName": "useAsync$", + "captures": true, + "loc": [ + 341, + 482 + ], + "paramNames": [ + "_rawProps" + ], + "captureNames": [ + "other" + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "Foo_component_HTDRsvUbLiE"); +// Component-level self-referential component +// +export const Foo = /*#__PURE__*/ componentQrl(q_Foo_component_HTDRsvUbLiE); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;AAGA,6CAA6C;;AAC7C,OAAO,MAAM,oBAAM,0CAoBhB\"}") +============================= test.tsx_Foo_component_sig_useAsync_f0BGwWm4eeY.tsx (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const Foo_component_sig_useAsync_f0BGwWm4eeY = async (_rawProps)=>{ + const sig = _captures[0]; + const timer = setInterval(()=>{ + sig.value++; + }, 1000); + _rawProps.cleanup(()=>clearInterval(timer)); + return 0; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;sDAKuB;;IACrB,MAAM,QAAQ,YAAY;QACzB,IAAI,KAAK;IACV,GAAG;IACH,UAJ6B,QAIrB,IAAM,cAAc;IAC5B,OAAO\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_sig_useAsync_f0BGwWm4eeY", + "entry": null, + "displayName": "test.tsx_Foo_component_sig_useAsync", + "hash": "f0BGwWm4eeY", + "canonicalFilename": "test.tsx_Foo_component_sig_useAsync_f0BGwWm4eeY", + "path": "", + "extension": "tsx", + "parent": "Foo_component_HTDRsvUbLiE", + "ctxKind": "function", + "ctxName": "useAsync$", + "captures": true, + "loc": [ + 173, + 313 + ], + "paramNames": [ + "_rawProps" + ], + "captureNames": [ + "sig" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props.snap new file mode 100644 index 00000000000..c80cb0fdbba --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props.snap @@ -0,0 +1,67 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3714 +expression: output +--- +==INPUT== + + + import { component$ } from "@qwik.dev/core"; + export default component$((props) => { + const { 'bind:value': bindValue } = props; + return ( + <> + {bindValue} + + ); + }); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_test_component_LUXeXe0DQrg = /*#__PURE__*/ qrl(()=>import("./test.tsx_test_component_LUXeXe0DQrg"), "test_component_LUXeXe0DQrg"); +// +export default /*#__PURE__*/ componentQrl(q_test_component_LUXeXe0DQrg); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEE,6BAAe,2CAOZ\"}") +============================= test.tsx_test_component_LUXeXe0DQrg.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +// +export const test_component_LUXeXe0DQrg = (props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, _wrapProp(props, "bind:value"), 1, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;0CAE4B,CAAC;IAE1B,qBACC,4CAFmC;AAMrC\"}") +/* +{ + "origin": "test.tsx", + "name": "test_component_LUXeXe0DQrg", + "entry": null, + "displayName": "test.tsx_test_component", + "hash": "LUXeXe0DQrg", + "canonicalFilename": "test.tsx_test_component_LUXeXe0DQrg", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 77, + 188 + ], + "paramNames": [ + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props2.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props2.snap new file mode 100644 index 00000000000..b8b54cbf591 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props2.snap @@ -0,0 +1,70 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3735 +expression: output +--- +==INPUT== + + + import { component$, useSignal } from "@qwik.dev/core"; + export default component$((props) => { + const { 'bind:value': bindValue } = props; + const test = useSignal(bindValue); + return ( + <> + {test.value} + + ); + }); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_test_component_LUXeXe0DQrg = /*#__PURE__*/ qrl(()=>import("./test.tsx_test_component_LUXeXe0DQrg"), "test_component_LUXeXe0DQrg"); +// +export default /*#__PURE__*/ componentQrl(q_test_component_LUXeXe0DQrg); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEE,6BAAe,2CAQZ\"}") +============================= test.tsx_test_component_LUXeXe0DQrg.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { useSignal } from "@qwik.dev/core"; +// +export const test_component_LUXeXe0DQrg = (props)=>{ + const test = useSignal(props["bind:value"]); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, _wrapProp(test), 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;0CAE4B,CAAC;IAE1B,MAAM,OAAO,UADuB;IAEpC,qBACC,4CACC;AAGH\"}") +/* +{ + "origin": "test.tsx", + "name": "test_component_LUXeXe0DQrg", + "entry": null, + "displayName": "test.tsx_test_component", + "hash": "LUXeXe0DQrg", + "canonicalFilename": "test.tsx_test_component_LUXeXe0DQrg", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 88, + 238 + ], + "paramNames": [ + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props3.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props3.snap new file mode 100644 index 00000000000..813d0f53feb --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_colon_props3.snap @@ -0,0 +1,78 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3757 +expression: output +--- +==INPUT== + + + import { component$, useSignal } from "@qwik.dev/core"; + export default component$((props) => { + const { test, ...rest } = props; + const test = useSignal(rest['bind:value']); + return ( + <> + {test.value} + + ); + }); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_test_component_LUXeXe0DQrg = /*#__PURE__*/ qrl(()=>import("./test.tsx_test_component_LUXeXe0DQrg"), "test_component_LUXeXe0DQrg"); +// +export default /*#__PURE__*/ componentQrl(q_test_component_LUXeXe0DQrg); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEE,6BAAe,2CAQZ\"}") +============================= test.tsx_test_component_LUXeXe0DQrg.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _restProps } from "@qwik.dev/core"; +import { useSignal } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.test.value; +const _hf0_str = "p0.test.value"; +export const test_component_LUXeXe0DQrg = (props)=>{ + const rest = _restProps(props, [ + "test" + ]); + useSignal(rest['bind:value']); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, _fnSignal(_hf0, [ + props + ], _hf0_str), 1, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;mBAOK,GAJM,KAID,KAAK;;0CALa,CAAC;4BACA;;;IACb,UAAU,IAAI,CAAC,aAAa;IACzC,qBACC;;;AAIF\"}") +/* +{ + "origin": "test.tsx", + "name": "test_component_LUXeXe0DQrg", + "entry": null, + "displayName": "test.tsx_test_component", + "hash": "LUXeXe0DQrg", + "canonicalFilename": "test.tsx_test_component_LUXeXe0DQrg", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 88, + 237 + ], + "paramNames": [ + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_block_stmt.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_block_stmt.snap new file mode 100644 index 00000000000..e0b0bc55149 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_block_stmt.snap @@ -0,0 +1,78 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3650 +expression: output +--- +==INPUT== + + + export default ({ data }: { data: any }) => { + return ( +
{ + data.selectedOutputDetail = 'options'; + }} + /> + ); + }; + +============================= test.js == + +// +import { _fnSignal } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.data.selectedOutputDetail === 'options'; +const _hf0_str = 'p0.data.selectedOutputDetail==="options"'; +// +const q_test_div_q_e_click_pFqTss400MA = /*#__PURE__*/ qrl(()=>import("./test.tsx_test_div_q_e_click_pFqTss400MA"), "test_div_q_e_click_pFqTss400MA"); +export default ((_rawProps)=>{ + return /*#__PURE__*/ _jsxSorted("div", { + "data-is-active": _fnSignal(_hf0, [ + _rawProps + ], _hf0_str), + "q-e:click": q_test_div_q_e_click_pFqTss400MA, + "q:p": _rawProps + }, null, null, 6, "u6_0"); +}); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;mBAI8B,GAHV,KAGe,oBAAoB,KAAK;;;;AAH1D,eAAe,CAAA;IACP,qBACE,WAAC;QACC,gBAAc;;;QACd,WAAQ;;;AAKpB,CAAA,EAAE\"}") +============================= test.tsx_test_div_q_e_click_pFqTss400MA.js (ENTRY POINT)== + +export const test_div_q_e_click_pFqTss400MA = (_, _1, _rawProps)=>{ + _rawProps.data.selectedOutputDetail = 'options'; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"8CAKwB;IACR,UALI,KAKC,oBAAoB,GAAG;AAC9B\"}") +/* +{ + "origin": "test.tsx", + "name": "test_div_q_e_click_pFqTss400MA", + "entry": null, + "displayName": "test.tsx_test_div_q_e_click", + "hash": "pFqTss400MA", + "canonicalFilename": "test.tsx_test_div_q_e_click_pFqTss400MA", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 181, + 259 + ], + "paramNames": [ + "_", + "_1", + "_rawProps" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_block_stmt2.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_block_stmt2.snap new file mode 100644 index 00000000000..1206c87ac49 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_block_stmt2.snap @@ -0,0 +1,79 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3672 +expression: output +--- +==INPUT== + + + export default (props: { data: any }) => { + const { data } = props; + return ( +
{ + data.selectedOutputDetail = 'options'; + }} + /> + ); + }; + +============================= test.js == + +// +import { _fnSignal } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.data.selectedOutputDetail === 'options'; +const _hf0_str = 'p0.data.selectedOutputDetail==="options"'; +// +const q_test_div_q_e_click_pFqTss400MA = /*#__PURE__*/ qrl(()=>import("./test.tsx_test_div_q_e_click_pFqTss400MA"), "test_div_q_e_click_pFqTss400MA"); +export default ((props)=>{ + return /*#__PURE__*/ _jsxSorted("div", { + "data-is-active": _fnSignal(_hf0, [ + props + ], _hf0_str), + "q-e:click": q_test_div_q_e_click_pFqTss400MA, + "q:p": props + }, null, null, 6, "u6_0"); +}); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;mBAK8B,GAHlB,KAGuB,oBAAoB,KAAK;;;;AAJ1D,eAAe,CAAA,CAAC;IAER,qBACE,WAAC;QACC,gBAAc;;;QACd,WAAQ;;;AAKpB,CAAA,EAAE\"}") +============================= test.tsx_test_div_q_e_click_pFqTss400MA.js (ENTRY POINT)== + +export const test_div_q_e_click_pFqTss400MA = (_, _1, props)=>{ + props.data.selectedOutputDetail = 'options'; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"8CAMwB;IAJH,MAAT,KAKS,oBAAoB,GAAG;AAC9B\"}") +/* +{ + "origin": "test.tsx", + "name": "test_div_q_e_click_pFqTss400MA", + "entry": null, + "displayName": "test.tsx_test_div_q_e_click", + "hash": "pFqTss400MA", + "canonicalFilename": "test.tsx_test_div_q_e_click_pFqTss400MA", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 206, + 284 + ], + "paramNames": [ + "_", + "_1", + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_expr_stmt.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_expr_stmt.snap new file mode 100644 index 00000000000..01a74fa1aa8 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__destructure_args_inline_cmp_expr_stmt.snap @@ -0,0 +1,73 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3695 +expression: output +--- +==INPUT== + + + export default ({ data }: { data: any }) => +
{ + data.selectedOutputDetail = 'options'; + }} + />; + +============================= test.js == + +// +import { _fnSignal } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.data.selectedOutputDetail === 'options'; +const _hf0_str = 'p0.data.selectedOutputDetail==="options"'; +// +const q_test_div_q_e_click_pFqTss400MA = /*#__PURE__*/ qrl(()=>import("./test.tsx_test_div_q_e_click_pFqTss400MA"), "test_div_q_e_click_pFqTss400MA"); +export default ((_rawProps)=>/*#__PURE__*/ _jsxSorted("div", { + "data-is-active": _fnSignal(_hf0, [ + _rawProps + ], _hf0_str), + "q-e:click": q_test_div_q_e_click_pFqTss400MA, + "q:p": _rawProps + }, null, null, 6, "u6_0")); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;mBAG8B,GAFV,KAEe,oBAAoB,KAAK;;;;AAF1D,eAAe,CAAA,2BACL,WAAC;QACC,gBAAc;;;QACd,WAAQ;;6BAGT,EAAE\"}") +============================= test.tsx_test_div_q_e_click_pFqTss400MA.js (ENTRY POINT)== + +export const test_div_q_e_click_pFqTss400MA = (_, _1, _rawProps)=>{ + _rawProps.data.selectedOutputDetail = 'options'; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"8CAIwB;IACR,UAJI,KAIC,oBAAoB,GAAG;AAC9B\"}") +/* +{ + "origin": "test.tsx", + "name": "test_div_q_e_click_pFqTss400MA", + "entry": null, + "displayName": "test.tsx_test_div_q_e_click", + "hash": "pFqTss400MA", + "canonicalFilename": "test.tsx_test_div_q_e_click_pFqTss400MA", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 160, + 238 + ], + "paramNames": [ + "_", + "_1", + "_rawProps" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_1.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_1.snap new file mode 100644 index 00000000000..9e56c67954c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_1.snap @@ -0,0 +1,126 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 92 +expression: output +--- +==INPUT== + + +import { $, component, onRender } from '@qwik.dev/core'; + +export const renderHeader1 = $(() => { + return ( +
console.log(ctx))}/> + ); +}); +const renderHeader2 = component($(() => { + console.log("mount"); + return render; +})); + +============================= test.tsx_renderHeader1_div_onClick_USi8k1jUb40.tsx (ENTRY POINT)== + +export const renderHeader1_div_onClick_USi8k1jUb40 = (ctx)=>console.log(ctx); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"qDAKkB,CAAC,MAAQ,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "renderHeader1_div_onClick_USi8k1jUb40", + "entry": null, + "displayName": "test.tsx_renderHeader1_div_onClick", + "hash": "USi8k1jUb40", + "canonicalFilename": "test.tsx_renderHeader1_div_onClick_USi8k1jUb40", + "path": "", + "extension": "tsx", + "parent": "renderHeader1_jMxQsjbyDss", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 127, + 152 + ], + "paramNames": [ + "ctx" + ] +} +*/ +============================= test.tsx == + +import { qrl } from "@qwik.dev/core"; +import { component } from '@qwik.dev/core'; +// +const q_renderHeader1_jMxQsjbyDss = /*#__PURE__*/ qrl(()=>import("./test.tsx_renderHeader1_jMxQsjbyDss"), "renderHeader1_jMxQsjbyDss"); +const q_renderHeader2_component_Ay6ibkfFYsw = /*#__PURE__*/ qrl(()=>import("./test.tsx_renderHeader2_component_Ay6ibkfFYsw"), "renderHeader2_component_Ay6ibkfFYsw"); +// +export const renderHeader1 = q_renderHeader1_jMxQsjbyDss; +component(q_renderHeader2_component_Ay6ibkfFYsw); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";AACA,SAAY,SAAS,QAAkB,iBAAiB;;;;;AAExD,OAAO,MAAM,4CAIV;AACmB\"}") +============================= test.tsx_renderHeader1_jMxQsjbyDss.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_renderHeader1_div_onClick_USi8k1jUb40 = /*#__PURE__*/ qrl(()=>import("./test.tsx_renderHeader1_div_onClick_USi8k1jUb40"), "renderHeader1_div_onClick_USi8k1jUb40"); +// +export const renderHeader1_jMxQsjbyDss = ()=>{ + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;yCAG+B;IAC9B,QACE,IAAI;AAEP\"}") +/* +{ + "origin": "test.tsx", + "name": "renderHeader1_jMxQsjbyDss", + "entry": null, + "displayName": "test.tsx_renderHeader1", + "hash": "jMxQsjbyDss", + "canonicalFilename": "test.tsx_renderHeader1_jMxQsjbyDss", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 91, + 162 + ] +} +*/ +============================= test.tsx_renderHeader2_component_Ay6ibkfFYsw.tsx (ENTRY POINT)== + +export const renderHeader2_component_Ay6ibkfFYsw = ()=>{ + console.log("mount"); + return render; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"mDAQkC;IACjC,QAAQ,GAAG,CAAC;IACZ,OAAO;AACR\"}") +/* +{ + "origin": "test.tsx", + "name": "renderHeader2_component_Ay6ibkfFYsw", + "entry": null, + "displayName": "test.tsx_renderHeader2_component", + "hash": "Ay6ibkfFYsw", + "canonicalFilename": "test.tsx_renderHeader2_component_Ay6ibkfFYsw", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 199, + 247 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_10.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_10.snap new file mode 100644 index 00000000000..9b4a8e027c2 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_10.snap @@ -0,0 +1,89 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 269 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +const Header = $((decl1, {decl2}, [decl3]) => { + + const hola = ident1.no; + ident2; + const a = ident1 + ident3; + const b = ident1 + ident3; + ident4(ident5, [ident6], {ident7}, {key: ident8}); + class Some { + prop = ident9; + method() { + return ident10; + } + } + + return ( +
ident11 + ident12} required={false}/> + ) +}); + +============================= project/test.tsx_Header_WlR3xnI6u38.tsx (ENTRY POINT)== + +export const Header_WlR3xnI6u38 = (decl1, { decl2 }, [decl3])=>{ + ident1.no; + ident2; + ident1, ident3; + ident1, ident3; + ident4(ident5, [ + ident6 + ], { + ident7 + }, { + key: ident8 + }); + class Some { + prop = ident9; + method() { + return ident10; + } + } + return
ident11 + ident12} required={false}/>; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\"kCAEiB,CAAC,OAAO,EAAC,KAAK,EAAC,EAAE,CAAC,MAAM;IAE3B,OAAO,EAAE;IACtB;IACU,QAAS;IACT,QAAS;IACnB,OAAO,QAAQ;QAAC;KAAO,EAAE;QAAC;IAAM,GAAG;QAAC,KAAK;IAAM;IAC/C,MAAM;QACL,OAAO,OAAO;QACd,SAAS;YACR,OAAO;QACR;IACD;IAEA,QACE,IAAI,SAAS,CAAC,UAAY,UAAU,SAAS,UAAU;AAE1D\"}") +/* +{ + "origin": "project/test.tsx", + "name": "Header_WlR3xnI6u38", + "entry": null, + "displayName": "test.tsx_Header", + "hash": "WlR3xnI6u38", + "canonicalFilename": "test.tsx_Header_WlR3xnI6u38", + "path": "project", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 67, + 393 + ], + "paramNames": [ + "decl1", + "{decl2}", + "[decl3]" + ] +} +*/ +============================= project/test.tsx == + +import { qrl } from "@qwik.dev/core"; +// +/*#__PURE__*/ qrl(()=>import("./test.tsx_Header_WlR3xnI6u38"), "Header_WlR3xnI6u38"); + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_11.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_11.snap new file mode 100644 index 00000000000..0faa2db32db --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_11.snap @@ -0,0 +1,142 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 299 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +import {foo, bar as bbar} from "../state"; +import * as dep2 from "dep2"; +import dep3 from "dep3/something"; + +export const Header = component$(() => { + return ( +
dep3(ev))}> + {dep2.stuff()}{bbar()} +
+ ); +}); + +export const App = component$(() => { + return ( +
{foo()}
+ ); +}); + +============================= project/test.tsx_Header_component_Header_onClick_KjD9TCNkNxY.tsx == + +import dep3 from "dep3/something"; +// +export const Header_component_Header_onClick_KjD9TCNkNxY = (ev)=>dep3(ev); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\";;2DAQqB,CAAC,KAAO,KAAK\"}") +/* +{ + "origin": "project/test.tsx", + "name": "Header_component_Header_onClick_KjD9TCNkNxY", + "entry": "entry_segments", + "displayName": "test.tsx_Header_component_Header_onClick", + "hash": "KjD9TCNkNxY", + "canonicalFilename": "test.tsx_Header_component_Header_onClick_KjD9TCNkNxY", + "path": "project", + "extension": "tsx", + "parent": "Header_component_UVBJuFYfvDo", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 231, + 247 + ], + "paramNames": [ + "ev" + ] +} +*/ +============================= project/test.tsx_Header_component_UVBJuFYfvDo.tsx == + +import { Header } from "./test"; +import { bar as bbar } from "../state"; +import * as dep2 from "dep2"; +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_Header_onClick_KjD9TCNkNxY = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_Header_onClick_KjD9TCNkNxY"), "Header_component_Header_onClick_KjD9TCNkNxY"); +// +export const Header_component_UVBJuFYfvDo = ()=>{ + return
+ {dep2.stuff()}{bbar()} +
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;4CAMiC;IAChC,QACE,OAAO,wDAA8B;GACrC,CAAC,KAAK,KAAK,IAAI,OAAO;EACvB,EAAE;AAEJ\"}") +/* +{ + "origin": "project/test.tsx", + "name": "Header_component_UVBJuFYfvDo", + "entry": "entry_segments", + "displayName": "test.tsx_Header_component", + "hash": "UVBJuFYfvDo", + "canonicalFilename": "test.tsx_Header_component_UVBJuFYfvDo", + "path": "project", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 192, + 294 + ] +} +*/ +============================= project/test.tsx_App_component_wGkRHWXaqjs.tsx == + +import { Header } from "./test"; +import { foo } from "../state"; +// +export const App_component_wGkRHWXaqjs = ()=>{ + return
{foo()}
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\";;;yCAc8B;IAC7B,QACE,QAAQ,QAAQ;AAEnB\"}") +/* +{ + "origin": "project/test.tsx", + "name": "App_component_wGkRHWXaqjs", + "entry": "entry_segments", + "displayName": "test.tsx_App_component", + "hash": "wGkRHWXaqjs", + "canonicalFilename": "test.tsx_App_component_wGkRHWXaqjs", + "path": "project", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 328, + 378 + ] +} +*/ +============================= project/test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_wGkRHWXaqjs = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_wGkRHWXaqjs"), "App_component_wGkRHWXaqjs"); +const q_Header_component_UVBJuFYfvDo = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_UVBJuFYfvDo"), "Header_component_UVBJuFYfvDo"); +// +export const Header = /*#__PURE__*/ componentQrl(q_Header_component_UVBJuFYfvDo); +export const App = /*#__PURE__*/ componentQrl(q_App_component_wGkRHWXaqjs); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AAMA,OAAO,MAAM,uBAAS,6CAMnB;AAEH,OAAO,MAAM,oBAAM,0CAIhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_2.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_2.snap new file mode 100644 index 00000000000..4da7b33081c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_2.snap @@ -0,0 +1,92 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 113 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +export const Header = component$(() => { + console.log("mount"); + return ( +
console.log(ctx))}/> + ); +}); + +============================= test.tsx_Header_component_J4uyIhaBNR4.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_div_onClick_i7ekvWH3674 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_div_onClick_i7ekvWH3674"), "Header_component_div_onClick_i7ekvWH3674"); +// +export const Header_component_J4uyIhaBNR4 = ()=>{ + console.log("mount"); + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;4CAEiC;IAChC,QAAQ,GAAG,CAAC;IACZ,QACE,IAAI;AAEP\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_J4uyIhaBNR4", + "entry": null, + "displayName": "test.tsx_Header_component", + "hash": "J4uyIhaBNR4", + "canonicalFilename": "test.tsx_Header_component_J4uyIhaBNR4", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 83, + 177 + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_J4uyIhaBNR4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_J4uyIhaBNR4"), "Header_component_J4uyIhaBNR4"); +// +export const Header = /*#__PURE__*/ componentQrl(q_Header_component_J4uyIhaBNR4); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEA,OAAO,MAAM,uBAAS,6CAKnB\"}") +============================= test.tsx_Header_component_div_onClick_i7ekvWH3674.tsx (ENTRY POINT)== + +export const Header_component_div_onClick_i7ekvWH3674 = (ctx)=>console.log(ctx); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"wDAKkB,CAAC,MAAQ,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_div_onClick_i7ekvWH3674", + "entry": null, + "displayName": "test.tsx_Header_component_div_onClick", + "hash": "i7ekvWH3674", + "canonicalFilename": "test.tsx_Header_component_div_onClick_i7ekvWH3674", + "path": "", + "extension": "tsx", + "parent": "Header_component_J4uyIhaBNR4", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 142, + 167 + ], + "paramNames": [ + "ctx" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_3.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_3.snap new file mode 100644 index 00000000000..35b45fad2c0 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_3.snap @@ -0,0 +1,98 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 130 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +export const App = () => { + const Header = component$(() => { + console.log("mount"); + return ( +
console.log(ctx))}/> + ); + }); + return Header; +}); + +============================= test.tsx_App_Header_component_B9F3YeqcO1w.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_App_Header_component_div_onClick_aO7uI7Iw6oQ = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_Header_component_div_onClick_aO7uI7Iw6oQ"), "App_Header_component_div_onClick_aO7uI7Iw6oQ"); +// +export const App_Header_component_B9F3YeqcO1w = ()=>{ + console.log("mount"); + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;gDAG2B;IACzB,QAAQ,GAAG,CAAC;IACZ,QACE,IAAI;AAEP\"}") +/* +{ + "origin": "test.tsx", + "name": "App_Header_component_B9F3YeqcO1w", + "entry": null, + "displayName": "test.tsx_App_Header_component", + "hash": "B9F3YeqcO1w", + "canonicalFilename": "test.tsx_App_Header_component_B9F3YeqcO1w", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 104, + 203 + ] +} +*/ +============================= test.tsx_App_Header_component_div_onClick_aO7uI7Iw6oQ.tsx (ENTRY POINT)== + +export const App_Header_component_div_onClick_aO7uI7Iw6oQ = (ctx)=>console.log(ctx); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"4DAMmB,CAAC,MAAQ,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_Header_component_div_onClick_aO7uI7Iw6oQ", + "entry": null, + "displayName": "test.tsx_App_Header_component_div_onClick", + "hash": "aO7uI7Iw6oQ", + "canonicalFilename": "test.tsx_App_Header_component_div_onClick_aO7uI7Iw6oQ", + "path": "", + "extension": "tsx", + "parent": "App_Header_component_B9F3YeqcO1w", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 166, + 191 + ], + "paramNames": [ + "ctx" + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_Header_component_B9F3YeqcO1w = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_Header_component_B9F3YeqcO1w"), "App_Header_component_B9F3YeqcO1w"); +// +export const App = ()=>{ + const Header = /*#__PURE__*/ componentQrl(q_App_Header_component_B9F3YeqcO1w); + return Header; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEA,OAAO,MAAM,MAAM;IAClB,MAAM,uBAAS;IAMf,OAAO;AACR,EAAG\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_4.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_4.snap new file mode 100644 index 00000000000..c48b8916256 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_4.snap @@ -0,0 +1,98 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 150 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +export function App() { + const Header = component$(() => { + console.log("mount"); + return ( +
console.log(ctx))}/> + ); + }); + return Header; +} + +============================= test.tsx_App_Header_component_B9F3YeqcO1w.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_App_Header_component_div_onClick_aO7uI7Iw6oQ = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_Header_component_div_onClick_aO7uI7Iw6oQ"), "App_Header_component_div_onClick_aO7uI7Iw6oQ"); +// +export const App_Header_component_B9F3YeqcO1w = ()=>{ + console.log("mount"); + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;gDAG2B;IACzB,QAAQ,GAAG,CAAC;IACZ,QACE,IAAI;AAEP\"}") +/* +{ + "origin": "test.tsx", + "name": "App_Header_component_B9F3YeqcO1w", + "entry": null, + "displayName": "test.tsx_App_Header_component", + "hash": "B9F3YeqcO1w", + "canonicalFilename": "test.tsx_App_Header_component_B9F3YeqcO1w", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 101, + 200 + ] +} +*/ +============================= test.tsx_App_Header_component_div_onClick_aO7uI7Iw6oQ.tsx (ENTRY POINT)== + +export const App_Header_component_div_onClick_aO7uI7Iw6oQ = (ctx)=>console.log(ctx); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"4DAMmB,CAAC,MAAQ,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_Header_component_div_onClick_aO7uI7Iw6oQ", + "entry": null, + "displayName": "test.tsx_App_Header_component_div_onClick", + "hash": "aO7uI7Iw6oQ", + "canonicalFilename": "test.tsx_App_Header_component_div_onClick_aO7uI7Iw6oQ", + "path": "", + "extension": "tsx", + "parent": "App_Header_component_B9F3YeqcO1w", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 163, + 188 + ], + "paramNames": [ + "ctx" + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_Header_component_B9F3YeqcO1w = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_Header_component_B9F3YeqcO1w"), "App_Header_component_B9F3YeqcO1w"); +// +export function App() { + const Header = /*#__PURE__*/ componentQrl(q_App_Header_component_B9F3YeqcO1w); + return Header; +} + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEA,OAAO,SAAS;IACf,MAAM,uBAAS;IAMf,OAAO;AACR\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_5.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_5.snap new file mode 100644 index 00000000000..34b089dda34 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_5.snap @@ -0,0 +1,96 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 170 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +export const Header = component$(() => { + return ( + <> +
console.log("1")}/> +
console.log("2"))}/> + + ); +}); + +============================= test.tsx_Header_component_J4uyIhaBNR4.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_div_onClick_i7ekvWH3674 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_div_onClick_i7ekvWH3674"), "Header_component_div_onClick_i7ekvWH3674"); +// +export const Header_component_J4uyIhaBNR4 = ()=>{ + return <> +
console.log("1")}/> +
+ ; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;4CAEiC;IAChC,SACG;GACD,CAAC,IAAI,SAAS,CAAC,MAAQ,QAAQ,GAAG,CAAC,OAAO;GAC1C,CAAC,IAAI,sDAAwC;EAC9C;AAEF\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_J4uyIhaBNR4", + "entry": null, + "displayName": "test.tsx_Header_component", + "hash": "J4uyIhaBNR4", + "canonicalFilename": "test.tsx_Header_component_J4uyIhaBNR4", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 83, + 212 + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_J4uyIhaBNR4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_J4uyIhaBNR4"), "Header_component_J4uyIhaBNR4"); +// +export const Header = /*#__PURE__*/ componentQrl(q_Header_component_J4uyIhaBNR4); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEA,OAAO,MAAM,uBAAS,6CAOnB\"}") +============================= test.tsx_Header_component_div_onClick_i7ekvWH3674.tsx (ENTRY POINT)== + +export const Header_component_div_onClick_i7ekvWH3674 = (ctx)=>console.log("2"); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"wDAMmB,CAAC,MAAQ,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_div_onClick_i7ekvWH3674", + "entry": null, + "displayName": "test.tsx_Header_component_div_onClick", + "hash": "i7ekvWH3674", + "canonicalFilename": "test.tsx_Header_component_div_onClick_i7ekvWH3674", + "path": "", + "extension": "tsx", + "parent": "Header_component_J4uyIhaBNR4", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 171, + 196 + ], + "paramNames": [ + "ctx" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_6.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_6.snap new file mode 100644 index 00000000000..a034acbd546 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_6.snap @@ -0,0 +1,53 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 189 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +export const sym1 = $((ctx) => console.log("1")); + +============================= test.tsx_sym1_aXUrPXX5Lak.tsx (ENTRY POINT)== + +export const sym1_aXUrPXX5Lak = (ctx)=>console.log("1"); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"gCAEsB,CAAC,MAAQ,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "sym1_aXUrPXX5Lak", + "entry": null, + "displayName": "test.tsx_sym1", + "hash": "aXUrPXX5Lak", + "canonicalFilename": "test.tsx_sym1_aXUrPXX5Lak", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 72, + 97 + ], + "paramNames": [ + "ctx" + ] +} +*/ +============================= test.tsx == + +import { qrl } from "@qwik.dev/core"; +// +const q_sym1_aXUrPXX5Lak = /*#__PURE__*/ qrl(()=>import("./test.tsx_sym1_aXUrPXX5Lak"), "sym1_aXUrPXX5Lak"); +// +export const sym1 = q_sym1_aXUrPXX5Lak; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;AAEA,OAAO,MAAM,0BAAoC\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_7.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_7.snap new file mode 100644 index 00000000000..9cbded92485 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_7.snap @@ -0,0 +1,131 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 201 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +export const Header = component$(() => { + console.log("mount"); + return ( +
console.log(ctx))}/> + ); + }); + +const App = component$(() => { + return ( +
+ ); +}); + +============================= test.tsx_Header_component_J4uyIhaBNR4.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_div_onClick_i7ekvWH3674 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_div_onClick_i7ekvWH3674"), "Header_component_div_onClick_i7ekvWH3674"); +// +export const Header_component_J4uyIhaBNR4 = ()=>{ + console.log("mount"); + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;4CAGiC;IAChC,QAAQ,GAAG,CAAC;IACZ,QACE,IAAI;AAEN\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_J4uyIhaBNR4", + "entry": null, + "displayName": "test.tsx_Header_component", + "hash": "J4uyIhaBNR4", + "canonicalFilename": "test.tsx_Header_component_J4uyIhaBNR4", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 84, + 179 + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +const q_Header_component_J4uyIhaBNR4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_J4uyIhaBNR4"), "Header_component_J4uyIhaBNR4"); +// +export const Header = /*#__PURE__*/ componentQrl(q_Header_component_J4uyIhaBNR4); +/*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AAGA,OAAO,MAAM,uBAAS,6CAKlB;cAEQ\"}") +============================= test.tsx_App_component_ckEPmXZlub0.tsx (ENTRY POINT)== + +import { Header } from "./test"; +// +export const App_component_ckEPmXZlub0 = ()=>{ + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;yCAUuB;IACtB,QACE;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 206, + 241 + ] +} +*/ +============================= test.tsx_Header_component_div_onClick_i7ekvWH3674.tsx (ENTRY POINT)== + +export const Header_component_div_onClick_i7ekvWH3674 = (ctx)=>console.log(ctx); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"wDAMkB,CAAC,MAAQ,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_div_onClick_i7ekvWH3674", + "entry": null, + "displayName": "test.tsx_Header_component_div_onClick", + "hash": "i7ekvWH3674", + "canonicalFilename": "test.tsx_Header_component_div_onClick_i7ekvWH3674", + "path": "", + "extension": "tsx", + "parent": "Header_component_J4uyIhaBNR4", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 143, + 168 + ], + "paramNames": [ + "ctx" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_8.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_8.snap new file mode 100644 index 00000000000..c64d8da8cfe --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_8.snap @@ -0,0 +1,102 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 225 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +export const Header = component$(() => { + return $((hola) => { + const hola = this; + const {something, styff} = hola; + const hello = hola.nothere.stuff[global]; + return ( +
+ ); + }); +}); + +============================= test.tsx_Header_component_J4uyIhaBNR4.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_1_2B8d0oH9ZWc = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_1_2B8d0oH9ZWc"), "Header_component_1_2B8d0oH9ZWc"); +// +export const Header_component_J4uyIhaBNR4 = ()=>{ + return q_Header_component_1_2B8d0oH9ZWc; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;4CAGiC;IAChC;AAQD\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_J4uyIhaBNR4", + "entry": null, + "displayName": "test.tsx_Header_component", + "hash": "J4uyIhaBNR4", + "canonicalFilename": "test.tsx_Header_component_J4uyIhaBNR4", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 84, + 249 + ] +} +*/ +============================= test.tsx_Header_component_1_2B8d0oH9ZWc.tsx (ENTRY POINT)== + +import { Header } from "./test"; +// +export const Header_component_1_2B8d0oH9ZWc = (hola)=>{ + const hola = this; + hola.nothere.stuff[global]; + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;8CAIU,CAAC;IACT,MAAM,OAAO,IAAI;IAEH,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO;IACxC,QACE;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_1_2B8d0oH9ZWc", + "entry": null, + "displayName": "test.tsx_Header_component_1", + "hash": "2B8d0oH9ZWc", + "canonicalFilename": "test.tsx_Header_component_1_2B8d0oH9ZWc", + "path": "", + "extension": "tsx", + "parent": "Header_component_J4uyIhaBNR4", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 102, + 245 + ], + "paramNames": [ + "hola" + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_J4uyIhaBNR4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_J4uyIhaBNR4"), "Header_component_J4uyIhaBNR4"); +// +export const Header = /*#__PURE__*/ componentQrl(q_Header_component_J4uyIhaBNR4); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,uBAAS,6CASnB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_9.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_9.snap new file mode 100644 index 00000000000..1bde674ef8d --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_9.snap @@ -0,0 +1,66 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 247 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +const Header = $((decl1, {decl2}, [decl3]) => { + const {decl4, key: decl5} = this; + let [decl6, ...decl7] = stuff; + const decl8 = 1, decl9; + function decl10(decl11, {decl12}, [decl13]) {} + class decl14 { + method(decl15, {decl16}, [decl17]) {} + } + try{}catch(decl18){} + try{}catch({decl19}){} +}); + +============================= test.tsx_Header_WjUaUQN7Oxg.tsx (ENTRY POINT)== + +export const Header_WjUaUQN7Oxg = (decl1, { decl2 }, [decl3])=>{ + const { decl4, key: decl5 } = this; + let [decl6, ...decl7] = stuff; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"kCAEiB,CAAC,OAAO,EAAC,KAAK,EAAC,EAAE,CAAC,MAAM;IACxC,MAAM,EAAC,KAAK,EAAE,KAAK,KAAK,EAAC,GAAG,IAAI;IAChC,IAAI,CAAC,OAAO,GAAG,MAAM,GAAG;AAQzB\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_WjUaUQN7Oxg", + "entry": null, + "displayName": "test.tsx_Header", + "hash": "WjUaUQN7Oxg", + "canonicalFilename": "test.tsx_Header_WjUaUQN7Oxg", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 67, + 344 + ], + "paramNames": [ + "decl1", + "{decl2}", + "[decl3]" + ] +} +*/ +============================= test.tsx == + +import { qrl } from "@qwik.dev/core"; +// +/*#__PURE__*/ qrl(()=>import("./test.tsx_Header_WjUaUQN7Oxg"), "Header_WjUaUQN7Oxg"); + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_build_server.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_build_server.snap new file mode 100644 index 00000000000..ea6907a9b67 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_build_server.snap @@ -0,0 +1,91 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2732 +expression: output +--- +==INPUT== + + +import { component$, useStore, isDev, isServer as isServer2 } from '@qwik.dev/core'; +import { isServer, isBrowser as isb } from '@qwik.dev/core/build'; +import { mongodb } from 'mondodb'; +import { threejs } from 'threejs'; + +import L from 'leaflet'; + +export const functionThatNeedsWindow = () => { + if (isb) { + console.log('l', L); + console.log('hey'); + window.alert('hey'); + } +}; + +export const App = component$(() => { + useMount$(() => { + if (isServer) { + console.log('server', mongodb()); + } + if (isb) { + console.log('browser', new threejs()); + } + }); + return ( + + {isServer2 &&

server

} + {isb &&

server

} +
+ ); +}); + +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_s_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "s_ckEPmXZlub0"); +// +export const functionThatNeedsWindow = ()=>{}; +export const App = /*#__PURE__*/ componentQrl(q_s_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAQA,OAAO,MAAM,0BAA0B,KAMvC,EAAE;AAEF,OAAO,MAAM,oBAAM,8BAehB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.tsx (ENTRY POINT)== + +import { mongodb } from "mondodb"; +// +export const s_ckEPmXZlub0 = ()=>{ + useMount$(()=>{ + console.log('server', mongodb()); + }); + return + {

server

} + {false} +
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;6BAgB8B;IAC7B,UAAU;QAER,QAAQ,GAAG,CAAC,UAAU;IAKxB;IACA,QACE,IAAI;GACJ,EAAe,EAAE,MAAM,EAAE,GAAG;GAC5B,OAAsB;EACvB,EAAE;AAEJ\"}") +/* +{ + "origin": "test.tsx", + "name": "s_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 423, + 663 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_capture_imports.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_capture_imports.snap new file mode 100644 index 00000000000..683f9b36bf9 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_capture_imports.snap @@ -0,0 +1,124 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1025 +expression: output +--- +==INPUT== + + +import { component$, useStyles$ } from '@qwik.dev/core'; +import css1 from './global.css'; +import css2 from './style.css'; +import css3 from './style.css'; + +export const App = component$(() => { + useStyles$(`${css1}${css2}`); + useStyles$(css3); +}) + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAMA,OAAO,MAAM,oBAAM,0CAGjB\"}") +============================= test.tsx_App_component_useStyles_t35nSa5UV7U.js (ENTRY POINT)== + +import css1 from "./global.css"; +import css2 from "./style.css"; +// +export const App_component_useStyles_t35nSa5UV7U = `${css1}${css2}`; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;mDAOY,GAAG,OAAO,MAAM\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_useStyles_t35nSa5UV7U", + "entry": null, + "displayName": "test.tsx_App_component_useStyles", + "hash": "t35nSa5UV7U", + "canonicalFilename": "test.tsx_App_component_useStyles_t35nSa5UV7U", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "useStyles$", + "captures": false, + "loc": [ + 207, + 223 + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +import { useStylesQrl } from "@qwik.dev/core"; +// +const q_App_component_useStyles_t35nSa5UV7U = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_useStyles_t35nSa5UV7U"), "App_component_useStyles_t35nSa5UV7U"); +const q_style_css_TRu1FaIoUM0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_style_css_TRu1FaIoUM0"), "style_css_TRu1FaIoUM0"); +// +export const App_component_ckEPmXZlub0 = ()=>{ + useStylesQrl(q_App_component_useStyles_t35nSa5UV7U); + useStylesQrl(q_style_css_TRu1FaIoUM0); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;yCAM8B;IAC7B;IACA;AACD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 187, + 246 + ] +} +*/ +============================= test.tsx_style_css_TRu1FaIoUM0.js (ENTRY POINT)== + +import css3 from "./style.css"; +// +export const style_css_TRu1FaIoUM0 = css3; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;qCAQY\"}") +/* +{ + "origin": "test.tsx", + "name": "style_css_TRu1FaIoUM0", + "entry": null, + "displayName": "test.tsx_style_css", + "hash": "TRu1FaIoUM0", + "canonicalFilename": "test.tsx_style_css_TRu1FaIoUM0", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "useStyles$", + "captures": false, + "loc": [ + 238, + 242 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_capturing_fn_class.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_capturing_fn_class.snap new file mode 100644 index 00000000000..98d2136db4c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_capturing_fn_class.snap @@ -0,0 +1,123 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1046 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +export const App = component$(() => { + function hola() { + console.log('hola'); + } + class Thing {} + class Other {} + + return $(() => { + hola(); + new Thing(); + return ( +
+ ) + }); +}) + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CAcjB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_1_w0t0o3QMovU = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_1_w0t0o3QMovU"), "App_component_1_w0t0o3QMovU"); +// +export const App_component_ckEPmXZlub0 = ()=>{ + return q_App_component_1_w0t0o3QMovU; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;yCAG8B;IAO7B;AAOD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 81, + 246 + ] +} +*/ +============================= test.tsx_App_component_1_w0t0o3QMovU.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +// +export const App_component_1_w0t0o3QMovU = ()=>{ + hola(); + new Thing(); + return /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;2CAUU;IACR;IACA,IAAI;IACJ,qBACC,WAAC;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_1_w0t0o3QMovU", + "entry": null, + "displayName": "test.tsx_App_component_1", + "hash": "w0t0o3QMovU", + "canonicalFilename": "test.tsx_App_component_1_w0t0o3QMovU", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 177, + 242 + ] +} +*/ +== DIAGNOSTICS == + +[ + { + "category": "error", + "code": "C02", + "file": "test.tsx", + "message": "Reference to identifier 'Thing' can not be used inside a Qrl($) scope because it's a function", + "highlights": null, + "suggestions": null, + "scope": "optimizer" + }, + { + "category": "error", + "code": "C02", + "file": "test.tsx", + "message": "Reference to identifier 'hola' can not be used inside a Qrl($) scope because it's a function", + "highlights": null, + "suggestions": null, + "scope": "optimizer" + } +] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_class_name.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_class_name.snap new file mode 100644 index 00000000000..a9e6c64880e --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_class_name.snap @@ -0,0 +1,101 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2649 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export const App2 = component$(() => { + const signal = useSignal(); + const computed = signal.value + 'foo'; + return ( + <> +
+
+
+
+ + + + + + + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App2_component_3yveMqbQ3Fs = /*#__PURE__*/ qrl(()=>import("./test.tsx_App2_component_3yveMqbQ3Fs.js"), "App2_component_3yveMqbQ3Fs"); +// +export const App2 = /*#__PURE__*/ componentQrl(q_App2_component_3yveMqbQ3Fs); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,qBAAO,2CAgBjB\"}") +============================= test.tsx_App2_component_3yveMqbQ3Fs.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +// +export const App2_component_3yveMqbQ3Fs = ()=>{ + const signal = useSignal(); + const computed = signal.value + 'foo'; + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", null, { + "class": "hola" + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, { + "class": _wrapProp(signal) + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, { + "class": signal + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", { + "class": computed + }, null, null, 3, null), + /*#__PURE__*/ _jsxSorted(Foo, null, { + className: "hola" + }, null, 3, "u6_0"), + /*#__PURE__*/ _jsxSorted(Foo, null, { + className: _wrapProp(signal) + }, null, 3, "u6_1"), + /*#__PURE__*/ _jsxSorted(Foo, null, { + className: signal + }, null, 3, "u6_2"), + /*#__PURE__*/ _jsxSorted(Foo, { + className: computed + }, null, null, 3, "u6_3") + ], 1, "u6_4"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;0CAG+B;IAC9B,MAAM,SAAS;IACf,MAAM,WAAW,OAAO,KAAK,GAAG;IAChC,qBACC;sBACC,WAAC;YAAI,SAAU;;sBACf,WAAC;YAAI,OAAS,YAAE;;sBAChB,WAAC;YAAI,SAAW;;sBAChB,WAAC;YAAI,SAAW;;sBAEhB,WAAC;YAAI,WAAU;;sBACf,WAAC;YAAI,SAAS,YAAE;;sBAChB,WAAC;YAAI,WAAW;;sBAChB,WAAC;YAAI,WAAW;;;AAGnB\"}") +/* +{ + "origin": "test.tsx", + "name": "App2_component_3yveMqbQ3Fs", + "entry": null, + "displayName": "test.tsx_App2_component", + "hash": "3yveMqbQ3Fs", + "canonicalFilename": "test.tsx_App2_component_3yveMqbQ3Fs", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 79, + 467 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_component_with_event_listeners_inside_loop.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_component_with_event_listeners_inside_loop.snap new file mode 100644 index 00000000000..0226b312203 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_component_with_event_listeners_inside_loop.snap @@ -0,0 +1,489 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3978 +expression: output +--- +==INPUT== + + +import { $, component$, useStore, useSignal } from '@qwik.dev/core'; +export const App = component$(() => { + const cart = useStore([]); + const results = useSignal(['foo']); + function loopArrowFn(results: string[]) { + return results.map((item) => ( + { + cart.push(item); + }} + > + {item} + + )); + } + function loopForI(results: string[]) { + const items = []; + for (let i = 0; i < results.length; i++) { + items.push( + { + cart.push(results[i]); + }} + > + {results[i]} + + ); + } + return items; + } + function loopForOf(results: string[]) { + const items = []; + for (const item of results) { + items.push( + { + cart.push(item); + }} + > + {item} + + ); + } + return items; + } + function loopForIn(results: string[]) { + const items = []; + for (const key in results) { + items.push( + { + cart.push(results[key]); + }} + > + {results[key]} + + ); + } + return items; + } + function loopWhile(results: string[]) { + const items = []; + let i = 0; + while (i < results.length) { + items.push( + { + cart.push(results[i]); + }} + > + {results[i]} + + ); + i++; + } + return items; + } + return ( +
+ {results.value.map((item) => ( + + ))} + {loopArrowFn(results.value)} + {loopForI(results.value)} + {loopForOf(results.value)} + {loopForIn(results.value)} + {loopWhile(results.value)} +
+ ); + }); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAEA,OAAO,MAAM,oBAAM,0CA+FZ\"}") +============================= test.tsx_App_component_loopForIn_span_q_e_click_adzBGickx1U.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_loopForIn_span_q_e_click_adzBGickx1U = (_, _1, key)=>{ + const cart = _captures[0], results = _captures[1]; + cart.push(results[key]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;kEAmDwB,QAHL;;IAIH,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_loopForIn_span_q_e_click_adzBGickx1U", + "entry": null, + "displayName": "test.tsx_App_component_loopForIn_span_q_e_click", + "hash": "adzBGickx1U", + "canonicalFilename": "test.tsx_App_component_loopForIn_span_q_e_click_adzBGickx1U", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 1319, + 1383 + ], + "paramNames": [ + "_", + "_1", + "key" + ], + "captureNames": [ + "cart", + "results" + ] +} +*/ +============================= test.tsx_App_component_loopWhile_span_q_e_click_05kCMrZVn5E.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_loopWhile_span_q_e_click_05kCMrZVn5E = (_, _1, i)=>{ + const cart = _captures[0], results = _captures[1]; + cart.push(results[i]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;kEAmEwB,QAHT;;IAIC,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_loopWhile_span_q_e_click_05kCMrZVn5E", + "entry": null, + "displayName": "test.tsx_App_component_loopWhile_span_q_e_click", + "hash": "05kCMrZVn5E", + "canonicalFilename": "test.tsx_App_component_loopWhile_span_q_e_click_05kCMrZVn5E", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 1693, + 1755 + ], + "paramNames": [ + "_", + "_1", + "i" + ], + "captureNames": [ + "cart", + "results" + ] +} +*/ +============================= test.tsx_App_component_loopForOf_span_q_e_click_zlNGHYu926I.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_loopForOf_span_q_e_click_zlNGHYu926I = (_, _1, item)=>{ + const cart = _captures[0]; + cart.push(item); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;kEAoCwB,QAHL;;IAIH,KAAK,IAAI,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_loopForOf_span_q_e_click_zlNGHYu926I", + "entry": null, + "displayName": "test.tsx_App_component_loopForOf_span_q_e_click", + "hash": "zlNGHYu926I", + "canonicalFilename": "test.tsx_App_component_loopForOf_span_q_e_click_zlNGHYu926I", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 980, + 1036 + ], + "paramNames": [ + "_", + "_1", + "item" + ], + "captureNames": [ + "cart" + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useSignal } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +// +const _hf0 = (p0, p1)=>p1[p0]; +const _hf0_str = "p1[p0]"; +// +const q_App_component_div_button_q_e_click_UB6Fs5a3bd8 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_div_button_q_e_click_UB6Fs5a3bd8"), "App_component_div_button_q_e_click_UB6Fs5a3bd8"); +const q_App_component_loopArrowFn_span_q_e_click_Wau7C836nf0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_loopArrowFn_span_q_e_click_Wau7C836nf0"), "App_component_loopArrowFn_span_q_e_click_Wau7C836nf0"); +const q_App_component_loopForI_span_q_e_click_PbCYbPM6etI = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_loopForI_span_q_e_click_PbCYbPM6etI"), "App_component_loopForI_span_q_e_click_PbCYbPM6etI"); +const q_App_component_loopForIn_span_q_e_click_adzBGickx1U = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_loopForIn_span_q_e_click_adzBGickx1U"), "App_component_loopForIn_span_q_e_click_adzBGickx1U"); +const q_App_component_loopForOf_span_q_e_click_zlNGHYu926I = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_loopForOf_span_q_e_click_zlNGHYu926I"), "App_component_loopForOf_span_q_e_click_zlNGHYu926I"); +const q_App_component_loopWhile_span_q_e_click_05kCMrZVn5E = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_loopWhile_span_q_e_click_05kCMrZVn5E"), "App_component_loopWhile_span_q_e_click_05kCMrZVn5E"); +// +export const App_component_ckEPmXZlub0 = ()=>{ + const cart = useStore([]); + const results = useSignal([ + 'foo' + ]); + const App_component_loopArrowFn_span_q_e_click_Wau7C836nf0 = q_App_component_loopArrowFn_span_q_e_click_Wau7C836nf0.w([ + cart + ]); + const App_component_loopForI_span_q_e_click_PbCYbPM6etI = q_App_component_loopForI_span_q_e_click_PbCYbPM6etI.w([ + cart, + results + ]); + const App_component_loopForOf_span_q_e_click_zlNGHYu926I = q_App_component_loopForOf_span_q_e_click_zlNGHYu926I.w([ + cart + ]); + const App_component_loopForIn_span_q_e_click_adzBGickx1U = q_App_component_loopForIn_span_q_e_click_adzBGickx1U.w([ + cart, + results + ]); + const App_component_loopWhile_span_q_e_click_05kCMrZVn5E = q_App_component_loopWhile_span_q_e_click_05kCMrZVn5E.w([ + cart, + results + ]); + const App_component_div_button_q_e_click_UB6Fs5a3bd8 = q_App_component_div_button_q_e_click_UB6Fs5a3bd8.w([ + cart + ]); + function loopArrowFn(results) { + return results.map((item)=>/*#__PURE__*/ _jsxSorted("span", { + "q-e:click": App_component_loopArrowFn_span_q_e_click_Wau7C836nf0, + "q:p": item + }, null, item, 4, "u6_0")); + } + function loopForI(results) { + const items = []; + for(let i = 0; i < results.length; i++)items.push(/*#__PURE__*/ _jsxSorted("span", { + "q-e:click": App_component_loopForI_span_q_e_click_PbCYbPM6etI, + "q:p": i + }, null, _fnSignal(_hf0, [ + i, + results + ], _hf0_str), 4, "u6_1")); + return items; + } + function loopForOf(results) { + const items = []; + for (const item of results)items.push(/*#__PURE__*/ _jsxSorted("span", { + "q-e:click": App_component_loopForOf_span_q_e_click_zlNGHYu926I, + "q:p": item + }, null, item, 6, "u6_2")); + return items; + } + function loopForIn(results) { + const items = []; + for(const key in results)items.push(/*#__PURE__*/ _jsxSorted("span", { + "q-e:click": App_component_loopForIn_span_q_e_click_adzBGickx1U, + "q:p": key + }, null, _fnSignal(_hf0, [ + key, + results + ], _hf0_str), 4, "u6_3")); + return items; + } + function loopWhile(results) { + const items = []; + let i = 0; + while(i < results.length){ + items.push(/*#__PURE__*/ _jsxSorted("span", { + "q-e:click": App_component_loopWhile_span_q_e_click_05kCMrZVn5E, + "q:p": i + }, null, _fnSignal(_hf0, [ + i, + results + ], _hf0_str), 4, "u6_4")); + i++; + } + return items; + } + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + results.value.map((item)=>/*#__PURE__*/ _jsxSorted("button", { + "q-e:click": App_component_div_button_q_e_click_UB6Fs5a3bd8, + "q:p": item + }, { + id: "second" + }, item, 4, "u6_5")), + loopArrowFn(results.value), + loopForI(results.value), + loopForOf(results.value), + loopForIn(results.value), + loopWhile(results.value) + ], 1, "u6_6"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;uBAyBe,EAAO,IAAG;;;;;;;;;;yCAvBK;IACxB,MAAM,OAAO,SAAmB,EAAE;IAClC,MAAM,UAAU,UAAU;QAAC;KAAM;;;;;;;;;;;;;;;;;;;;;;IACjC,SAAS,YAAY,OAAiB;QACpC,OAAO,QAAQ,GAAG,CAAC,CAAC,qBAClB,WAAC;gBACC,WAAQ;uBAFQ;qBAMf;IAGP;IACA,SAAS,SAAS,OAAiB;QACjC,MAAM,QAAQ,EAAE;QAChB,IAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,MAAM,EAAE,IAClC,MAAM,IAAI,eACR,WAAC;YACC,WAAQ;mBAHL;;;;;QAWT,OAAO;IACT;IACA,SAAS,UAAU,OAAiB;QAClC,MAAM,QAAQ,EAAE;QAChB,KAAK,MAAM,QAAQ,QACjB,MAAM,IAAI,eACR,WAAC;YACC,WAAQ;mBAHH;iBAOJ;QAIP,OAAO;IACT;IACA,SAAS,UAAU,OAAiB;QAClC,MAAM,QAAQ,EAAE;QAChB,IAAK,MAAM,OAAO,QAChB,MAAM,IAAI,eACR,WAAC;YACC,WAAQ;mBAHH;;;;;QAWX,OAAO;IACT;IACA,SAAS,UAAU,OAAiB;QAClC,MAAM,QAAQ,EAAE;QAChB,IAAI,IAAI;QACR,MAAO,IAAI,QAAQ,MAAM,CAAE;YACzB,MAAM,IAAI,eACR,WAAC;gBACC,WAAQ;uBAHP;;;;;YAUL;QACF;QACA,OAAO;IACT;IACA,qBACE,WAAC;QACE,QAAQ,KAAK,CAAC,GAAG,CAAC,CAAC,qBAClB,WAAC;gBAEC,WAAQ;uBAHQ;;gBAEhB,IAAG;eAKF;QAGJ,YAAY,QAAQ,KAAK;QACzB,SAAS,QAAQ,KAAK;QACtB,UAAU,QAAQ,KAAK;QACvB,UAAU,QAAQ,KAAK;QACvB,UAAU,QAAQ,KAAK;;AAG9B\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 101, + 2370 + ] +} +*/ +============================= test.tsx_App_component_loopForI_span_q_e_click_PbCYbPM6etI.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_loopForI_span_q_e_click_PbCYbPM6etI = (_, _1, i)=>{ + const cart = _captures[0], results = _captures[1]; + cart.push(results[i]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;iEAqBwB,QAHP;;IAID,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_loopForI_span_q_e_click_PbCYbPM6etI", + "entry": null, + "displayName": "test.tsx_App_component_loopForI_span_q_e_click", + "hash": "PbCYbPM6etI", + "canonicalFilename": "test.tsx_App_component_loopForI_span_q_e_click_PbCYbPM6etI", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 628, + 690 + ], + "paramNames": [ + "_", + "_1", + "i" + ], + "captureNames": [ + "cart", + "results" + ] +} +*/ +============================= test.tsx_App_component_div_button_q_e_click_UB6Fs5a3bd8.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_div_button_q_e_click_UB6Fs5a3bd8 = (_, _1, item)=>{ + const cart = _captures[0]; + cart.push(item); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;8DAmFwB,QAHM;;IAId,KAAK,IAAI,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_div_button_q_e_click_UB6Fs5a3bd8", + "entry": null, + "displayName": "test.tsx_App_component_div_button_q_e_click", + "hash": "UB6Fs5a3bd8", + "canonicalFilename": "test.tsx_App_component_div_button_q_e_click_UB6Fs5a3bd8", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 2026, + 2082 + ], + "paramNames": [ + "_", + "_1", + "item" + ], + "captureNames": [ + "cart" + ] +} +*/ +============================= test.tsx_App_component_loopArrowFn_span_q_e_click_Wau7C836nf0.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_loopArrowFn_span_q_e_click_Wau7C836nf0 = (_, _1, item)=>{ + const cart = _captures[0]; + cart.push(item); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;oEAQsB,QAFM;;IAGd,KAAK,IAAI,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_loopArrowFn_span_q_e_click_Wau7C836nf0", + "entry": null, + "displayName": "test.tsx_App_component_loopArrowFn_span_q_e_click", + "hash": "Wau7C836nf0", + "canonicalFilename": "test.tsx_App_component_loopArrowFn_span_q_e_click_Wau7C836nf0", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 319, + 371 + ], + "paramNames": [ + "_", + "_1", + "item" + ], + "captureNames": [ + "cart" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_custom_inlined_functions.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_custom_inlined_functions.snap new file mode 100644 index 00000000000..cc9e637fa71 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_custom_inlined_functions.snap @@ -0,0 +1,199 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1308 +expression: output +--- +==INPUT== + + +import { component$, $, useStore, wrap, useEffect } from '@qwik.dev/core'; + +export const useMemoQrl = (qrt) => { + useEffect(qrt); +}; + +export const useMemo$ = wrap(useMemoQrl); + +export const App = component$((props) => { + const state = useStore({count: 0}); + useMemo$(() => { + console.log(state.count); + }); + return $(() => ( +
{state.count}
+ )); +}); + +export const Lightweight = (props) => { + useMemo$(() => { + console.log(state.count); + }); +}; + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { wrap, useEffect } from '@qwik.dev/core'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +const q_Lightweight_useMemo_UIcxVTQF1a8 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Lightweight_useMemo_UIcxVTQF1a8"), "Lightweight_useMemo_UIcxVTQF1a8"); +// +export const useMemoQrl = (qrt)=>{ + useEffect(qrt); +}; +export const useMemo$ = wrap(useMemoQrl); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); +export const Lightweight = (props)=>{ + useMemoQrl(q_Lightweight_useMemo_UIcxVTQF1a8); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;AACA,SAAkC,IAAI,EAAE,SAAS,QAAQ,iBAAiB;;;;;AAE1E,OAAO,MAAM,aAAa,CAAC;IAC1B,UAAU;AACX,EAAE;AAEF,OAAO,MAAM,WAAW,KAAK,YAAY;AAEzC,OAAO,MAAM,oBAAM,0CAQhB;AAEH,OAAO,MAAM,cAAc,CAAC;IAC3B;AAGD,EAAE\"}") +============================= test.tsx_App_component_useMemo_6Sc9KVki3Y0.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_useMemo_6Sc9KVki3Y0 = ()=>{ + const state = _captures[0]; + console.log(state.count); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;iDAWU;;IACR,QAAQ,GAAG,CAAC,MAAM,KAAK\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_useMemo_6Sc9KVki3Y0", + "entry": null, + "displayName": "test.tsx_App_component_useMemo", + "hash": "6Sc9KVki3Y0", + "canonicalFilename": "test.tsx_App_component_useMemo_6Sc9KVki3Y0", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "useMemo$", + "captures": true, + "loc": [ + 269, + 307 + ], + "captureNames": [ + "state" + ] +} +*/ +============================= test.tsx_Lightweight_useMemo_UIcxVTQF1a8.js (ENTRY POINT)== + +export const Lightweight_useMemo_UIcxVTQF1a8 = ()=>{ + console.log(state.count); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"+CAoBU;IACR,QAAQ,GAAG,CAAC,MAAM,KAAK;AACxB\"}") +/* +{ + "origin": "test.tsx", + "name": "Lightweight_useMemo_UIcxVTQF1a8", + "entry": null, + "displayName": "test.tsx_Lightweight_useMemo", + "hash": "UIcxVTQF1a8", + "canonicalFilename": "test.tsx_Lightweight_useMemo_UIcxVTQF1a8", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "useMemo$", + "captures": false, + "loc": [ + 415, + 453 + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { useMemoQrl } from "./test"; +import { qrl } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +// +const q_App_component_1_w0t0o3QMovU = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_1_w0t0o3QMovU"), "App_component_1_w0t0o3QMovU"); +const q_App_component_useMemo_6Sc9KVki3Y0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_useMemo_6Sc9KVki3Y0"), "App_component_useMemo_6Sc9KVki3Y0"); +// +export const App_component_ckEPmXZlub0 = (props)=>{ + const state = useStore({ + count: 0 + }); + useMemoQrl(q_App_component_useMemo_6Sc9KVki3Y0.w([ + state + ])); + return q_App_component_1_w0t0o3QMovU.w([ + state + ]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;yCAS8B,CAAC;IAC9B,MAAM,QAAQ,SAAS;QAAC,OAAO;IAAC;IAChC;;;IAGA;;;AAGD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 209, + 361 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_1_w0t0o3QMovU.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +// +export const App_component_1_w0t0o3QMovU = ()=>{ + const state = _captures[0]; + return /*#__PURE__*/ _jsxSorted("div", null, null, _wrapProp(state, "count"), 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;2CAcU;;yBACR,WAAC,6BAAK\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_1_w0t0o3QMovU", + "entry": null, + "displayName": "test.tsx_App_component_1", + "hash": "w0t0o3QMovU", + "canonicalFilename": "test.tsx_App_component_1_w0t0o3QMovU", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 320, + 357 + ], + "captureNames": [ + "state" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dead_code.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dead_code.snap new file mode 100644 index 00000000000..5ab2f50926a --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dead_code.snap @@ -0,0 +1,68 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 450 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; +import { deps } from 'deps'; + +export const Foo = component$(({foo}) => { + useMount$(() => { + if (false) { + deps(); + } + }); + return ( +
+ ); +}) + +============================= test.tsx_Foo_component_HTDRsvUbLiE.tsx (ENTRY POINT)== + +export const Foo_component_HTDRsvUbLiE = (_rawProps)=>{ + useMount$(()=>{}); + return
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"yCAI8B;IAC7B,UAAU,KAIV;IACA,QACE;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 107, + 199 + ], + "paramNames": [ + "_rawProps" + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "Foo_component_HTDRsvUbLiE"); +// +export const Foo = /*#__PURE__*/ componentQrl(q_Foo_component_HTDRsvUbLiE); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAIA,OAAO,MAAM,oBAAM,0CASjB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export.snap new file mode 100644 index 00000000000..b8ed7373945 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export.snap @@ -0,0 +1,96 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1549 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; +import { sibling } from './sibling'; + +export default component$(() => { + return ( +
console.log(mongodb, sibling)}> +
+ ); +}); + + +============================= src/routes/_repl/[id]/[[...slug]].js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_slug_component_0AM8HPnkNs4 = /*#__PURE__*/ qrl(()=>import("./[[...slug]].tsx_slug_component_0AM8HPnkNs4.js"), "slug_component_0AM8HPnkNs4"); +// +export default /*#__PURE__*/ componentQrl(q_slug_component_0AM8HPnkNs4); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/src/routes/_repl/[id]/[[...slug]].tsx\"],\"names\":[],\"mappings\":\";;;;;AAIA,6BAAe,2CAKZ\"}") +============================= src/routes/_repl/[id]/[[...slug]].tsx_slug_component_div_q_e_click_bCwVPYSTQ0w.js (ENTRY POINT)== + +import { sibling } from "./sibling"; +// +export const slug_component_div_q_e_click_bCwVPYSTQ0w = ()=>console.log(mongodb, sibling); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/src/routes/_repl/[id]/[[...slug]].tsx\"],\"names\":[],\"mappings\":\";;wDAMiB,IAAM,QAAQ,GAAG,CAAC,SAAS\"}") +/* +{ + "origin": "src/routes/_repl/[id]/[[...slug]].tsx", + "name": "slug_component_div_q_e_click_bCwVPYSTQ0w", + "entry": null, + "displayName": "[[...slug]].tsx_slug_component_div_q_e_click", + "hash": "bCwVPYSTQ0w", + "canonicalFilename": "[[...slug]].tsx_slug_component_div_q_e_click_bCwVPYSTQ0w", + "path": "src/routes/_repl/[id]", + "extension": "js", + "parent": "slug_component_0AM8HPnkNs4", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 146, + 181 + ] +} +*/ +============================= src/routes/_repl/[id]/[[...slug]].tsx_slug_component_0AM8HPnkNs4.js == + +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_slug_component_div_q_e_click_bCwVPYSTQ0w = /*#__PURE__*/ qrl(()=>import("./[[...slug]].tsx_slug_component_div_q_e_click_bCwVPYSTQ0w.js"), "slug_component_div_q_e_click_bCwVPYSTQ0w"); +// +export const slug_component_0AM8HPnkNs4 = ()=>{ + return /*#__PURE__*/ _jsxSorted("div", null, { + "q-e:click": q_slug_component_div_q_e_click_bCwVPYSTQ0w + }, null, 3, "W4_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/src/routes/_repl/[id]/[[...slug]].tsx\"],\"names\":[],\"mappings\":\";;;;;0CAI0B;IACzB,qBACC,WAAC;QAAI,WAAQ;;AAGf\"}") +/* +{ + "origin": "src/routes/_repl/[id]/[[...slug]].tsx", + "name": "slug_component_0AM8HPnkNs4", + "entry": "src/routes/_repl/[id]/[[...slug]].tsx_entry_[[...slug]]", + "displayName": "[[...slug]].tsx_slug_component", + "hash": "0AM8HPnkNs4", + "canonicalFilename": "[[...slug]].tsx_slug_component_0AM8HPnkNs4", + "path": "src/routes/_repl/[id]", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 111, + 198 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export_index.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export_index.snap new file mode 100644 index 00000000000..61c217ca3a8 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export_index.snap @@ -0,0 +1,38 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1574 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export default component$(() => { + return ( +
console.log(mongodb)}> +
+ ); +}); + + +============================= src/components/mongo/index.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +// +const q_mongo_component_div_q_e_click_jncbxvZVtWY = /*#__PURE__*/ _noopQrl("mongo_component_div_q_e_click_jncbxvZVtWY"); +const q_mongo_component_ouWLj4jA2oI = /*#__PURE__*/ _noopQrl("mongo_component_ouWLj4jA2oI"); +// +q_mongo_component_div_q_e_click_jncbxvZVtWY.s(()=>console.log(mongodb)); +q_mongo_component_ouWLj4jA2oI.s(()=>{ + return
+
; +}); +export default /*#__PURE__*/ componentQrl(q_mongo_component_ouWLj4jA2oI); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/src/components/mongo/index.tsx\"],\"names\":[],\"mappings\":\";;;;;;8CAKiB,IAAM,QAAQ,GAAG,CAAC;gCAFT;IACzB,QACE,IAAI,wDAAsC;EAC3C,EAAE;AAEJ;AALA,6BAAe,4CAKZ\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export_invalid_ident.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export_invalid_ident.snap new file mode 100644 index 00000000000..abb81fa60ec --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_default_export_invalid_ident.snap @@ -0,0 +1,91 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1595 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export default component$(() => { + return ( +
console.log(mongodb)}> +
+ ); +}); + + +============================= src/components/mongo/404.tsx__404_component_div_q_e_click_aMLnLWtkRhc.tsx (ENTRY POINT)== + +export const _404_component_div_q_e_click_aMLnLWtkRhc = ()=>console.log(mongodb); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/src/components/mongo/404.tsx\"],\"names\":[],\"mappings\":\"wDAKiB,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "src/components/mongo/404.tsx", + "name": "_404_component_div_q_e_click_aMLnLWtkRhc", + "entry": null, + "displayName": "404.tsx__404_component_div_q_e_click", + "hash": "aMLnLWtkRhc", + "canonicalFilename": "404.tsx__404_component_div_q_e_click_aMLnLWtkRhc", + "path": "src/components/mongo", + "extension": "tsx", + "parent": "_404_component_zRvoWc98eqo", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 109, + 135 + ] +} +*/ +============================= src/components/mongo/404.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q__404_component_zRvoWc98eqo = /*#__PURE__*/ qrl(()=>import("./404.tsx__404_component_zRvoWc98eqo"), "_404_component_zRvoWc98eqo"); +// +export default /*#__PURE__*/ componentQrl(q__404_component_zRvoWc98eqo); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/src/components/mongo/404.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,6BAAe,2CAKZ\"}") +============================= src/components/mongo/404.tsx__404_component_zRvoWc98eqo.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q__404_component_div_q_e_click_aMLnLWtkRhc = /*#__PURE__*/ qrl(()=>import("./404.tsx__404_component_div_q_e_click_aMLnLWtkRhc"), "_404_component_div_q_e_click_aMLnLWtkRhc"); +// +export const _404_component_zRvoWc98eqo = ()=>{ + return
+
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/src/components/mongo/404.tsx\"],\"names\":[],\"mappings\":\";;;;0CAG0B;IACzB,QACE,IAAI,uDAAsC;EAC3C,EAAE;AAEJ\"}") +/* +{ + "origin": "src/components/mongo/404.tsx", + "name": "_404_component_zRvoWc98eqo", + "entry": null, + "displayName": "404.tsx__404_component", + "hash": "zRvoWc98eqo", + "canonicalFilename": "404.tsx__404_component_zRvoWc98eqo", + "path": "src/components/mongo", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 74, + 152 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_children.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_children.snap new file mode 100644 index 00000000000..3181df260fd --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_children.snap @@ -0,0 +1,127 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2863 +expression: output +--- +==INPUT== + + +import { component$, useStore, mutable } from '@qwik.dev/core'; + +import {dep} from './file'; + +export const TextContent = component$((props) => { + return ( + <> +
data-nu: {props['data-nu']}
+
class: {props.class}
+ + ); +}); + +export const App = component$(() => { + const signal = useSignal(0); + const store = useStore({}); + return ( + <> +
text
+
{`text`}
+
{1}
+
{true}
+
{`text${12}`}
+
{typeof `text${12}` === 'string' ? 12 : 43}
+
{signal}
+
{signal.value}
+
{12 + signal.value}
+
{store.address.city.name}
+
{store.address.city.name ? 'true' : 'false'}
+
{dep}
+
{dep.thing}
+
{dep.thing + 'stuff'}
+
{globalThing}
+
{globalThing.thing}
+
{globalThing.thing + 'stuff'}
+
{signal.value()}
+
{signal.value + unknown()}
+
{mutable(signal)}
+
{signal.value + dep}
+ + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { useStore, mutable } from '@qwik.dev/core'; +import { dep } from './file'; +// +const _hf0 = (p0)=>12 + p0.value; +const _hf0_str = "12+p0.value"; +const _hf1 = (p0)=>p0.address.city.name; +const _hf1_str = "p0.address.city.name"; +const _hf2 = (p0)=>p0.address.city.name ? 'true' : 'false'; +const _hf2_str = 'p0.address.city.name?"true":"false"'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +const q_TextContent_component_puSwpKXO7Kg = /*#__PURE__*/ _noopQrl("TextContent_component_puSwpKXO7Kg"); +// +const TextContent_component_puSwpKXO7Kg = (props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "data-nu: ", + _wrapProp(props, "data-nu") + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "class: ", + _wrapProp(props, "class") + ], 1, null) + ], 1, "u6_0"); +}; +q_TextContent_component_puSwpKXO7Kg.s(TextContent_component_puSwpKXO7Kg); +export const TextContent = /*#__PURE__*/ componentQrl(q_TextContent_component_puSwpKXO7Kg); +const App_component_ckEPmXZlub0 = ()=>{ + const signal = useSignal(0); + const store = useStore({}); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", null, null, "text", 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, `text`, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, 1, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, true, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, `text${12}`, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, typeof `text${12}` === 'string' ? 12 : 43, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, signal, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, _wrapProp(signal), 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, _fnSignal(_hf0, [ + signal + ], _hf0_str), 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, _fnSignal(_hf1, [ + store + ], _hf1_str), 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, _fnSignal(_hf2, [ + store + ], _hf2_str), 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, dep, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, dep.thing, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, dep.thing + 'stuff', 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, globalThing, 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, globalThing.thing, 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, globalThing.thing + 'stuff', 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, signal.value(), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, signal.value + unknown(), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, mutable(signal), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, signal.value + dep, 1, null) + ], 1, "u6_1"); +}; +q_App_component_ckEPmXZlub0.s(App_component_ckEPmXZlub0); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AACA,SAAqB,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;AAE/D,SAAQ,GAAG,QAAO,SAAS;;mBAwBlB,KAAK,GAAO,KAAK;;mBACjB,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI;;mBACvB,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS;;;;;;0CAxBN,CAAC;IACtC,qBACC;sBACC,WAAC;YAAI;sBAAU;;sBACf,WAAC;YAAI;sBAAQ;;;AAGhB;;AAPA,OAAO,MAAM,4BAAc,kDAOxB;kCAE2B;IAC7B,MAAM,SAAS,UAAU;IACzB,MAAM,QAAQ,SAAS,CAAC;IACxB,qBACC;sBACC,WAAC,mBAAI;sBACL,WAAC,mBAAK,CAAC,IAAI,CAAC;sBACZ,WAAC,mBAAK;sBACN,WAAC,mBAAK;sBACN,WAAC,mBAAK,CAAC,IAAI,EAAE,IAAI;sBACjB,WAAC,mBAAK,OAAO,CAAC,IAAI,EAAE,IAAI,KAAK,WAAW,KAAK;sBAC7C,WAAC,mBAAK;sBACN,WAAC,6BAAK;sBACN,WAAC;;;sBACD,WAAC;;;sBACD,WAAC;;;sBACD,WAAC,mBAAK;sBACN,WAAC,mBAAK,IAAI,KAAK;sBACf,WAAC,mBAAK,IAAI,KAAK,GAAG;sBAClB,WAAC,mBAAK;sBACN,WAAC,mBAAK,YAAY,KAAK;sBACvB,WAAC,mBAAK,YAAY,KAAK,GAAG;sBAC1B,WAAC,mBAAK,OAAO,KAAK;sBAClB,WAAC,mBAAK,OAAO,KAAK,GAAG;sBACrB,WAAC,mBAAK,QAAQ;sBACd,WAAC,mBAAK,OAAO,KAAK,GAAG;;AAGxB;;AA5BA,OAAO,MAAM,oBAAM,0CA4BhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_cmp.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_cmp.snap new file mode 100644 index 00000000000..59bb0f4f02b --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_cmp.snap @@ -0,0 +1,111 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2996 +expression: output +--- +==INPUT== + + +import { component$, useStore, mutable } from '@qwik.dev/core'; + +import {dep} from './file'; +import {Cmp} from './cmp'; + +export const App = component$(() => { + const signal = useSignal(0); + const store = useStore({}); + return ( + + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { useStore, mutable } from '@qwik.dev/core'; +import { dep } from './file'; +import { Cmp } from './cmp'; +// +const _hf0 = (p0)=>12 + p0.value; +const _hf0_str = "12+p0.value"; +const _hf1 = (p0)=>p0.address.city.name; +const _hf1_str = "p0.address.city.name"; +const _hf2 = (p0)=>p0.address.city.name ? 'true' : 'false'; +const _hf2_str = 'p0.address.city.name?"true":"false"'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +// +const App_component_ckEPmXZlub0 = ()=>{ + const signal = useSignal(0); + const store = useStore({}); + return /*#__PURE__*/ _jsxSorted(Cmp, { + global: globalThing, + globalAccess: globalThing.thing, + globalComputed: globalThing.thing + 'stuff', + noInline: signal.value(), + noInline2: signal.value + unknown(), + noInline3: mutable(signal), + noInline4: signal.value + dep + }, { + staticText: "text", + staticText2: `text`, + staticNumber: 1, + staticBoolean: true, + staticExpr: `text${12}`, + staticExpr2: typeof `text${12}` === 'string' ? 12 : 43, + signal: signal, + signalValue: _wrapProp(signal), + signalComputedValue: _fnSignal(_hf0, [ + signal + ], _hf0_str), + store: _fnSignal(_hf1, [ + store + ], _hf1_str), + storeComputed: _fnSignal(_hf2, [ + store + ], _hf2_str), + dep: dep, + depAccess: dep.thing, + depComputed: dep.thing + 'stuff' + }, null, 3, "u6_0"); +}; +q_App_component_ckEPmXZlub0.s(App_component_ckEPmXZlub0); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAAqB,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;AAE/D,SAAQ,GAAG,QAAO,SAAS;AAC3B,SAAQ,GAAG,QAAO,QAAQ;;mBAgBF,KAAK,GAAO,KAAK;;mBAE/B,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI;;mBACf,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS;;;;;kCAjBvB;IAC7B,MAAM,SAAS,UAAU;IACzB,MAAM,QAAQ,SAAS,CAAC;IACxB,qBACC,WAAC;QAmBA,QAAQ;QACR,cAAc,YAAY,KAAK;QAC/B,gBAAgB,YAAY,KAAK,GAAG;QAGpC,UAAU,OAAO,KAAK;QACtB,WAAW,OAAO,KAAK,GAAG;QAC1B,WAAW,QAAQ;QACnB,WAAW,OAAO,KAAK,GAAG;;QA1B1B,YAAW;QACX,aAAa,CAAC,IAAI,CAAC;QACnB,cAAc;QACd,eAAe;QACf,YAAY,CAAC,IAAI,EAAE,IAAI;QACvB,aAAa,OAAO,CAAC,IAAI,EAAE,IAAI,KAAK,WAAW,KAAK;QAEpD,QAAQ;QACR,WAAW,YAAE;QACb,mBAAmB;;;QAEnB,KAAK;;;QACL,aAAa;;;QAEb,KAAK;QACL,WAAW,IAAI,KAAK;QACpB,aAAa,IAAI,KAAK,GAAG;;AAa5B;;AAlCA,OAAO,MAAM,oBAAM,0CAkChB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_complext_children.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_complext_children.snap new file mode 100644 index 00000000000..48761e3bd93 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_complext_children.snap @@ -0,0 +1,57 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2964 +expression: output +--- +==INPUT== + + +import { component$, useStore, mutable } from '@qwik.dev/core'; + +import {dep} from './file'; + +export const App = component$(() => { + const signal = useSignal(0); + const store = useStore({}); + return ( + <> +
    + {Object.entries(store).map(([key, value]) => ( +
  • + {key} - {value} +
  • + ))} +
+ + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { useStore } from '@qwik.dev/core'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +// +const App_component_ckEPmXZlub0 = ()=>{ + useSignal(0); + const store = useStore({}); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, /*#__PURE__*/ _jsxSorted("ul", null, { + id: "issue-2800-result" + }, Object.entries(store).map(([key, value])=>/*#__PURE__*/ _jsxSorted("li", null, null, [ + key, + " - ", + value + ], 1, "u6_0")), 1, null), 1, "u6_1"); +}; +q_App_component_ckEPmXZlub0.s(App_component_ckEPmXZlub0); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;AACA,SAAqB,QAAQ,QAAiB,iBAAiB;;;;kCAIjC;IACd,UAAU;IACzB,MAAM,QAAQ,SAAS,CAAC;IACxB,qBACC,gDACC,WAAC;QAAG,IAAG;OACL,OAAO,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,iBACxC,WAAC;YACC;YAAI;YAAI;;AAMd;;AAdA,OAAO,MAAM,oBAAM,0CAchB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_div.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_div.snap new file mode 100644 index 00000000000..3ed3df57438 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_div.snap @@ -0,0 +1,131 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2775 +expression: output +--- +==INPUT== + + +import { component$, useStore, mutable } from '@qwik.dev/core'; + +import {dep} from './file'; +import styles from './styles.module.css'; + +export const App = component$((props) => { + const signal = useSignal(0); + const store = useStore({}); + const count = props.counter.count; + + return ( +
+ + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { useStore, mutable } from '@qwik.dev/core'; +import { dep } from './file'; +import styles from './styles.module.css'; +// +const _hf0 = (p0)=>12 + p0.value; +const _hf0_str = "12+p0.value"; +const _hf1 = (p0)=>p0.address.city.name; +const _hf1_str = "p0.address.city.name"; +const _hf2 = (p0)=>p0.address.city.name ? 'true' : 'false'; +const _hf2_str = 'p0.address.city.name?"true":"false"'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +// +const App_component_ckEPmXZlub0 = (props)=>{ + const signal = useSignal(0); + const store = useStore({}); + const count = props.counter.count; + return /*#__PURE__*/ _jsxSorted("div", { + class: { + even: count % 2 === 0, + odd: count % 2 === 1, + stable0: true, + hidden: false + }, + global: globalThing, + globalAccess: globalThing.thing, + globalComputed: globalThing.thing + 'stuff', + noInline: signal.value(), + noInline2: signal.value + unknown(), + noInline3: mutable(signal), + noInline4: signal.value + dep, + staticDocument: window.document + }, { + staticClass: styles.foo, + staticText: "text", + staticText2: `text`, + staticNumber: 1, + staticBoolean: true, + staticExpr: `text${12}`, + staticExpr2: typeof `text${12}` === 'string' ? 12 : 43, + signal: signal, + signalValue: _wrapProp(signal), + signalComputedValue: _fnSignal(_hf0, [ + signal + ], _hf0_str), + store: _fnSignal(_hf1, [ + store + ], _hf1_str), + storeComputed: _fnSignal(_hf2, [ + store + ], _hf2_str), + dep: dep, + depAccess: dep.thing, + depComputed: dep.thing + 'stuff' + }, null, 3, "u6_0"); +}; +q_App_component_ckEPmXZlub0.s(App_component_ckEPmXZlub0); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAAqB,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;AAE/D,SAAQ,GAAG,QAAO,SAAS;AAC3B,OAAO,YAAY,sBAAsB;;mBA0BjB,KAAK,GAAO,KAAK;;mBAE/B,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI;;mBACf,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS;;;;;kCA3BvB,CAAC;IAC9B,MAAM,SAAS,UAAU;IACzB,MAAM,QAAQ,SAAS,CAAC;IACxB,MAAM,QAAQ,MAAM,OAAO,CAAC,KAAK;IAEjC,qBACC,WAAC;QACA,OAAO;YACN,MAAM,QAAQ,MAAM;YACpB,KAAK,QAAQ,MAAM;YACnB,SAAS;YACT,QAAQ;QACT;QAqBA,QAAQ;QACR,cAAc,YAAY,KAAK;QAC/B,gBAAgB,YAAY,KAAK,GAAG;QAGpC,UAAU,OAAO,KAAK;QACtB,WAAW,OAAO,KAAK,GAAG;QAC1B,WAAW,QAAQ;QACnB,WAAW,OAAO,KAAK,GAAG;QA3B1B,gBAAgB,OAAO,QAAQ;;QAD/B,aAAa,OAAO,GAAG;QAEvB,YAAW;QACX,aAAa,CAAC,IAAI,CAAC;QACnB,cAAc;QACd,eAAe;QACf,YAAY,CAAC,IAAI,EAAE,IAAI;QACvB,aAAa,OAAO,CAAC,IAAI,EAAE,IAAI,KAAK,WAAW,KAAK;QAEpD,QAAQ;QACR,WAAW,YAAE;QACb,mBAAmB;;;QAEnB,KAAK;;;QACL,aAAa;;;QAEb,KAAK;QACL,WAAW,IAAI,KAAK;QACpB,aAAa,IAAI,KAAK,GAAG;;AAc5B;;AA7CA,OAAO,MAAM,oBAAM,0CA6ChB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_multiple_children.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_multiple_children.snap new file mode 100644 index 00000000000..59de434fd3b --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_derived_signals_multiple_children.snap @@ -0,0 +1,163 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2918 +expression: output +--- +==INPUT== + + +import { component$, useStore, mutable } from '@qwik.dev/core'; + +import {dep} from './file'; + +export const App = component$(() => { + const signal = useSignal(0); + const store = useStore({}); + return ( + <> +
First text
+
First {`text`}
+
First {1}
+
First {true}
+
First {`text${12}`}
+
First {typeof `text${12}` === 'string' ? 12 : 43}
+
First {signal}
+
First {signal.value}
+
First {12 + signal.value}
+
First {store.address.city.name}
+
First {store.address.city.name ? 'true' : 'false'}
+
First {dep}
+
First {dep.thing}
+
First {dep.thing + 'stuff'}
+
First {globalThing}
+
First {globalThing.thing}
+
First {globalThing.thing + 'stuff'}
+
First {signal.value()}
+
First {signal.value + unknown()}
+
First {mutable(signal)}
+
First {signal.value + dep}
+ + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { useStore, mutable } from '@qwik.dev/core'; +import { dep } from './file'; +// +const _hf0 = (p0)=>12 + p0.value; +const _hf0_str = "12+p0.value"; +const _hf1 = (p0)=>p0.address.city.name; +const _hf1_str = "p0.address.city.name"; +const _hf2 = (p0)=>p0.address.city.name ? 'true' : 'false'; +const _hf2_str = 'p0.address.city.name?"true":"false"'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +// +const App_component_ckEPmXZlub0 = ()=>{ + const signal = useSignal(0); + const store = useStore({}); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", null, null, "First text", 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + `text` + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + 1 + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + true + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + `text${12}` + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + typeof `text${12}` === 'string' ? 12 : 43 + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + signal + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + _wrapProp(signal) + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + _fnSignal(_hf0, [ + signal + ], _hf0_str) + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + _fnSignal(_hf1, [ + store + ], _hf1_str) + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + _fnSignal(_hf2, [ + store + ], _hf2_str) + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + dep + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + dep.thing + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + dep.thing + 'stuff' + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + globalThing + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + globalThing.thing + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + globalThing.thing + 'stuff' + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + signal.value() + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + signal.value + unknown() + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + mutable(signal) + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "First ", + signal.value + dep + ], 1, null) + ], 1, "u6_0"); +}; +q_App_component_ckEPmXZlub0.s(App_component_ckEPmXZlub0); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AACA,SAAqB,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;AAE/D,SAAQ,GAAG,QAAO,SAAS;;mBAeZ,KAAK,GAAO,KAAK;;mBACjB,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI;;mBACvB,GAAM,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS;;;;;kCAfpB;IAC7B,MAAM,SAAS,UAAU;IACzB,MAAM,QAAQ,SAAS,CAAC;IACxB,qBACC;sBACC,WAAC,mBAAI;sBACL,WAAC;YAAI;YAAO,CAAC,IAAI,CAAC;;sBAClB,WAAC;YAAI;YAAO;;sBACZ,WAAC;YAAI;YAAO;;sBACZ,WAAC;YAAI;YAAO,CAAC,IAAI,EAAE,IAAI;;sBACvB,WAAC;YAAI;YAAO,OAAO,CAAC,IAAI,EAAE,IAAI,KAAK,WAAW,KAAK;;sBACnD,WAAC;YAAI;YAAO;;sBACZ,WAAC;YAAI;sBAAO;;sBACZ,WAAC;YAAI;;;;;sBACL,WAAC;YAAI;;;;;sBACL,WAAC;YAAI;;;;;sBACL,WAAC;YAAI;YAAO;;sBACZ,WAAC;YAAI;YAAO,IAAI,KAAK;;sBACrB,WAAC;YAAI;YAAO,IAAI,KAAK,GAAG;;sBACxB,WAAC;YAAI;YAAO;;sBACZ,WAAC;YAAI;YAAO,YAAY,KAAK;;sBAC7B,WAAC;YAAI;YAAO,YAAY,KAAK,GAAG;;sBAChC,WAAC;YAAI;YAAO,OAAO,KAAK;;sBACxB,WAAC;YAAI;YAAO,OAAO,KAAK,GAAG;;sBAC3B,WAAC;YAAI;YAAO,QAAQ;;sBACpB,WAAC;YAAI;YAAO,OAAO,KAAK,GAAG;;;AAG9B;;AA5BA,OAAO,MAAM,oBAAM,0CA4BhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dev_mode.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dev_mode.snap new file mode 100644 index 00000000000..948d4056973 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dev_mode.snap @@ -0,0 +1,112 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2300 +expression: output +--- +==INPUT== + + +import { component$, useStore } from '@qwik.dev/core'; + +export const App = component$(() => { + return ( + +

console.log('warn')}>Hello Qwik

+
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrlDEV } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrlDEV(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0", { + file: "/user/qwik/src/test.tsx", + lo: 88, + hi: 200, + displayName: "test.tsx_App_component" +}); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;AAGA,OAAO,MAAM,oBAAM,0CAMhB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +import { qrlDEV } from "@qwik.dev/core"; +// +const q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 = /*#__PURE__*/ qrlDEV(()=>import("./test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4"), "App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", { + file: "/user/qwik/src/test.tsx", + lo: 144, + hi: 169, + displayName: "test.tsx_App_component_Cmp_p_q_e_click" +}); +// +export const App_component_ckEPmXZlub0 = ()=>{ + return /*#__PURE__*/ _jsxSorted(Cmp, null, null, /*#__PURE__*/ _jsxSorted("p", null, { + class: "stuff", + "q-e:click": q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 + }, "Hello Qwik", 3, null, { + fileName: "test.tsx", + lineNumber: 7, + columnNumber: 4 + }), 3, "u6_0", { + fileName: "test.tsx", + lineNumber: 6, + columnNumber: 3 + }); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;yCAG8B;IAC7B,qBACC,WAAC,+BACA,WAAC;QAAE,OAAM;QAAQ,WAAQ;OAA6B;;;;;;;;;AAGzD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 88, + 200 + ] +} +*/ +============================= test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4.js (ENTRY POINT)== + +export const App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 = ()=>console.log('warn'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"yDAM8B,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", + "entry": null, + "displayName": "test.tsx_App_component_Cmp_p_q_e_click", + "hash": "Yl4ybrJWrt4", + "canonicalFilename": "test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 144, + 169 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dev_mode_inlined.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dev_mode_inlined.snap new file mode 100644 index 00000000000..9eb256ba6ee --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_dev_mode_inlined.snap @@ -0,0 +1,59 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2322 +expression: output +--- +==INPUT== + + +import { component$, useStore } from '@qwik.dev/core'; + +export const App = component$(() => { + return ( + +

console.log('warn')}>Hello Qwik

+
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _noopQrlDEV } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 = /*#__PURE__*/ _noopQrlDEV("App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", { + file: "/user/qwik/src/test.tsx", + lo: 144, + hi: 169, + displayName: "test.tsx_App_component_Cmp_p_q_e_click" +}); +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrlDEV("App_component_ckEPmXZlub0", { + file: "/user/qwik/src/test.tsx", + lo: 88, + hi: 200, + displayName: "test.tsx_App_component" +}); +// +q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4.s(()=>console.log('warn')); +q_App_component_ckEPmXZlub0.s(()=>{ + return /*#__PURE__*/ _jsxSorted(Cmp, null, null, /*#__PURE__*/ _jsxSorted("p", null, { + class: "stuff", + "q-e:click": q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 + }, "Hello Qwik", 3, null, { + fileName: "test.tsx", + lineNumber: 7, + columnNumber: 4 + }), 3, "u6_0", { + fileName: "test.tsx", + lineNumber: 6, + columnNumber: 3 + }); +}); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;;;;;8CAM8B,IAAM,QAAQ,GAAG,CAAC;8BAHlB;IAC7B,qBACC,WAAC,+BACA,WAAC;QAAE,OAAM;QAAQ,WAAQ;OAA6B;;;;;;;;;AAGzD;AANA,OAAO,MAAM,oBAAM,0CAMhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_drop_side_effects.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_drop_side_effects.snap new file mode 100644 index 00000000000..16cec5da2a4 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_drop_side_effects.snap @@ -0,0 +1,171 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 822 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; +import { server$ } from '@qwik.dev/router'; +import { clientSupabase } from 'supabase'; +import { Client } from 'openai'; +import { secret } from './secret'; +import { sideEffect } from './secret'; + +const supabase = clientSupabase(); +const dfd = new Client(secret); + +(function() { + console.log('run'); + })(); + (() => { + console.log('run'); + })(); + +sideEffect(); + +export const api = server$(() => { + supabase.from('ffg').do(dfd); +}); + +export default component$(() => { + return ( + + ) + }); + +============================= test.tsx_api_server_JonPp043gH0.js (ENTRY POINT)== + +export const api_server_JonPp043gH0 = null; + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +/* +{ + "origin": "test.tsx", + "name": "api_server_JonPp043gH0", + "entry": null, + "displayName": "test.tsx_api_server", + "hash": "JonPp043gH0", + "canonicalFilename": "test.tsx_api_server_JonPp043gH0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "server$", + "captures": false, + "loc": [ + 0, + 0 + ] +} +*/ +============================= test.js == + +import { serverQrl } from "@qwik.dev/router"; +import { _noopQrlDEV } from "@qwik.dev/core"; +import { componentQrl } from "@qwik.dev/core"; +import { qrlDEV } from "@qwik.dev/core"; +import { sideEffect } from './secret'; +// +const q_qrl_4294901760 = /*#__PURE__*/ _noopQrlDEV("api_server_JonPp043gH0", { + file: "/user/qwik/src/test.tsx", + lo: 0, + hi: 0, + displayName: "test.tsx_api_server" +}); +const q_test_component_LUXeXe0DQrg = /*#__PURE__*/ qrlDEV(()=>import("./test.tsx_test_component_LUXeXe0DQrg"), "test_component_LUXeXe0DQrg", { + file: "/user/qwik/src/test.tsx", + lo: 503, + hi: 575, + displayName: "test.tsx_test_component" +}); +// +(function() { + console.log('run'); +})(); +(()=>{ + console.log('run'); +})(); +sideEffect(); +export const api = serverQrl(q_qrl_4294901760); +export default /*#__PURE__*/ componentQrl(q_test_component_LUXeXe0DQrg); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;AAMA,SAAS,UAAU,QAAQ,WAAW;;;;;;;;;;;;;;;AAKtC,CAAC;IACA,QAAQ,GAAG,CAAC;AACZ,CAAC;AACD,CAAC;IACD,QAAQ,GAAG,CAAC;AACZ,CAAC;AAEF;AAEA,OAAO,MAAM,MAAM,4BAEhB;AAEH,6BAAe,2CAIX\"}") +============================= test.tsx_test_component_button_q_e_click_qwSL5gM03T4.js (ENTRY POINT)== + +import { api } from "./test"; +// +export const test_component_button_q_e_click_qwSL5gM03T4 = ()=>await api(); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;2DA0BoB,IAAM,MAAM\"}") +/* +{ + "origin": "test.tsx", + "name": "test_component_button_q_e_click_qwSL5gM03T4", + "entry": null, + "displayName": "test.tsx_test_component_button_q_e_click", + "hash": "qwSL5gM03T4", + "canonicalFilename": "test.tsx_test_component_button_q_e_click_qwSL5gM03T4", + "path": "", + "extension": "js", + "parent": "test_component_LUXeXe0DQrg", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 541, + 558 + ] +} +*/ +============================= test.tsx_test_component_LUXeXe0DQrg.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +import { qrlDEV } from "@qwik.dev/core"; +// +const q_test_component_button_q_e_click_qwSL5gM03T4 = /*#__PURE__*/ qrlDEV(()=>import("./test.tsx_test_component_button_q_e_click_qwSL5gM03T4"), "test_component_button_q_e_click_qwSL5gM03T4", { + file: "/user/qwik/src/test.tsx", + lo: 541, + hi: 558, + displayName: "test.tsx_test_component_button_q_e_click" +}); +// +export const test_component_LUXeXe0DQrg = ()=>{ + return /*#__PURE__*/ _jsxSorted("button", null, { + "q-e:click": q_test_component_button_q_e_click_qwSL5gM03T4 + }, null, 3, "u6_0", { + fileName: "test.tsx", + lineNumber: 27, + columnNumber: 3 + }); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;0CAwB0B;IACzB,qBACC,WAAC;QAAO,WAAQ;;;;;;AAEjB\"}") +/* +{ + "origin": "test.tsx", + "name": "test_component_LUXeXe0DQrg", + "entry": null, + "displayName": "test.tsx_test_component", + "hash": "LUXeXe0DQrg", + "canonicalFilename": "test.tsx_test_component_LUXeXe0DQrg", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 503, + 575 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_explicit_ext_no_transpile.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_explicit_ext_no_transpile.snap new file mode 100644 index 00000000000..83d5d89b844 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_explicit_ext_no_transpile.snap @@ -0,0 +1,121 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1414 +expression: output +--- +==INPUT== + + +import { component$, $, useStyles$ } from '@qwik.dev/core'; + +export const App = component$((props) => { + useStyles$('hola'); + return $(() => ( +
+ )); +}); + +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0.tsx"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CAKhB\"}") +============================= test.tsx_App_component_useStyles_t35nSa5UV7U.tsx == + +export const App_component_useStyles_t35nSa5UV7U = 'hola'; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"mDAIY\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_useStyles_t35nSa5UV7U", + "entry": "entry_segments", + "displayName": "test.tsx_App_component_useStyles", + "hash": "t35nSa5UV7U", + "canonicalFilename": "test.tsx_App_component_useStyles_t35nSa5UV7U", + "path": "", + "extension": "tsx", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "useStyles$", + "captures": false, + "loc": [ + 118, + 124 + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.tsx == + +import { qrl } from "@qwik.dev/core"; +import { useStylesQrl } from "@qwik.dev/core"; +// +const q_App_component_1_w0t0o3QMovU = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_1_w0t0o3QMovU.tsx"), "App_component_1_w0t0o3QMovU"); +const q_App_component_useStyles_t35nSa5UV7U = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_useStyles_t35nSa5UV7U.tsx"), "App_component_useStyles_t35nSa5UV7U"); +// +export const App_component_ckEPmXZlub0 = (props)=>{ + useStylesQrl(q_App_component_useStyles_t35nSa5UV7U); + return q_App_component_1_w0t0o3QMovU; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;yCAG8B,CAAC;IAC9B;IACA;AAGD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": "entry_segments", + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 93, + 165 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_1_w0t0o3QMovU.tsx == + +export const App_component_1_w0t0o3QMovU = ()=>
; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"2CAKU,KACP,MAAM\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_1_w0t0o3QMovU", + "entry": "entry_segments", + "displayName": "test.tsx_App_component_1", + "hash": "w0t0o3QMovU", + "canonicalFilename": "test.tsx_App_component_1_w0t0o3QMovU", + "path": "", + "extension": "tsx", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 137, + 161 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_explicit_ext_transpile.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_explicit_ext_transpile.snap new file mode 100644 index 00000000000..6c6e709eb4e --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_explicit_ext_transpile.snap @@ -0,0 +1,123 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1393 +expression: output +--- +==INPUT== + + +import { component$, $, useStyles$ } from '@qwik.dev/core'; + +export const App = component$((props) => { + useStyles$('hola'); + return $(() => ( +
+ )); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0.js"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CAKhB\"}") +============================= test.tsx_App_component_useStyles_t35nSa5UV7U.js (ENTRY POINT)== + +export const App_component_useStyles_t35nSa5UV7U = 'hola'; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"mDAIY\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_useStyles_t35nSa5UV7U", + "entry": null, + "displayName": "test.tsx_App_component_useStyles", + "hash": "t35nSa5UV7U", + "canonicalFilename": "test.tsx_App_component_useStyles_t35nSa5UV7U", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "useStyles$", + "captures": false, + "loc": [ + 118, + 124 + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +import { useStylesQrl } from "@qwik.dev/core"; +// +const q_App_component_1_w0t0o3QMovU = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_1_w0t0o3QMovU.js"), "App_component_1_w0t0o3QMovU"); +const q_App_component_useStyles_t35nSa5UV7U = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_useStyles_t35nSa5UV7U.js"), "App_component_useStyles_t35nSa5UV7U"); +// +export const App_component_ckEPmXZlub0 = (props)=>{ + useStylesQrl(q_App_component_useStyles_t35nSa5UV7U); + return q_App_component_1_w0t0o3QMovU; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;yCAG8B,CAAC;IAC9B;IACA;AAGD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 93, + 165 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_1_w0t0o3QMovU.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +// +export const App_component_1_w0t0o3QMovU = ()=>/*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_0"); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;2CAKU,kBACR,WAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_1_w0t0o3QMovU", + "entry": null, + "displayName": "test.tsx_App_component_1", + "hash": "w0t0o3QMovU", + "canonicalFilename": "test.tsx_App_component_1_w0t0o3QMovU", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 137, + 161 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_export_issue.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_export_issue.snap new file mode 100644 index 00000000000..a1e879789f5 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_export_issue.snap @@ -0,0 +1,112 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2410 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +const App = component$(() => { + return ( +
hola
+ ); +}); + + +export const Root = component$((props: Stuff) => { + return ( + + ); +}); + +const Other = 12; +export { Other as App }; + +export default App; + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +const q_Root_component_royhjYaCbYE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Root_component_royhjYaCbYE"), "Root_component_royhjYaCbYE"); +// +const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); +export const Root = /*#__PURE__*/ componentQrl(q_Root_component_royhjYaCbYE); +const Other = 12; +export { Other as App }; +export default App; +export { App as _auto_App }; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AAGA,MAAM,oBAAM;AAOZ,OAAO,MAAM,qBAAO,2CAIjB;AAEH,MAAM,QAAQ;AACd,SAAS,SAAS,GAAG,GAAG;AAExB,eAAe,IAAI\"}") +============================= test.tsx_Root_component_royhjYaCbYE.js (ENTRY POINT)== + +import { _auto_App as App } from "./test"; +import { _jsxSorted } from "@qwik.dev/core"; +// +export const Root_component_royhjYaCbYE = (props)=>{ + return /*#__PURE__*/ _jsxSorted(App, null, null, null, 3, "u6_1"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;0CAU+B,CAAC;IAC/B,qBACC,WAAC;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "Root_component_royhjYaCbYE", + "entry": null, + "displayName": "test.tsx_Root_component", + "hash": "royhjYaCbYE", + "canonicalFilename": "test.tsx_Root_component_royhjYaCbYE", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 148, + 192 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +// +export const App_component_ckEPmXZlub0 = ()=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, "hola", 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;yCAGuB;IACtB,qBACC,WAAC,mBAAI;AAEP\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 71, + 112 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_exports.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_exports.snap new file mode 100644 index 00000000000..17688517487 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_exports.snap @@ -0,0 +1,129 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1096 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +export const [a, {b, v1: [c], d=v2, ...e}, f=v3, ...g] = obj; + +const exp1 = 1; +const internal = 2; +export {exp1, internal as expr2}; + +export function foo() { } +export class bar {} + +export default function DefaultFn() {} + +export const Header = component$(() => { + return $(() => ( +
+
{a}{b}{c}{d}{e}{f}{exp1}{internal}{foo}{bar}{DefaultFn}
+
{v1}{v2}{v3}{obj}
+
+ )) +}); + +export const Footer = component$(); + +============================= project/test.tsx_Header_component_UVBJuFYfvDo.jsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_1_uWM1kg0IGO0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_1_uWM1kg0IGO0"), "Header_component_1_uWM1kg0IGO0"); +// +export const Header_component_UVBJuFYfvDo = ()=>{ + return q_Header_component_1_uWM1kg0IGO0; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\";;;;4CAciC;IAChC;AAMD\"}") +/* +{ + "origin": "project/test.tsx", + "name": "Header_component_UVBJuFYfvDo", + "entry": null, + "displayName": "test.tsx_Header_component", + "hash": "UVBJuFYfvDo", + "canonicalFilename": "test.tsx_Header_component_UVBJuFYfvDo", + "path": "project", + "extension": "jsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 305, + 461 + ] +} +*/ +============================= project/test.jsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_UVBJuFYfvDo = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_UVBJuFYfvDo"), "Header_component_UVBJuFYfvDo"); +// +export const [a, { b, v1: [c], d = v2, ...e }, f = v3, ...g] = obj; +const exp1 = 1; +const internal = 2; +export { exp1, internal as expr2 }; +export function foo() {} +export class bar { +} +export default function DefaultFn() {} +export const Header = /*#__PURE__*/ componentQrl(q_Header_component_UVBJuFYfvDo); +export const Footer = /*#__PURE__*/ componentQrl(); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,CAAC,GAAG,EAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,IAAE,EAAE,EAAE,GAAG,GAAE,EAAE,IAAE,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;AAE7D,MAAM,OAAO;AACb,MAAM,WAAW;AACjB,SAAQ,IAAI,EAAE,YAAY,KAAK,GAAE;AAEjC,OAAO,SAAS,OAAQ;AACxB,OAAO,MAAM;AAAK;AAElB,eAAe,SAAS,aAAa;AAErC,OAAO,MAAM,uBAAS,6CAOnB;AAEH,OAAO,MAAM,uBAAS,eAAa\"}") +============================= project/test.tsx_Header_component_1_uWM1kg0IGO0.jsx (ENTRY POINT)== + +import { default as DefaultFn } from "./test"; +import { Footer } from "./test"; +import { a } from "./test"; +import { b } from "./test"; +import { bar } from "./test"; +import { c } from "./test"; +import { d } from "./test"; +import { e } from "./test"; +import { exp1 } from "./test"; +import { f } from "./test"; +import { foo } from "./test"; +import { expr2 as internal } from "./test"; +// +export const Header_component_1_uWM1kg0IGO0 = ()=>
+
{a}{b}{c}{d}{e}{f}{exp1}{internal}{foo}{bar}{DefaultFn}
+
{v1}{v2}{v3}{obj}
+
; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;8CAeU,KACP,OAAO;GACP,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,UAAU,KAAK,KAAK,YAAY,IAAI;GAClE,CAAC,KAAK,IAAI,IAAI,IAAI,MAAM,IAAI;EAC7B,EAAE\"}") +/* +{ + "origin": "project/test.tsx", + "name": "Header_component_1_uWM1kg0IGO0", + "entry": null, + "displayName": "test.tsx_Header_component_1", + "hash": "uWM1kg0IGO0", + "canonicalFilename": "test.tsx_Header_component_1_uWM1kg0IGO0", + "path": "project", + "extension": "jsx", + "parent": "Header_component_UVBJuFYfvDo", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 323, + 458 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_fix_dynamic_import.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_fix_dynamic_import.snap new file mode 100644 index 00000000000..da6d0d68cf9 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_fix_dynamic_import.snap @@ -0,0 +1,74 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1281 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; +import thing from "../state"; + +export function foo() { + return import("../foo/state2") +} + +export const Header = component$(() => { + return ( +
+ {import("../folder/state3")} + {thing} +
+ ); +}); + +============================= project/folder/test.tsx_Header_component_RGgm7Ks9QWI.tsx == + +import thing from "../state"; +// +export const Header_component_RGgm7Ks9QWI = ()=>{ + return
+ {import("../folder/state3")} + {thing} +
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/folder/test.tsx\"],\"names\":[],\"mappings\":\";;4CAQiC;IAChC,QACE,IAAI;GACJ,CAAC,MAAM,CAAC,oBAAoB;GAC5B,CAAC,MAAM;EACR,EAAE;AAEJ\"}") +/* +{ + "origin": "project/folder/test.tsx", + "name": "Header_component_RGgm7Ks9QWI", + "entry": "entry_segments", + "displayName": "test.tsx_Header_component", + "hash": "RGgm7Ks9QWI", + "canonicalFilename": "test.tsx_Header_component_RGgm7Ks9QWI", + "path": "project/folder", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 173, + 256 + ] +} +*/ +============================= project/folder/test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Header_component_RGgm7Ks9QWI = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_RGgm7Ks9QWI"), "Header_component_RGgm7Ks9QWI"); +// +export function foo() { + return import("../foo/state2"); +} +export const Header = /*#__PURE__*/ componentQrl(q_Header_component_RGgm7Ks9QWI); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/folder/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAIA,OAAO,SAAS;IACf,OAAO,MAAM,CAAC;AACf;AAEA,OAAO,MAAM,uBAAS,6CAOnB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component.snap new file mode 100644 index 00000000000..c2efc6c0db1 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component.snap @@ -0,0 +1,65 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 329 +expression: output +--- +==INPUT== + + +import { $, component$, useStore } from '@qwik.dev/core'; +const Header = component$(() => { + const thing = useStore(); + const {foo, bar} = foo(); + + return ( +
{thing}
+ ); +}); + +============================= test.tsx_Header_component_J4uyIhaBNR4.tsx (ENTRY POINT)== + +import { useStore } from "@qwik.dev/core"; +// +export const Header_component_J4uyIhaBNR4 = ()=>{ + const thing = useStore(); + const { foo, bar } = foo(); + return
{thing}
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;4CAE0B;IACzB,MAAM,QAAQ;IACd,MAAM,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG;IAEnB,QACE,KAAK,QAAQ;AAEhB\"}") +/* +{ + "origin": "test.tsx", + "name": "Header_component_J4uyIhaBNR4", + "entry": null, + "displayName": "test.tsx_Header_component", + "hash": "J4uyIhaBNR4", + "canonicalFilename": "test.tsx_Header_component_J4uyIhaBNR4", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 86, + 185 + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { $, component$, useStore } from '@qwik.dev/core'; +// +const q_Header_component_J4uyIhaBNR4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Header_component_J4uyIhaBNR4"), "Header_component_J4uyIhaBNR4"); +// +const Header = /*#__PURE__*/ componentQrl(q_Header_component_J4uyIhaBNR4); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;AACA,SAAS,CAAC,EAAE,UAAU,EAAE,QAAQ,QAAQ,iBAAiB;;;;AACzD,MAAM,uBAAS\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component_2.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component_2.snap new file mode 100644 index 00000000000..95946828109 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component_2.snap @@ -0,0 +1,194 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 349 +expression: output +--- +==INPUT== + + +import { $, component$, useStore } from '@qwik.dev/core'; +export const useCounter = () => { + return useStore({count: 0}); +} + +export const STEP = 1; + +export const App = component$((props) => { + const state = useCounter(); + const thing = useStore({thing: 0}); + const STEP_2 = 2; + + const count2 = state.count * 2; + return ( +
state.count+=count2 }> + {state.count} + {buttons.map(btn => ( + + ))} + +
+ + ); +}) + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useStore } from '@qwik.dev/core'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const useCounter = ()=>{ + return useStore({ + count: 0 + }); +}; +export const STEP = 1; +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;AACA,SAAwB,QAAQ,QAAQ,iBAAiB;;;;AACzD,OAAO,MAAM,aAAa;IACzB,OAAO,SAAS;QAAC,OAAO;IAAC;AAC1B,EAAC;AAED,OAAO,MAAM,OAAO,EAAE;AAEtB,OAAO,MAAM,oBAAM,0CAoBjB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { useCounter } from "./test"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +// +const q_App_component_div_button_q_e_click_UB6Fs5a3bd8 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_div_button_q_e_click_UB6Fs5a3bd8"), "App_component_div_button_q_e_click_UB6Fs5a3bd8"); +const q_App_component_div_q_e_click_mi4E1piTWe8 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_div_q_e_click_mi4E1piTWe8"), "App_component_div_q_e_click_mi4E1piTWe8"); +// +export const App_component_ckEPmXZlub0 = (props)=>{ + const state = useCounter(); + const thing = useStore({ + thing: 0 + }); + const count2 = state.count * 2; + const App_component_div_button_q_e_click_UB6Fs5a3bd8 = q_App_component_div_button_q_e_click_UB6Fs5a3bd8.w([ + props, + state, + thing + ]); + return /*#__PURE__*/ _jsxSorted("div", { + "q-e:click": q_App_component_div_q_e_click_mi4E1piTWe8, + "q:ps": [ + count2, + state + ] + }, null, [ + /*#__PURE__*/ _jsxSorted("span", null, null, _wrapProp(state, "count"), 3, null), + buttons.map((btn)=>/*#__PURE__*/ _jsxSorted("button", { + "q-e:click": App_component_div_button_q_e_click_UB6Fs5a3bd8, + "q:p": btn + }, null, _wrapProp(btn, "name"), 4, "u6_0")) + ], 4, "u6_1"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;yCAQ8B,CAAC;IAC9B,MAAM,QAAQ;IACd,MAAM,QAAQ,SAAS;QAAC,OAAO;IAAC;IAGhC,MAAM,SAAS,MAAM,KAAK,GAAG;;;;;;IAC7B,qBACC,WAAC;QAAI,WAAQ;;;;;;sBACZ,WAAC,8BAAM;QACN,QAAQ,GAAG,CAAC,CAAA,oBACZ,WAAC;gBACA,WAAQ;uBAFG;+BAIV;;AAON\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 181, + 580 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_div_button_q_e_click_UB6Fs5a3bd8.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { STEP } from "./test"; +// +export const App_component_div_button_q_e_click_UB6Fs5a3bd8 = (_, _1, btn)=>{ + const props = _captures[0], state = _captures[1], thing = _captures[2]; + return state.count += btn.offset + thing + STEP + 2 + props.step; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;8DAmBe,QAFC;;WAEK,MAAM,KAAK,IAAI,IAAI,MAAM,GAAG,QAAQ,OARzC,IAQyD,MAAM,IAAI\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_div_button_q_e_click_UB6Fs5a3bd8", + "entry": null, + "displayName": "test.tsx_App_component_div_button_q_e_click", + "hash": "UB6Fs5a3bd8", + "canonicalFilename": "test.tsx_App_component_div_button_q_e_click_UB6Fs5a3bd8", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 451, + 519 + ], + "paramNames": [ + "_", + "_1", + "btn" + ], + "captureNames": [ + "props", + "state", + "thing" + ] +} +*/ +============================= test.tsx_App_component_div_q_e_click_mi4E1piTWe8.js (ENTRY POINT)== + +export const App_component_div_q_e_click_mi4E1piTWe8 = (_, _1, count2, state)=>state.count += count2; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"uDAeiB,wBAAM,MAAM,KAAK,IAAE\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_div_q_e_click_mi4E1piTWe8", + "entry": null, + "displayName": "test.tsx_App_component_div_q_e_click", + "hash": "mi4E1piTWe8", + "canonicalFilename": "test.tsx_App_component_div_q_e_click_mi4E1piTWe8", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 340, + 365 + ], + "paramNames": [ + "_", + "_1", + "count2", + "state" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component_capture_props.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component_capture_props.snap new file mode 100644 index 00000000000..47b62d6fd90 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_functional_component_capture_props.snap @@ -0,0 +1,204 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 389 +expression: output +--- +==INPUT== + + +import { $, component$, useStore } from '@qwik.dev/core'; + +export const App = component$(({count, rest: [I2, {I3, v1: [I4], I5=v2, ...I6}, I7=v3, ...I8]}) => { + const state = useStore({count: 0}); + const {rest: [C2, {C3, v1: [C4], C5=v2, ...C6}, C7=v3, ...C8]} = foo(); + return $(() => { + return ( +
state.count += count + total }> + {I2}{I3}{I4}{I5}{I6}{I7}{I8} + {C2}{C3}{C4}{C5}{C6}{C7}{C8} + {v1}{v2}{v3} +
+ ) + }); +}) + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CAYjB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +// +const q_App_component_1_w0t0o3QMovU = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_1_w0t0o3QMovU"), "App_component_1_w0t0o3QMovU"); +// +export const App_component_ckEPmXZlub0 = ({ count, rest: [I2, { I3, v1: [I4], I5 = v2, ...I6 }, I7 = v3, ...I8] })=>{ + const state = useStore({ + count: 0 + }); + const { rest: [C2, { C3, v1: [C4], C5 = v2, ...C6 }, C7 = v3, ...C8] } = foo(); + return q_App_component_1_w0t0o3QMovU.w([ + C2, + C3, + C4, + C5, + C6, + C7, + C8, + I2, + I3, + I4, + I5, + I6, + I7, + I8, + count, + state + ]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;yCAG8B,CAAC,EAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,KAAG,EAAE,EAAE,GAAG,IAAG,EAAE,KAAG,EAAE,EAAE,GAAG,GAAG,EAAC;IAC7F,MAAM,QAAQ,SAAS;QAAC,OAAO;IAAC;IAChC,MAAM,EAAC,MAAM,CAAC,IAAI,EAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,KAAG,EAAE,EAAE,GAAG,IAAG,EAAE,KAAG,EAAE,EAAE,GAAG,GAAG,EAAC,GAAG;IACjE;;;;;;;;;;;;;;;;;;AASD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 91, + 460 + ], + "paramNames": [ + "{count, rest: [I2, {I3, v1: [I4], I5}, ...I8]}" + ] +} +*/ +============================= test.tsx_App_component_div_q_e_click_mi4E1piTWe8.js (ENTRY POINT)== + +export const App_component_div_q_e_click_mi4E1piTWe8 = (_, _1, count, state)=>state.count += count + total; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"uDAQkB,uBAAM,MAAM,KAAK,IAAI,QAAQ\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_div_q_e_click_mi4E1piTWe8", + "entry": null, + "displayName": "test.tsx_App_component_div_q_e_click", + "hash": "mi4E1piTWe8", + "canonicalFilename": "test.tsx_App_component_div_q_e_click_mi4E1piTWe8", + "path": "", + "extension": "js", + "parent": "App_component_1_w0t0o3QMovU", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 319, + 353 + ], + "paramNames": [ + "_", + "_1", + "count", + "state" + ] +} +*/ +============================= test.tsx_App_component_1_w0t0o3QMovU.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_div_q_e_click_mi4E1piTWe8 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_div_q_e_click_mi4E1piTWe8"), "App_component_div_q_e_click_mi4E1piTWe8"); +// +export const App_component_1_w0t0o3QMovU = ()=>{ + const C2 = _captures[0], C3 = _captures[1], C4 = _captures[2], C5 = _captures[3], C6 = _captures[4], C7 = _captures[5], C8 = _captures[6], I2 = _captures[7], I3 = _captures[8], I4 = _captures[9], I5 = _captures[10], I6 = _captures[11], I7 = _captures[12], I8 = _captures[13], count = _captures[14], state = _captures[15]; + return /*#__PURE__*/ _jsxSorted("div", { + "q-e:click": q_App_component_div_q_e_click_mi4E1piTWe8, + "q:ps": [ + count, + state + ] + }, null, [ + I2, + I3, + I4, + I5, + I6, + I7, + I8, + C2, + C3, + C4, + C5, + C6, + C7, + C8, + v1, + v2, + v3 + ], 4, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;2CAMU;;IACR,qBACC,WAAC;QAAI,WAAQ;;;;;;QACX;QAAI;QAAI;QAAI;QAAI;QAAI;QAAI;QACxB;QAAI;QAAI;QAAI;QAAI;QAAI;QAAI;QACxB;QAAI;QAAI\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_1_w0t0o3QMovU", + "entry": null, + "displayName": "test.tsx_App_component_1", + "hash": "w0t0o3QMovU", + "canonicalFilename": "test.tsx_App_component_1_w0t0o3QMovU", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 282, + 456 + ], + "captureNames": [ + "C2", + "C3", + "C4", + "C5", + "C6", + "C7", + "C8", + "I2", + "I3", + "I4", + "I5", + "I6", + "I7", + "I8", + "count", + "state" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_getter_generation.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_getter_generation.snap new file mode 100644 index 00000000000..d5434ae184e --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_getter_generation.snap @@ -0,0 +1,167 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3076 +expression: output +--- +==INPUT== + + +import { component$, useStore } from '@qwik.dev/core'; + +export const App = component$(() => { + const store = useStore({ + count: 0, + stuff: 0, + nested: { + count: 0 + } + }); + const signal = useSignal(0); + return ( + + + ); +}); + +export const Cmp = component$((props) => { + return ( + <> +

{props.nested.count}

+

Value {props.count}

+ + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +const q_Cmp_component_4ryKJTOKjWE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Cmp_component_4ryKJTOKjWE"), "Cmp_component_4ryKJTOKjWE"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); +export const Cmp = /*#__PURE__*/ componentQrl(q_Cmp_component_4ryKJTOKjWE); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AAGA,OAAO,MAAM,oBAAM,0CAoBhB;AAEH,OAAO,MAAM,oBAAM,0CAOhB\"}") +============================= test.tsx_Cmp_component_4ryKJTOKjWE.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.nested.count; +const _hf0_str = "p0.nested.count"; +export const Cmp_component_4ryKJTOKjWE = (props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("p", { + "data-value": _wrapProp(props, "count") + }, null, _fnSignal(_hf0, [ + props + ], _hf0_str), 1, null), + /*#__PURE__*/ _jsxSorted("p", null, null, [ + "Value ", + _wrapProp(props, "count"), + /*#__PURE__*/ _jsxSorted("span", null, null, null, 3, null) + ], 1, null) + ], 1, "u6_1"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;mBAgBW,GAAM,MAAM,CAAC,KAAK;;yCASC,CAAC;IAC9B,qBACC;sBACC,WAAC;YAAE,YAAU,YAAE;;;;sBACf,WAAC;YAAE;sBAAO;0BAAY,WAAC;;;AAG1B\"}") +/* +{ + "origin": "test.tsx", + "name": "Cmp_component_4ryKJTOKjWE", + "entry": null, + "displayName": "test.tsx_Cmp_component", + "hash": "4ryKJTOKjWE", + "canonicalFilename": "test.tsx_Cmp_component_4ryKJTOKjWE", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 458, + 596 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { Cmp } from "./test"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.nested.count; +const _hf0_str = "p0.nested.count"; +const _hf1 = (p0)=>p0.stuff + 12; +const _hf1_str = "p0.stuff+12"; +const _hf2 = (p0)=>p0.formData?.get('username'); +const _hf2_str = 'p0.formData?.get("username")'; +export const App_component_ckEPmXZlub0 = ()=>{ + const store = useStore({ + count: 0, + stuff: 0, + nested: { + count: 0 + } + }); + const signal = useSignal(0); + return /*#__PURE__*/ _jsxSorted(Cmp, null, { + prop: 'true', + count: _wrapProp(store, "count"), + nested: _fnSignal(_hf0, [ + store + ], _hf0_str), + signal: signal, + store: _fnSignal(_hf1, [ + store + ], _hf1_str), + value: _fnSignal(_hf2, [ + signal + ], _hf2_str) + }, null, 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;mBAgBW,GAAM,MAAM,CAAC,KAAK;;mBAEnB,GAAM,KAAK,GAAG;;mBACd,GAAO,QAAQ,EAAE,IAAI;;yCAhBD;IAC7B,MAAM,QAAQ,SAAS;QACtB,OAAO;QACP,OAAO;QACP,QAAQ;YACP,OAAO;QACR;IACD;IACA,MAAM,SAAS,UAAU;IACzB,qBACC,WAAC;QACA,MAAmB;QACnB,KAAK,YAAE;QACP,MAAM;;;QACN,QAAQ;QACR,KAAK;;;QACL,KAAK;;;;AAIR\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 88, + 424 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_immutable_analysis.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_immutable_analysis.snap new file mode 100644 index 00000000000..4a88e6df901 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_immutable_analysis.snap @@ -0,0 +1,305 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2138 +expression: output +--- +==INPUT== + + +import { component$, useStore, $ } from '@qwik.dev/core'; +import importedValue from 'v'; +import styles from './styles.module.css'; + +export const App = component$((props) => { + const {Model} = props; + const state = useStore({count: 0}); + const remove = $((id: number) => { + const d = state.data; + d.splice( + d.findIndex((d) => d.id === id), + 1 + ) + }); + return ( + <> +

Hello Qwik

+
console.log('stuff')} + transparent$={() => {console.log('stuff')}} + immutable1="stuff" + immutable2={{ + foo: 'bar', + baz: importedValue ? true : false, + }} + immutable3={2} + immutable4$={(ev) => console.log(state.count)} + immutable5={[1, 2, importedValue, null, {}]} + > +

Hello Qwik

+
+ [].map(() => ( + console.log(state.count))()} + mutable3={[1, 2, state, null, {}]} + /> + )); + + ); +}); + +============================= test.tsx_App_component_Fragment_Div_onEvent_zrFduYbT3xM.js (ENTRY POINT)== + +export const App_component_Fragment_Div_onEvent_zrFduYbT3xM = ()=>console.log('stuff'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"8DAsBc,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_Fragment_Div_onEvent_zrFduYbT3xM", + "entry": null, + "displayName": "test.tsx_App_component_Fragment_Div_onEvent", + "hash": "zrFduYbT3xM", + "canonicalFilename": "test.tsx_App_component_Fragment_Div_onEvent_zrFduYbT3xM", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "jSXProp", + "ctxName": "onEvent$", + "captures": false, + "loc": [ + 543, + 569 + ] +} +*/ +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAKA,OAAO,MAAM,oBAAM,0CA4ChB\"}") +============================= test.tsx_App_component_Fragment_Div_immutable4_2zF7jA3Yti0.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_Fragment_Div_immutable4_2zF7jA3Yti0 = (ev)=>{ + const state = _captures[0]; + return console.log(state.count); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;iEA8BiB,CAAC;;WAAO,QAAQ,GAAG,CAAC,MAAM,KAAK\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_Fragment_Div_immutable4_2zF7jA3Yti0", + "entry": null, + "displayName": "test.tsx_App_component_Fragment_Div_immutable4", + "hash": "2zF7jA3Yti0", + "canonicalFilename": "test.tsx_App_component_Fragment_Div_immutable4_2zF7jA3Yti0", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "jSXProp", + "ctxName": "immutable4$", + "captures": true, + "loc": [ + 760, + 792 + ], + "paramNames": [ + "ev" + ], + "captureNames": [ + "state" + ] +} +*/ +============================= test.tsx_App_component_Fragment_Div_transparent_eeDEK6EM1oo.js (ENTRY POINT)== + +export const App_component_Fragment_Div_transparent_eeDEK6EM1oo = ()=>{ + console.log('stuff'); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"kEAuBkB;IAAO,QAAQ,GAAG,CAAC;AAAQ\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_Fragment_Div_transparent_eeDEK6EM1oo", + "entry": null, + "displayName": "test.tsx_App_component_Fragment_Div_transparent", + "hash": "eeDEK6EM1oo", + "canonicalFilename": "test.tsx_App_component_Fragment_Div_transparent_eeDEK6EM1oo", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "jSXProp", + "ctxName": "transparent$", + "captures": false, + "loc": [ + 589, + 617 + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import importedValue from "v"; +import { qrl } from "@qwik.dev/core"; +import styles from "./styles.module.css"; +import { useStore } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>({ + foo: 'bar', + baz: p0.count ? true : false + }); +const _hf0_str = '{foo:"bar",baz:p0.count?true:false}'; +// +const q_App_component_Fragment_Div_immutable4_2zF7jA3Yti0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_Fragment_Div_immutable4_2zF7jA3Yti0"), "App_component_Fragment_Div_immutable4_2zF7jA3Yti0"); +const q_App_component_Fragment_Div_onEvent_zrFduYbT3xM = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_Fragment_Div_onEvent_zrFduYbT3xM"), "App_component_Fragment_Div_onEvent_zrFduYbT3xM"); +const q_App_component_Fragment_Div_transparent_eeDEK6EM1oo = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_Fragment_Div_transparent_eeDEK6EM1oo"), "App_component_Fragment_Div_transparent_eeDEK6EM1oo"); +const q_App_component_remove_pU6yOC5P6sY = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_remove_pU6yOC5P6sY"), "App_component_remove_pU6yOC5P6sY"); +// +export const App_component_ckEPmXZlub0 = (props)=>{ + const state = useStore({ + count: 0 + }); + const remove = q_App_component_remove_pU6yOC5P6sY.w([ + state + ]); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("p", { + "q-e:click": props.onClick$ + }, { + class: "stuff" + }, "Hello Qwik", 2, null), + /*#__PURE__*/ _jsxSorted(Div, { + document: window.document, + onClick$: props.onClick$ + }, { + class: styles.foo, + onEvent$: q_App_component_Fragment_Div_onEvent_zrFduYbT3xM, + transparent$: q_App_component_Fragment_Div_transparent_eeDEK6EM1oo, + immutable1: "stuff", + immutable2: { + foo: 'bar', + baz: importedValue ? true : false + }, + immutable3: 2, + immutable4$: q_App_component_Fragment_Div_immutable4_2zF7jA3Yti0.w([ + state + ]), + immutable5: [ + 1, + 2, + importedValue, + null, + {} + ] + }, /*#__PURE__*/ _jsxSorted("p", null, null, "Hello Qwik", 3, null), 2, "u6_0"), + "[].map(() => (", + /*#__PURE__*/ _jsxSorted(props.Model, { + mutable2: (()=>console.log(state.count))() + }, { + class: state, + remove$: remove, + mutable1: _fnSignal(_hf0, [ + state + ], _hf0_str), + mutable3: [ + 1, + 2, + state, + null, + {} + ] + }, null, 3, "u6_1"), + "));" + ], 1, "u6_2"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;mBAuCe,CAAA;QACT,KAAK;QACL,KAAK,GAAM,KAAK,GAAG,OAAO;IAC3B,CAAA;;;;;;;;yCArCyB,CAAC;IAE9B,MAAM,QAAQ,SAAS;QAAC,OAAO;IAAC;IAChC,MAAM;;;IAON,qBACC;sBACC,WAAC;YAAgB,aAAU,MAAM,QAAQ;;YAAtC,OAAM;WAAkC;sBAC3C,WAAC;YAEA,UAAU,OAAO,QAAQ;YACzB,UAAU,MAAM,QAAQ;;YAFxB,OAAO,OAAO,GAAG;YAGjB,QAAQ;YACR,YAAY;YACZ,YAAW;YACX,YAAY;gBACX,KAAK;gBACL,KAAK,gBAAgB,OAAO;YAC7B;YACA,YAAY;YACZ,WAAW;;;YACX,YAAY;gBAAC;gBAAG;gBAAG;gBAAe;gBAAM,CAAC;aAAE;yBAE3C,WAAC,iBAAE;QACE;sBAEL,WA9Ba,MAAT;YAqCH,UAAU,CAAC,IAAM,QAAQ,GAAG,CAAC,MAAM,KAAK,CAAC;;YANzC,OAAO;YACP,SAAS;YACT,QAAQ;;;YAKR,UAAU;gBAAC;gBAAG;gBAAG;gBAAO;gBAAM,CAAC;aAAE;;QAChC;;AAIN\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 164, + 1148 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_remove_pU6yOC5P6sY.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const App_component_remove_pU6yOC5P6sY = (id)=>{ + const state = _captures[0]; + const d = state.data; + d.splice(d.findIndex((d)=>d.id === id), 1); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;gDAQkB,CAAC;;IACjB,MAAM,IAAI,MAAM,IAAI;IACpB,EAAE,MAAM,CACP,EAAE,SAAS,CAAC,CAAC,IAAM,EAAE,EAAE,KAAK,KAC5B\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_remove_pU6yOC5P6sY", + "entry": null, + "displayName": "test.tsx_App_component_remove", + "hash": "pU6yOC5P6sY", + "canonicalFilename": "test.tsx_App_component_remove_pU6yOC5P6sY", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 256, + 358 + ], + "paramNames": [ + "id" + ], + "captureNames": [ + "state" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_immutable_function_components.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_immutable_function_components.snap new file mode 100644 index 00000000000..ebb3e92d5d5 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_immutable_function_components.snap @@ -0,0 +1,38 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2604 +expression: output +--- +==INPUT== + + +import { component$, useStore, Slot } from '@qwik.dev/core'; + +export const App = component$((props: Stuff) => { + return ( +
+ +
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { Slot } from '@qwik.dev/core'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +// +const App_component_ckEPmXZlub0 = (props)=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, /*#__PURE__*/ _jsxSorted(Slot, null, null, null, 3, "u6_0"), 1, "u6_1"); +}; +q_App_component_ckEPmXZlub0.s(App_component_ckEPmXZlub0); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;AACA,SAA+B,IAAI,QAAQ,iBAAiB;;;;kCAE9B,CAAC;IAC9B,qBACC,WAAC,iCACA,WAAC;AAGJ;;AANA,OAAO,MAAM,oBAAM,0CAMhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_import_assertion.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_import_assertion.snap new file mode 100644 index 00000000000..d354f740d77 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_import_assertion.snap @@ -0,0 +1,61 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2044 +expression: output +--- +==INPUT== + + +import { component$, $ } from '@qwik.dev/core'; +import json from "./foo.json" assert { type: "json" }; + +export const Greeter = component$(() => { + return json; +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Greeter_component_n7HuG2hhU0Q = /*#__PURE__*/ qrl(()=>import("./test.tsx_Greeter_component_n7HuG2hhU0Q"), "Greeter_component_n7HuG2hhU0Q"); +// +export const Greeter = /*#__PURE__*/ componentQrl(q_Greeter_component_n7HuG2hhU0Q); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAIA,OAAO,MAAM,wBAAU,8CAEpB\"}") +============================= test.tsx_Greeter_component_n7HuG2hhU0Q.js (ENTRY POINT)== + +import json from "./foo.json" with { + type: "json" +}; +// +export const Greeter_component_n7HuG2hhU0Q = ()=>{ + return json; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"mCAEqC;IAAE,MAAM;AAAO;;6CAElB;IACjC,OAAO;AACR\"}") +/* +{ + "origin": "test.tsx", + "name": "Greeter_component_n7HuG2hhU0Q", + "entry": null, + "displayName": "test.tsx_Greeter_component", + "hash": "n7HuG2hhU0Q", + "canonicalFilename": "test.tsx_Greeter_component_n7HuG2hhU0Q", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 140, + 163 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_inlined_entry_strategy.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_inlined_entry_strategy.snap new file mode 100644 index 00000000000..84603470c1d --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_inlined_entry_strategy.snap @@ -0,0 +1,72 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1516 +expression: output +--- +==INPUT== + + +import { component$, useBrowserVisibleTask$, useStore, useStyles$ } from '@qwik.dev/core'; +import { thing } from './sibling'; +import mongodb from 'mongodb'; + +export const Child = component$(() => { + + useStyles$('somestring'); + const state = useStore({ + count: 0 + }); + + // Double count watch + useBrowserVisibleTask$(() => { + state.count = thing.doStuff() + import("./sibling"); + }); + + return ( +
console.log(mongodb)}> +
+ ); +}); + + +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { useStylesQrl } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { useBrowserVisibleTaskQrl } from "@qwik.dev/core"; +import { _captures } from "@qwik.dev/core"; +import { useStore } from '@qwik.dev/core'; +import { thing } from './sibling'; +import mongodb from 'mongodb'; +// +const q_Child_component_9GyF01GDKqw = /*#__PURE__*/ _noopQrl("Child_component_9GyF01GDKqw"); +const q_Child_component_div_q_e_click_cROa4sult1s = /*#__PURE__*/ _noopQrl("Child_component_div_q_e_click_cROa4sult1s"); +const q_Child_component_useBrowserVisibleTask_0IGFPOyJmQA = /*#__PURE__*/ _noopQrl("Child_component_useBrowserVisibleTask_0IGFPOyJmQA"); +const q_Child_component_useStyles_qBZTuFM0160 = /*#__PURE__*/ _noopQrl("Child_component_useStyles_qBZTuFM0160"); +// +q_Child_component_useStyles_qBZTuFM0160.s('somestring'); +q_Child_component_useBrowserVisibleTask_0IGFPOyJmQA.s(()=>{ + const state = _captures[0]; + state.count = thing.doStuff() + import("./sibling"); +}); +q_Child_component_div_q_e_click_cROa4sult1s.s(()=>console.log(mongodb)); +q_Child_component_9GyF01GDKqw.s(()=>{ + useStylesQrl(q_Child_component_useStyles_qBZTuFM0160); + const state = useStore({ + count: 0 + }); + // Double count watch + useBrowserVisibleTaskQrl(q_Child_component_useBrowserVisibleTask_0IGFPOyJmQA.w([ + state + ])); + return
+
; +}); +export const Child = /*#__PURE__*/ componentQrl(q_Child_component_9GyF01GDKqw); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAA6C,QAAQ,QAAoB,iBAAiB;AAC1F,SAAS,KAAK,QAAQ,YAAY;AAClC,OAAO,aAAa,UAAU;;;;;;;0CAIlB;sDAMY;;IACtB,MAAM,KAAK,GAAG,MAAM,OAAO,KAAK,MAAM,CAAC;;8CAIxB,IAAM,QAAQ,GAAG,CAAC;gCAbH;IAE/B;IACA,MAAM,QAAQ,SAAS;QACtB,OAAO;IACR;IAEA,qBAAqB;IACrB;;;IAIA,QACE,IAAI,wDAAsC;EAC3C,EAAE;AAEJ;AAhBA,OAAO,MAAM,sBAAQ,4CAgBlB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_input_bind.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_input_bind.snap new file mode 100644 index 00000000000..2634359417c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_input_bind.snap @@ -0,0 +1,70 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2013 +expression: output +--- +==INPUT== + + +import { component$, $ } from '@qwik.dev/core'; + +export const Greeter = component$(() => { + const value = useSignal(0); + const checked = useSignal(false); + const stuff = useSignal(); + return ( + <> + + + +
{value}
+
{value.value}
+ + + ) +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _val } from "@qwik.dev/core"; +import { inlinedQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _chk } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +// +const q_s_n7HuG2hhU0Q = /*#__PURE__*/ _noopQrl("s_n7HuG2hhU0Q"); +// +q_s_n7HuG2hhU0Q.s(()=>{ + const value = useSignal(0); + const checked = useSignal(false); + const stuff = useSignal(); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("input", null, { + "value": value, + "q-e:input": inlinedQrl(_val, "_val", [ + value + ]) + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("input", null, { + "checked": checked, + "q-e:input": inlinedQrl(_chk, "_chk", [ + checked + ]) + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("input", null, { + "bind:stuff": stuff + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, value, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, _wrapProp(value), 3, null) + ], 3, "u6_0"); +}); +export const Greeter = /*#__PURE__*/ componentQrl(q_s_n7HuG2hhU0Q); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;kBAGkC;IACjC,MAAM,QAAQ,UAAU;IACxB,MAAM,UAAU,UAAU;IAC1B,MAAM,QAAQ;IACd,qBACC;sBACC,WAAC;qBAAkB;;gBAAA;;;sBACnB,WAAC;uBAAoB;;gBAAA;;;sBACrB,WAAC;YAAD,cAAmB;;sBACnB,WAAC,mBAAK;sBACN,WAAC,6BAAK;;AAIT;AAdA,OAAO,MAAM,wBAAU,8BAcpB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_invalid_references.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_invalid_references.snap new file mode 100644 index 00000000000..36d114ad7d3 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_invalid_references.snap @@ -0,0 +1,112 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 971 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +const I1 = 12; +const [I2, {I3, v1: [I4], I5=v2, ...I6}, I7=v3, ...I8] = obj; +function I9() {} +class I10 {} + +export const App = component$(({count}) => { + console.log(I1, I2, I3, I4, I5, I6, I7, I8, I9); + console.log(itsok, v1, v2, v3, obj); + return $(() => { + return ( + + ) + }); +}) + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAQA,OAAO,MAAM,oBAAM,0CAQjB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const I1 = 12; +const [I2, { I3, v1: [I4], I5 = v2, ...I6 }, I7 = v3, ...I8] = obj; +function I9() {} +// +const q_App_component_1_w0t0o3QMovU = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_1_w0t0o3QMovU"), "App_component_1_w0t0o3QMovU"); +// +export const App_component_ckEPmXZlub0 = (_rawProps)=>{ + console.log(I1, I2, I3, I4, I5, I6, I7, I8, I9); + console.log(itsok, v1, v2, v3, obj); + return q_App_component_1_w0t0o3QMovU; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;MAGM,KAAK;MACL,CAAC,IAAI,EAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,KAAG,EAAE,EAAE,GAAG,IAAG,EAAE,KAAG,EAAE,EAAE,GAAG,GAAG,GAAG;AACzD,SAAS,MAAM;;;;yCAGe;IAC7B,QAAQ,GAAG,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;IAC5C,QAAQ,GAAG,CAAC,OAAO,IAAI,IAAI,IAAI;IAC/B;AAKD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 189, + 346 + ], + "paramNames": [ + "_rawProps" + ] +} +*/ +============================= test.tsx_App_component_1_w0t0o3QMovU.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +// +class I10 { +} +export const App_component_1_w0t0o3QMovU = ()=>{ + return /*#__PURE__*/ _jsxSorted(I10, null, null, null, 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;AAMA,MAAM;AAAK;2CAKD;IACR,qBACC,WAAC;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_1_w0t0o3QMovU", + "entry": null, + "displayName": "test.tsx_App_component_1", + "hash": "w0t0o3QMovU", + "canonicalFilename": "test.tsx_App_component_1_w0t0o3QMovU", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 302, + 342 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_invalid_segment_expr1.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_invalid_segment_expr1.snap new file mode 100644 index 00000000000..1e324b86cba --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_invalid_segment_expr1.snap @@ -0,0 +1,133 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 999 +expression: output +--- +==INPUT== + + +import { $, component$, useStyles$ } from '@qwik.dev/core'; +import css1 from './global.css'; +import css2 from './style.css'; + +export const App = component$(() => { + const style = `${css1}${css2}`; + useStyles$(style); + const render = () => { + return ( +
+ ) + }; + return $(render); +}) + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAKA,OAAO,MAAM,oBAAM,0CASjB\"}") +============================= test.tsx_App_component_useStyles_t35nSa5UV7U.js (ENTRY POINT)== + +import css1 from "./global.css"; +import css2 from "./style.css"; +// +export const App_component_useStyles_t35nSa5UV7U = `${css1}${css2}`; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;mDAMe,GAAG,OAAO,MAAM\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_useStyles_t35nSa5UV7U", + "entry": null, + "displayName": "test.tsx_App_component_useStyles", + "hash": "t35nSa5UV7U", + "canonicalFilename": "test.tsx_App_component_useStyles_t35nSa5UV7U", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "useStyles$", + "captures": false, + "loc": [ + 181, + 197 + ] +} +*/ +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import css1 from "./global.css"; +import css2 from "./style.css"; +import { qrl } from "@qwik.dev/core"; +import { useStylesQrl } from "@qwik.dev/core"; +// +const q_App_component_1_w0t0o3QMovU = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_1_w0t0o3QMovU"), "App_component_1_w0t0o3QMovU"); +const q_App_component_useStyles_t35nSa5UV7U = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_useStyles_t35nSa5UV7U"), "App_component_useStyles_t35nSa5UV7U"); +// +export const App_component_ckEPmXZlub0 = ()=>{ + useStylesQrl(q_App_component_useStyles_t35nSa5UV7U); + return q_App_component_1_w0t0o3QMovU; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;yCAK8B;IAE7B;IAMA;AACD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 158, + 297 + ] +} +*/ +============================= test.tsx_App_component_1_w0t0o3QMovU.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +// +export const App_component_1_w0t0o3QMovU = ()=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;2CAQgB;IACd,qBACC,WAAC;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_1_w0t0o3QMovU", + "entry": null, + "displayName": "test.tsx_App_component_1", + "hash": "w0t0o3QMovU", + "canonicalFilename": "test.tsx_App_component_1_w0t0o3QMovU", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 235, + 275 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_issue_33443.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_issue_33443.snap new file mode 100644 index 00000000000..baabc1fea90 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_issue_33443.snap @@ -0,0 +1,64 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3049 +expression: output +--- +==INPUT== + + +import { component$, useSignal } from '@qwik.dev/core'; + +export const Issue3742 = component$(({description = '', other}: any) => { + const counter = useSignal(0); + return ( +
+ Issue3742 + +
+ ) + }); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { useSignal } from '@qwik.dev/core'; +// +const _hf0 = (p0, p1)=>(p0.description ?? '') && 'description' in p0.other ? `Hello ${p1.value}` : `Bye ${p1.value}`; +const _hf0_str = '(p0.description??"")&&"description"in p0.other?`Hello ${p1.value}`:`Bye ${p1.value}`'; +// +const q_Issue3742_component_div_button_q_e_click_95Hlm8WgsYY = /*#__PURE__*/ _noopQrl("Issue3742_component_div_button_q_e_click_95Hlm8WgsYY"); +const q_Issue3742_component_svSy0PlWTAw = /*#__PURE__*/ _noopQrl("Issue3742_component_svSy0PlWTAw"); +// +const Issue3742_component_div_button_q_e_click_95Hlm8WgsYY = (_, _1, counter)=>counter.value++; +q_Issue3742_component_div_button_q_e_click_95Hlm8WgsYY.s(Issue3742_component_div_button_q_e_click_95Hlm8WgsYY); +const Issue3742_component_svSy0PlWTAw = (_rawProps)=>{ + const counter = useSignal(0); + return /*#__PURE__*/ _jsxSorted("div", { + title: _fnSignal(_hf0, [ + _rawProps, + counter + ], _hf0_str) + }, null, [ + "Issue3742", + /*#__PURE__*/ _jsxSorted("button", { + "q:p": counter + }, { + "q-e:click": q_Issue3742_component_div_button_q_e_click_95Hlm8WgsYY + }, "Increment", 7, null) + ], 1, "u6_0"); +}; +q_Issue3742_component_svSy0PlWTAw.s(Issue3742_component_svSy0PlWTAw); +export const Issue3742 = /*#__PURE__*/ componentQrl(q_Issue3742_component_svSy0PlWTAw); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;AACA,SAAqB,SAAS,QAAQ,iBAAiB;;uBAM9C,AAAC,IAJ4B,eAAc,OAI3B,oBAJ+B,QAIL,CAAC,MAAM,EAAE,GAAQ,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,GAAQ,KAAK,EAAE;;;;;;6DAGhF,kBAAM,QAAQ,KAAK;;wCAPH;IACnC,MAAM,UAAU,UAAU;IAC1B,qBACC,WAAC;QACD,KAAK;;;;;QACJ;sBAED,WAAC;;;YAAO,WAAQ;WAAyB;;AAK1C;;AAZD,OAAO,MAAM,0BAAY,gDAYrB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_issue_4438.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_issue_4438.snap new file mode 100644 index 00000000000..6b49a56a69c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_issue_4438.snap @@ -0,0 +1,47 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2839 +expression: output +--- +==INPUT== + + +import { component$, useSignal } from '@qwik.dev/core'; + +export const App = component$(() => { + const toggle = useSignal(false); + return ( + <> +
+
{toggle.value ? $localize`singular` : $localize`plural`}
+ + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { useSignal } from '@qwik.dev/core'; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +// +const App_component_ckEPmXZlub0 = ()=>{ + const toggle = useSignal(false); + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", { + "data-nu": toggle.value ? $localize`singular` : 'plural' + }, null, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, toggle.value ? $localize`singular` : $localize`plural`, 1, null) + ], 1, "u6_0"); +}; +q_App_component_ckEPmXZlub0.s(App_component_ckEPmXZlub0); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;AACA,SAAqB,SAAS,QAAQ,iBAAiB;;;;kCAEzB;IAC7B,MAAM,SAAS,UAAU;IACzB,qBACC;sBACC,WAAC;YAAI,WAAS,OAAO,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG;;sBACnD,WAAC,mBAAK,OAAO,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;;AAG/D;;AARA,OAAO,MAAM,oBAAM,0CAQhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx.snap new file mode 100644 index 00000000000..acb0f584b28 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx.snap @@ -0,0 +1,181 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1144 +expression: output +--- +==INPUT== + + +import { $, component$, h, Fragment } from '@qwik.dev/core'; + +export const Lightweight = (props) => { + return ( +
+ <> +
+
+ ) +}; + +export const Foo = component$((props) => { + return $(() => { + return ( +
+ <> +
+
+
12
+ +
+ +
+
+
+
+
+
+
+ {children} +
+
+ ) + }); +}, { + tagName: "my-foo", +}); + +============================= test.js == + +import { _jsxSorted } from "@qwik.dev/core"; +import { _getVarProps } from "@qwik.dev/core"; +import { _getConstProps } from "@qwik.dev/core"; +import { _jsxSplit } from "@qwik.dev/core"; +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +// +const q_Foo_component_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "Foo_component_HTDRsvUbLiE"); +// +export const Lightweight = (props)=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, null), + /*#__PURE__*/ _jsxSplit("button", { + ..._getVarProps(props) + }, _getConstProps(props), null, 0, null) + ], 1, "u6_0"), 1, "u6_1"); +}; +export const Foo = /*#__PURE__*/ componentQrl(q_Foo_component_HTDRsvUbLiE, { + tagName: "my-foo" +}); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;AAGA,OAAO,MAAM,cAAc,CAAC;IAC3B,qBACC,WAAC,iCACA;sBACC,WAAC;sBACD,UAAC;4BAAW;0BAAA;;AAIhB,EAAE;AAEF,OAAO,MAAM,oBAAM,0CAuBhB;IACF,SAAS;AACV,GAAG\"}") +============================= test.tsx_Foo_component_HTDRsvUbLiE.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_1_DvU6FitWglY = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_1_DvU6FitWglY"), "Foo_component_1_DvU6FitWglY"); +// +export const Foo_component_HTDRsvUbLiE = (props)=>{ + return q_Foo_component_1_DvU6FitWglY.w([ + props + ]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;yCAc8B,CAAC;IAC9B;;;AAsBD\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 217, + 581 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_Foo_component_1_DvU6FitWglY.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { Lightweight } from "./test"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _getConstProps } from "@qwik.dev/core"; +import { _getVarProps } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _jsxSplit } from "@qwik.dev/core"; +// +export const Foo_component_1_DvU6FitWglY = ()=>{ + const props = _captures[0]; + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", null, { + class: "class" + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, { + class: "class" + }, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, { + class: "class" + }, "12", 3, null) + ], 3, "u6_2"), + /*#__PURE__*/ _jsxSorted("div", null, { + class: "class" + }, /*#__PURE__*/ _jsxSplit(Lightweight, { + ..._getVarProps(props) + }, _getConstProps(props), null, 0, "u6_3"), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, { + class: "class" + }, [ + /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, null) + ], 3, null), + /*#__PURE__*/ _jsxSorted("div", null, { + class: "class" + }, children, 1, null) + ], 1, "u6_4"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;2CAeU;;IACR,qBACC,WAAC;sBACA;0BACC,WAAC;gBAAI,OAAM;;0BACX,WAAC;gBAAI,OAAM;;0BACX,WAAC;gBAAI,OAAM;eAAQ;;sBAEpB,WAAC;YAAI,OAAM;yBACV,UAAC;4BAAgB;0BAAA;sBAElB,WAAC;YAAI,OAAM;;0BACV,WAAC;0BACD,WAAC;0BACD,WAAC;;sBAEF,WAAC;YAAI,OAAM;WACT\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_1_DvU6FitWglY", + "entry": null, + "displayName": "test.tsx_Foo_component_1", + "hash": "DvU6FitWglY", + "canonicalFilename": "test.tsx_Foo_component_1_DvU6FitWglY", + "path": "", + "extension": "js", + "parent": "Foo_component_HTDRsvUbLiE", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 240, + 577 + ], + "captureNames": [ + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_import_source.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_import_source.snap new file mode 100644 index 00000000000..5804d7450bd --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_import_source.snap @@ -0,0 +1,68 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1434 +expression: output +--- +==INPUT== + + +/* @jsxImportSource react */ + +import { qwikify$ } from './qwikfy'; + +export const App = () => ( +
console.log('App')}>
+); + +export const App2 = qwikify$(() => ( +
console.log('App2')}>
+)); + +============================= test.js == + +/* @jsxImportSource react */ import { qwikifyQrl } from "./qwikfy"; +import { qrl } from "@qwik.dev/core"; +import { jsx as _jsx } from "react/jsx-runtime"; +// +const q_App2_qwikify_RKJW7oCMdS4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App2_qwikify_RKJW7oCMdS4.js"), "App2_qwikify_RKJW7oCMdS4"); +// +export const App = ()=>/*#__PURE__*/ _jsx("div", { + onClick$: ()=>console.log('App') + }); +export const App2 = qwikifyQrl(q_App2_qwikify_RKJW7oCMdS4); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"AACA,0BAA0B;;;;;;AAI1B,OAAO,MAAM,MAAM,kBAClB,KAAC;QAAI,UAAU,IAAI,QAAQ,GAAG,CAAC;OAC9B;AAEF,OAAO,MAAM,OAAO,uCAEjB\"}") +============================= test.tsx_App2_qwikify_RKJW7oCMdS4.js (ENTRY POINT)== + +import { jsx as _jsx } from "react/jsx-runtime"; +// +export const App2_qwikify_RKJW7oCMdS4 = ()=>/*#__PURE__*/ _jsx("div", { + onClick$: ()=>console.log('App2') + }); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;wCAS6B,kBAC5B,KAAC;QAAI,UAAU,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App2_qwikify_RKJW7oCMdS4", + "entry": null, + "displayName": "test.tsx_App2_qwikify", + "hash": "RKJW7oCMdS4", + "canonicalFilename": "test.tsx_App2_qwikify_RKJW7oCMdS4", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "qwikify$", + "captures": false, + "loc": [ + 177, + 234 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_keyed.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_keyed.snap new file mode 100644 index 00000000000..9ac4588fffb --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_keyed.snap @@ -0,0 +1,80 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2441 +expression: output +--- +==INPUT== + + +import { component$, useStore } from '@qwik.dev/core'; + +export const App = component$((props: Stuff) => { + return ( + <> + + + + +

Hello Qwik

+ + ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0.js"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CAUhB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _jsxSorted } from "@qwik.dev/core"; +// +export const App_component_ckEPmXZlub0 = (props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted(Cmp, null, null, null, 3, "stuff"), + /*#__PURE__*/ _jsxSorted(Cmp, null, null, null, 3, "u6_0"), + /*#__PURE__*/ _jsxSorted(Cmp, null, { + prop: "23" + }, null, 3, "u6_1"), + /*#__PURE__*/ _jsxSorted(Cmp, null, { + prop: "23" + }, null, 3, props.stuff), + /*#__PURE__*/ _jsxSorted("p", null, null, "Hello Qwik", 3, props.stuff) + ], 1, "u6_2"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;yCAG8B,CAAC;IAC9B,qBACC;sBACC,WAAC,0BAAQ;sBACT,WAAC;sBACD,WAAC;YAAI,MAAK;;sBACV,WAAC;YAAI,MAAK;oBAAU,MAAM,KAAK;sBAC/B,WAAC,iBAAoB,iBAAb,MAAM,KAAK;;AAGtB\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 88, + 283 + ], + "paramNames": [ + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_keyed_dev.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_keyed_dev.snap new file mode 100644 index 00000000000..77aa6821ea8 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_keyed_dev.snap @@ -0,0 +1,109 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2467 +expression: output +--- +==INPUT== + + +import { component$, useStore } from '@qwik.dev/core'; + +export const App = component$((props: Stuff) => { + return ( + <> + + + + +

Hello Qwik

+ + ); +}); + +============================= project/index.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrlDEV } from "@qwik.dev/core"; +// +const q_App_component_KGLYFBhvJc0 = /*#__PURE__*/ qrlDEV(()=>import("./index.tsx_App_component_KGLYFBhvJc0.js"), "App_component_KGLYFBhvJc0", { + file: "/src/project/project/index.tsx", + lo: 88, + hi: 283, + displayName: "index.tsx_App_component" +}); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_KGLYFBhvJc0); + + +Some("{\"version\":3,\"sources\":[\"/src/project/project/index.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;AAGA,OAAO,MAAM,oBAAM,0CAUhB\"}") +============================= project/index.tsx_App_component_KGLYFBhvJc0.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _jsxSorted } from "@qwik.dev/core"; +// +export const App_component_KGLYFBhvJc0 = (props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted(Cmp, null, null, null, 3, "stuff", { + fileName: "project/index.tsx", + lineNumber: 7, + columnNumber: 4 + }), + /*#__PURE__*/ _jsxSorted(Cmp, null, null, null, 3, "Q6_0", { + fileName: "project/index.tsx", + lineNumber: 8, + columnNumber: 4 + }), + /*#__PURE__*/ _jsxSorted(Cmp, null, { + prop: "23" + }, null, 3, "Q6_1", { + fileName: "project/index.tsx", + lineNumber: 9, + columnNumber: 4 + }), + /*#__PURE__*/ _jsxSorted(Cmp, null, { + prop: "23" + }, null, 3, props.stuff, { + fileName: "project/index.tsx", + lineNumber: 10, + columnNumber: 4 + }), + /*#__PURE__*/ _jsxSorted("p", null, null, "Hello Qwik", 3, props.stuff, { + fileName: "project/index.tsx", + lineNumber: 11, + columnNumber: 4 + }) + ], 1, "Q6_2", { + fileName: "project/index.tsx", + lineNumber: 6, + columnNumber: 3 + }); +}; + + +Some("{\"version\":3,\"sources\":[\"/src/project/project/index.tsx\"],\"names\":[],\"mappings\":\";;;yCAG8B,CAAC;IAC9B,qBACC;sBACC,WAAC,0BAAQ;;;;;sBACT,WAAC;;;;;sBACD,WAAC;YAAI,MAAK;;;;;;sBACV,WAAC;YAAI,MAAK;oBAAU,MAAM,KAAK;;;;;sBAC/B,WAAC,iBAAoB,iBAAb,MAAM,KAAK;;;;;;;;;;AAGtB\"}") +/* +{ + "origin": "project/index.tsx", + "name": "App_component_KGLYFBhvJc0", + "entry": null, + "displayName": "index.tsx_App_component", + "hash": "KGLYFBhvJc0", + "canonicalFilename": "index.tsx_App_component_KGLYFBhvJc0", + "path": "project", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 88, + 283 + ], + "paramNames": [ + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_listeners.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_listeners.snap new file mode 100644 index 00000000000..084ee9ad163 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_jsx_listeners.snap @@ -0,0 +1,432 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1195 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +export const Foo = component$(() => { + + return $(() => { + const handler = $(() => console.log('reused')); + return ( +
console.log('onClick$')} + onDocumentScroll$={()=>console.log('onDocumentScroll')} + onDocumentScroll$={()=>console.log('onWindowScroll')} + + on-cLick$={()=>console.log('on-cLick$')} + onDocument-sCroll$={()=>console.log('onDocument-sCroll')} + onDocument-scroLL$={()=>console.log('onDocument-scroLL')} + + host:onClick$={()=>console.log('host:onClick$')} + host:onDocumentScroll$={()=>console.log('host:onDocument:scroll')} + host:onDocumentScroll$={()=>console.log('host:onWindow:scroll')} + + onKeyup$={handler} + onDocument:keyup$={handler} + onWindow:keyup$={handler} + + custom$={()=>console.log('custom')} + /> + ) + }); +}, { + tagName: "my-foo", +}); + +============================= test.tsx_Foo_component_div_host_onDocumentScroll_Zip7mifsjRY.js (ENTRY POINT)== + +export const Foo_component_div_host_onDocumentScroll_Zip7mifsjRY = ()=>console.log('host:onDocument:scroll'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"mEAkB4B,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_host_onDocumentScroll_Zip7mifsjRY", + "entry": null, + "displayName": "test.tsx_Foo_component_div_host_onDocumentScroll", + "hash": "Zip7mifsjRY", + "canonicalFilename": "test.tsx_Foo_component_div_host_onDocumentScroll_Zip7mifsjRY", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "host:onDocumentScroll$", + "captures": false, + "loc": [ + 590, + 631 + ] +} +*/ +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "Foo_component_HTDRsvUbLiE"); +// +export const Foo = /*#__PURE__*/ componentQrl(q_Foo_component_HTDRsvUbLiE, { + tagName: "my-foo" +}); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CA0BhB;IACF,SAAS;AACV,GAAG\"}") +============================= test.tsx_Foo_component_HTDRsvUbLiE.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_1_DvU6FitWglY = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_1_DvU6FitWglY"), "Foo_component_1_DvU6FitWglY"); +// +export const Foo_component_HTDRsvUbLiE = ()=>{ + return q_Foo_component_1_DvU6FitWglY; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;yCAG8B;IAE7B;AAwBD\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 81, + 845 + ] +} +*/ +============================= test.tsx_Foo_component_div_host_onClick_cPEH970JbEY.js (ENTRY POINT)== + +export const Foo_component_div_host_onClick_cPEH970JbEY = ()=>console.log('host:onClick$'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"0DAiBmB,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_host_onClick_cPEH970JbEY", + "entry": null, + "displayName": "test.tsx_Foo_component_div_host_onClick", + "hash": "cPEH970JbEY", + "canonicalFilename": "test.tsx_Foo_component_div_host_onClick_cPEH970JbEY", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "host:onClick$", + "captures": false, + "loc": [ + 528, + 560 + ] +} +*/ +============================= test.tsx_Foo_component_1_DvU6FitWglY.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_div_custom_pyHnxab17ms = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_custom_pyHnxab17ms"), "Foo_component_div_custom_pyHnxab17ms"); +const q_Foo_component_div_host_onClick_cPEH970JbEY = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_host_onClick_cPEH970JbEY"), "Foo_component_div_host_onClick_cPEH970JbEY"); +const q_Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg"), "Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg"); +const q_Foo_component_div_host_onDocumentScroll_Zip7mifsjRY = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_host_onDocumentScroll_Zip7mifsjRY"), "Foo_component_div_host_onDocumentScroll_Zip7mifsjRY"); +const q_Foo_component_div_q_e_c_lick_kX5SiYdz650 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_q_e_c_lick_kX5SiYdz650"), "Foo_component_div_q_e_c_lick_kX5SiYdz650"); +const q_Foo_component_div_q_e_click_YEa2A5ADUOg = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_q_e_click_YEa2A5ADUOg"), "Foo_component_div_q_e_click_YEa2A5ADUOg"); +const q_Foo_component_div_q_e_document_scroll_1_wphyTkeintI = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_q_e_document_scroll_1_wphyTkeintI"), "Foo_component_div_q_e_document_scroll_1_wphyTkeintI"); +const q_Foo_component_div_q_e_document_scroll_6qyBttefepU = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_q_e_document_scroll_6qyBttefepU"), "Foo_component_div_q_e_document_scroll_6qyBttefepU"); +const q_Foo_component_div_q_e_documentscroll_0FSbGzUROso = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_q_e_documentscroll_0FSbGzUROso"), "Foo_component_div_q_e_documentscroll_0FSbGzUROso"); +const q_Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0"), "Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0"); +const q_Foo_component_handler_H10xZtD0e7w = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_handler_H10xZtD0e7w"), "Foo_component_handler_H10xZtD0e7w"); +// +export const Foo_component_1_DvU6FitWglY = ()=>{ + const handler = q_Foo_component_handler_H10xZtD0e7w; + return /*#__PURE__*/ _jsxSorted("div", null, { + "q-e:click": q_Foo_component_div_q_e_click_YEa2A5ADUOg, + "q-e:documentscroll": q_Foo_component_div_q_e_documentscroll_0FSbGzUROso, + "q-e:documentscroll": q_Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0, + "q-e:c-lick": q_Foo_component_div_q_e_c_lick_kX5SiYdz650, + "q-e:document--scroll": q_Foo_component_div_q_e_document_scroll_6qyBttefepU, + "q-e:document--scroll": q_Foo_component_div_q_e_document_scroll_1_wphyTkeintI, + "host:onClick$": q_Foo_component_div_host_onClick_cPEH970JbEY, + "host:onDocumentScroll$": q_Foo_component_div_host_onDocumentScroll_Zip7mifsjRY, + "host:onDocumentScroll$": q_Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg, + "q-e:keyup": handler, + "q-e:document:keyup": handler, + "q-e:window:keyup": handler, + custom$: q_Foo_component_div_custom_pyHnxab17ms + }, null, 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;;;2CAKU;IACR,MAAM;IACN,qBACC,WAAC;QACA,WAAQ;QACR,oBAAiB;QACjB,oBAAiB;QAEjB,YAAS;QACT,sBAAkB;QAClB,sBAAkB;QAPnB,eAkBE;QAlBF,wBAkBE;QAlBF,wBAkBE;QALD,aAAU;QAbX,sBAcoB;QAdpB,oBAekB;QAEjB,OAAO;;AAGV\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_1_DvU6FitWglY", + "entry": null, + "displayName": "test.tsx_Foo_component_1", + "hash": "DvU6FitWglY", + "canonicalFilename": "test.tsx_Foo_component_1_DvU6FitWglY", + "path": "", + "extension": "js", + "parent": "Foo_component_HTDRsvUbLiE", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 100, + 841 + ] +} +*/ +============================= test.tsx_Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg.js (ENTRY POINT)== + +export const Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg = ()=>console.log('host:onWindow:scroll'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"qEAmB4B,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg", + "entry": null, + "displayName": "test.tsx_Foo_component_div_host_onDocumentScroll_1", + "hash": "Em1LspK7JVg", + "canonicalFilename": "test.tsx_Foo_component_div_host_onDocumentScroll_1_Em1LspK7JVg", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "host:onDocumentScroll$", + "captures": false, + "loc": [ + 661, + 700 + ] +} +*/ +============================= test.tsx_Foo_component_div_custom_pyHnxab17ms.js (ENTRY POINT)== + +export const Foo_component_div_custom_pyHnxab17ms = ()=>console.log('custom'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"oDAyBa,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_custom_pyHnxab17ms", + "entry": null, + "displayName": "test.tsx_Foo_component_div_custom", + "hash": "pyHnxab17ms", + "canonicalFilename": "test.tsx_Foo_component_div_custom_pyHnxab17ms", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "custom$", + "captures": false, + "loc": [ + 802, + 827 + ] +} +*/ +============================= test.tsx_Foo_component_div_q_e_document_scroll_6qyBttefepU.js (ENTRY POINT)== + +export const Foo_component_div_q_e_document_scroll_6qyBttefepU = ()=>console.log('onDocument-sCroll'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"iEAcwB,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_q_e_document_scroll_6qyBttefepU", + "entry": null, + "displayName": "test.tsx_Foo_component_div_q_e_document_scroll", + "hash": "6qyBttefepU", + "canonicalFilename": "test.tsx_Foo_component_div_q_e_document_scroll_6qyBttefepU", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "onDocument-sCroll$", + "captures": false, + "loc": [ + 408, + 444 + ] +} +*/ +============================= test.tsx_Foo_component_div_q_e_c_lick_kX5SiYdz650.js (ENTRY POINT)== + +export const Foo_component_div_q_e_c_lick_kX5SiYdz650 = ()=>console.log('on-cLick$'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"wDAae,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_q_e_c_lick_kX5SiYdz650", + "entry": null, + "displayName": "test.tsx_Foo_component_div_q_e_c_lick", + "hash": "kX5SiYdz650", + "canonicalFilename": "test.tsx_Foo_component_div_q_e_c_lick_kX5SiYdz650", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "on-cLick$", + "captures": false, + "loc": [ + 354, + 382 + ] +} +*/ +============================= test.tsx_Foo_component_handler_H10xZtD0e7w.js (ENTRY POINT)== + +export const Foo_component_handler_H10xZtD0e7w = ()=>console.log('reused'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"iDAMoB,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_handler_H10xZtD0e7w", + "entry": null, + "displayName": "test.tsx_Foo_component_handler", + "hash": "H10xZtD0e7w", + "canonicalFilename": "test.tsx_Foo_component_handler_H10xZtD0e7w", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 128, + 155 + ] +} +*/ +============================= test.tsx_Foo_component_div_q_e_documentscroll_0FSbGzUROso.js (ENTRY POINT)== + +export const Foo_component_div_q_e_documentscroll_0FSbGzUROso = ()=>console.log('onDocumentScroll'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"gEAUuB,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_q_e_documentscroll_0FSbGzUROso", + "entry": null, + "displayName": "test.tsx_Foo_component_div_q_e_documentscroll", + "hash": "0FSbGzUROso", + "canonicalFilename": "test.tsx_Foo_component_div_q_e_documentscroll_0FSbGzUROso", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "onDocumentScroll$", + "captures": false, + "loc": [ + 243, + 278 + ] +} +*/ +============================= test.tsx_Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0.js (ENTRY POINT)== + +export const Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0 = ()=>console.log('onWindowScroll'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"kEAWuB,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0", + "entry": null, + "displayName": "test.tsx_Foo_component_div_q_e_documentscroll_1", + "hash": "d0Zn04qNgs0", + "canonicalFilename": "test.tsx_Foo_component_div_q_e_documentscroll_1_d0Zn04qNgs0", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "onDocumentScroll$", + "captures": false, + "loc": [ + 303, + 336 + ] +} +*/ +============================= test.tsx_Foo_component_div_q_e_document_scroll_1_wphyTkeintI.js (ENTRY POINT)== + +export const Foo_component_div_q_e_document_scroll_1_wphyTkeintI = ()=>console.log('onDocument-scroLL'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"mEAewB,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_q_e_document_scroll_1_wphyTkeintI", + "entry": null, + "displayName": "test.tsx_Foo_component_div_q_e_document_scroll_1", + "hash": "wphyTkeintI", + "canonicalFilename": "test.tsx_Foo_component_div_q_e_document_scroll_1_wphyTkeintI", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "onDocument-scroLL$", + "captures": false, + "loc": [ + 470, + 506 + ] +} +*/ +============================= test.tsx_Foo_component_div_q_e_click_YEa2A5ADUOg.js (ENTRY POINT)== + +export const Foo_component_div_q_e_click_YEa2A5ADUOg = ()=>console.log('onClick$'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"uDASc,IAAI,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_q_e_click_YEa2A5ADUOg", + "entry": null, + "displayName": "test.tsx_Foo_component_div_q_e_click", + "hash": "YEa2A5ADUOg", + "canonicalFilename": "test.tsx_Foo_component_div_q_e_click_YEa2A5ADUOg", + "path": "", + "extension": "js", + "parent": "Foo_component_1_DvU6FitWglY", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 191, + 218 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_lib_mode.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_lib_mode.snap new file mode 100644 index 00000000000..9f050130c16 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_lib_mode.snap @@ -0,0 +1,61 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 6606 +expression: output +--- +==INPUT== + + +import { $, component$, server$, useStyle$, useTask$, useSignal } from '@qwik.dev/core'; + +export const Works = component$((props) => { + useStyle$(STYLES); + const text = 'hola'; + const sig = useSignal('hola'); + useTask$(() => { + console.log(sig.value, text); + }); + return ( +
console.log('in server', sig.value, text))}>
+ ); +}); + +const STYLES = '.class {}'; + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { useStyleQrl } from "@qwik.dev/core"; +import { inlinedQrl } from "@qwik.dev/core"; +import { useTaskQrl } from "@qwik.dev/core"; +import { _captures } from "@qwik.dev/core"; +import { serverQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { jsx as _jsx } from "@qwik.dev/core/jsx-runtime"; +import { component$, server$, useStyle$, useTask$, useSignal } from '@qwik.dev/core'; +// +const STYLES = '.class {}'; +export const Works = /*#__PURE__*/ componentQrl(/*#__PURE__*/ inlinedQrl((props)=>{ + useStyleQrl(/*#__PURE__*/ inlinedQrl(STYLES, "Works_component_useStyle_i40UL9JyQpg")); + const sig = useSignal('hola'); + useTaskQrl(/*#__PURE__*/ inlinedQrl(()=>{ + const sig = _captures[0]; + console.log(sig.value, 'hola'); + }, "Works_component_useTask_pjo5U5Ikll0", [ + sig + ])); + return /*#__PURE__*/ _jsxSorted("div", { + "q-e:click": serverQrl(/*#__PURE__*/ inlinedQrl(()=>{ + const sig = _captures[0]; + return console.log('in server', sig.value, 'hola'); + }, "Works_component_div_q_e_click_server_q39lOt7xGrI", [ + sig + ])) + }, null, null, 2, "u6_0"); +}, "Works_component_t45qL4vNGv0")); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;AACA,SAAY,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,QAAQ,iBAAiB;;AAcxF,MAAM,SAAS;AAZf,OAAO,MAAM,sBAAQ,sCAAW,CAAC;IAChC,qCAAU;IAEV,MAAM,MAAM,UAAU;IACtB,oCAAS;;QACR,QAAQ,GAAG,CAAC,IAAI,KAAK,EAHT;;;;IAKb,qBACC,WAAC;QAAI,aAAU,mCAAQ;;mBAAM,QAAQ,GAAG,CAAC,aAAa,IAAI,KAAK,EANnD;;;;;AAQd,mCAAG\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_lightweight_functional.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_lightweight_functional.snap new file mode 100644 index 00000000000..7ec5788384c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_lightweight_functional.snap @@ -0,0 +1,168 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 937 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +export const Foo = component$((props) => { + return ( +
+
+ ); +}, { + tagName: "my-foo", +}); + +export function Button({text, color}) { + return ( + + ); +} + +export const ButtonArrow = ({text, color}) => { + return ( + + ); +} + +============================= test.tsx_Foo_component_HTDRsvUbLiE.tsx (ENTRY POINT)== + +import { Button } from "./test"; +import { ButtonArrow } from "./test"; +// +export const Foo_component_HTDRsvUbLiE = (props)=>{ + return
+
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;yCAG8B,CAAC;IAC9B,QACE,IAAI;GACJ,CAAC,QAAQ,GAAG,KAAK,GAAI;GACrB,CAAC,aAAa,GAAG,KAAK,GAAI;EAC3B,EAAE;AAEJ\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 81, + 181 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_Button_button_q_e_click_6YaNiKLqRnQ.tsx (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const Button_button_q_e_click_6YaNiKLqRnQ = ()=>{ + const color = _captures[0], text = _captures[1]; + return console.log(text, color); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;mDAgBqC;;WAAI,QAAQ,GAAG,CAAC,MAAM\"}") +/* +{ + "origin": "test.tsx", + "name": "Button_button_q_e_click_6YaNiKLqRnQ", + "entry": null, + "displayName": "test.tsx_Button_button_q_e_click", + "hash": "6YaNiKLqRnQ", + "canonicalFilename": "test.tsx_Button_button_q_e_click_6YaNiKLqRnQ", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 297, + 325 + ], + "captureNames": [ + "color", + "text" + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_ButtonArrow_button_q_e_click_rEE0GCaea7M = /*#__PURE__*/ qrl(()=>import("./test.tsx_ButtonArrow_button_q_e_click_rEE0GCaea7M"), "ButtonArrow_button_q_e_click_rEE0GCaea7M"); +const q_Button_button_q_e_click_6YaNiKLqRnQ = /*#__PURE__*/ qrl(()=>import("./test.tsx_Button_button_q_e_click_6YaNiKLqRnQ"), "Button_button_q_e_click_6YaNiKLqRnQ"); +const q_Foo_component_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "Foo_component_HTDRsvUbLiE"); +// +export const Foo = /*#__PURE__*/ componentQrl(q_Foo_component_HTDRsvUbLiE, { + tagName: "my-foo" +}); +export function Button({ text, color }) { + return ; +} +export const ButtonArrow = (_rawProps)=>{ + return ; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;AAGA,OAAO,MAAM,oBAAM,0CAOhB;IACF,SAAS;AACV,GAAG;AAEH,OAAO,SAAS,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC;IACnC,QACE,OAAO,WAAU,OAAO;;;SAAyC,OAAO;AAE3E;AAEA,OAAO,MAAM,cAAc;IAC1B,QACE,OAAO,qBAFyB,OAER;;mBAFE,OAE8C;AAE3E,EAAC\"}") +============================= test.tsx_ButtonArrow_button_q_e_click_rEE0GCaea7M.tsx (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const ButtonArrow_button_q_e_click_rEE0GCaea7M = ()=>{ + const _rawProps = _captures[0]; + return console.log(_rawProps.text, _rawProps.color); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;wDAsBqC;;WAAI,QAAQ,GAAG,WAFvB,gBAAM\"}") +/* +{ + "origin": "test.tsx", + "name": "ButtonArrow_button_q_e_click_rEE0GCaea7M", + "entry": null, + "displayName": "test.tsx_ButtonArrow_button_q_e_click", + "hash": "rEE0GCaea7M", + "canonicalFilename": "test.tsx_ButtonArrow_button_q_e_click_rEE0GCaea7M", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": true, + "loc": [ + 445, + 473 + ], + "captureNames": [ + "_rawProps" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_manual_chunks.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_manual_chunks.snap new file mode 100644 index 00000000000..7d54d9cfaac --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_manual_chunks.snap @@ -0,0 +1,279 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1713 +expression: output +--- +==INPUT== + + +import { component$, useTask$, useStore, useStyles$ } from '@qwik.dev/core'; +import mongo from 'mongodb'; +import redis from 'redis'; + +export const Parent = component$(() => { + const state = useStore({ + text: '' + }); + + // Double count watch + useTask$(async () => { + state.text = await mongo.users(); + redis.set(state.text); + }); + + return ( +
console.log('parent')}> + {state.text} +
+ ); +}); + +export const Child = component$(() => { + const state = useStore({ + text: '' + }); + + // Double count watch + useTask$(async () => { + state.text = await mongo.users(); + }); + + return ( +
console.log('child')}> + {state.text} +
+ ); +}); + +============================= test.tsx_Parent_component_useTask_gDH1EtUWqBU.js == + +import { _captures } from "@qwik.dev/core"; +import mongo from "mongodb"; +import redis from "redis"; +// +export const Parent_component_useTask_gDH1EtUWqBU = async ()=>{ + const state = _captures[0]; + state.text = await mongo.users(); + redis.set(state.text); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;oDAWU;;IACR,MAAM,IAAI,GAAG,MAAM,MAAM,KAAK;IAC9B,MAAM,GAAG,CAAC,MAAM,IAAI\"}") +/* +{ + "origin": "test.tsx", + "name": "Parent_component_useTask_gDH1EtUWqBU", + "entry": "test.tsx_entry_Parent", + "displayName": "test.tsx_Parent_component_useTask", + "hash": "gDH1EtUWqBU", + "canonicalFilename": "test.tsx_Parent_component_useTask_gDH1EtUWqBU", + "path": "", + "extension": "js", + "parent": "Parent_component_0TaiDayHrlo", + "ctxKind": "function", + "ctxName": "useTask$", + "captures": true, + "loc": [ + 253, + 330 + ], + "captureNames": [ + "state" + ] +} +*/ +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Child_component_9GyF01GDKqw = /*#__PURE__*/ qrl(()=>import("./test.tsx_Child_component_9GyF01GDKqw"), "Child_component_9GyF01GDKqw"); +const q_Parent_component_0TaiDayHrlo = /*#__PURE__*/ qrl(()=>import("./test.tsx_Parent_component_0TaiDayHrlo"), "Parent_component_0TaiDayHrlo"); +// +export const Parent = /*#__PURE__*/ componentQrl(q_Parent_component_0TaiDayHrlo); +export const Child = /*#__PURE__*/ componentQrl(q_Child_component_9GyF01GDKqw); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AAKA,OAAO,MAAM,uBAAS,6CAgBnB;AAEH,OAAO,MAAM,sBAAQ,4CAelB\"}") +============================= test.tsx_Child_component_useTask_Oh4n7ZeqJkU.js == + +import { _captures } from "@qwik.dev/core"; +import mongo from "mongodb"; +// +export const Child_component_useTask_Oh4n7ZeqJkU = async ()=>{ + const state = _captures[0]; + state.text = await mongo.users(); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;mDA6BU;;IACR,MAAM,IAAI,GAAG,MAAM,MAAM,KAAK\"}") +/* +{ + "origin": "test.tsx", + "name": "Child_component_useTask_Oh4n7ZeqJkU", + "entry": "test.tsx_entry_Child", + "displayName": "test.tsx_Child_component_useTask", + "hash": "Oh4n7ZeqJkU", + "canonicalFilename": "test.tsx_Child_component_useTask_Oh4n7ZeqJkU", + "path": "", + "extension": "js", + "parent": "Child_component_9GyF01GDKqw", + "ctxKind": "function", + "ctxName": "useTask$", + "captures": true, + "loc": [ + 541, + 593 + ], + "captureNames": [ + "state" + ] +} +*/ +============================= test.tsx_Parent_component_0TaiDayHrlo.js == + +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +import { useTaskQrl } from "@qwik.dev/core"; +// +const q_Parent_component_div_q_e_click_zM9okM0TYrA = /*#__PURE__*/ qrl(()=>import("./test.tsx_Parent_component_div_q_e_click_zM9okM0TYrA"), "Parent_component_div_q_e_click_zM9okM0TYrA"); +const q_Parent_component_useTask_gDH1EtUWqBU = /*#__PURE__*/ qrl(()=>import("./test.tsx_Parent_component_useTask_gDH1EtUWqBU"), "Parent_component_useTask_gDH1EtUWqBU"); +// +export const Parent_component_0TaiDayHrlo = ()=>{ + const state = useStore({ + text: '' + }); + // Double count watch + useTaskQrl(q_Parent_component_useTask_gDH1EtUWqBU.w([ + state + ])); + return /*#__PURE__*/ _jsxSorted("div", null, { + "q-e:click": q_Parent_component_div_q_e_click_zM9okM0TYrA + }, _wrapProp(state, "text"), 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;4CAKiC;IAChC,MAAM,QAAQ,SAAS;QACtB,MAAM;IACP;IAEA,qBAAqB;IACrB;;;IAKA,qBACC,WAAC;QAAI,WAAQ;iBACX;AAGJ\"}") +/* +{ + "origin": "test.tsx", + "name": "Parent_component_0TaiDayHrlo", + "entry": "test.tsx_entry_Parent", + "displayName": "test.tsx_Parent_component", + "hash": "0TaiDayHrlo", + "canonicalFilename": "test.tsx_Parent_component_0TaiDayHrlo", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 169, + 421 + ] +} +*/ +============================= test.tsx_Child_component_div_q_e_click_cROa4sult1s.js (ENTRY POINT)== + +export const Child_component_div_q_e_click_cROa4sult1s = ()=>console.log('child'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"yDAkCiB,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Child_component_div_q_e_click_cROa4sult1s", + "entry": null, + "displayName": "test.tsx_Child_component_div_q_e_click", + "hash": "cROa4sult1s", + "canonicalFilename": "test.tsx_Child_component_div_q_e_click_cROa4sult1s", + "path": "", + "extension": "js", + "parent": "Child_component_9GyF01GDKqw", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 624, + 650 + ] +} +*/ +============================= test.tsx_Child_component_9GyF01GDKqw.js == + +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +import { useTaskQrl } from "@qwik.dev/core"; +// +const q_Child_component_div_q_e_click_cROa4sult1s = /*#__PURE__*/ qrl(()=>import("./test.tsx_Child_component_div_q_e_click_cROa4sult1s"), "Child_component_div_q_e_click_cROa4sult1s"); +const q_Child_component_useTask_Oh4n7ZeqJkU = /*#__PURE__*/ qrl(()=>import("./test.tsx_Child_component_useTask_Oh4n7ZeqJkU"), "Child_component_useTask_Oh4n7ZeqJkU"); +// +export const Child_component_9GyF01GDKqw = ()=>{ + const state = useStore({ + text: '' + }); + // Double count watch + useTaskQrl(q_Child_component_useTask_Oh4n7ZeqJkU.w([ + state + ])); + return /*#__PURE__*/ _jsxSorted("div", null, { + "q-e:click": q_Child_component_div_q_e_click_cROa4sult1s + }, _wrapProp(state, "text"), 3, "u6_1"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;2CAuBgC;IAC/B,MAAM,QAAQ,SAAS;QACtB,MAAM;IACP;IAEA,qBAAqB;IACrB;;;IAIA,qBACC,WAAC;QAAI,WAAQ;iBACX;AAGJ\"}") +/* +{ + "origin": "test.tsx", + "name": "Child_component_9GyF01GDKqw", + "entry": "test.tsx_entry_Child", + "displayName": "test.tsx_Child_component", + "hash": "9GyF01GDKqw", + "canonicalFilename": "test.tsx_Child_component_9GyF01GDKqw", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 457, + 683 + ] +} +*/ +============================= test.tsx_Parent_component_div_q_e_click_zM9okM0TYrA.js (ENTRY POINT)== + +export const Parent_component_div_q_e_click_zM9okM0TYrA = ()=>console.log('parent'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"0DAiBiB,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "Parent_component_div_q_e_click_zM9okM0TYrA", + "entry": null, + "displayName": "test.tsx_Parent_component_div_q_e_click", + "hash": "zM9okM0TYrA", + "canonicalFilename": "test.tsx_Parent_component_div_q_e_click_zM9okM0TYrA", + "path": "", + "extension": "js", + "parent": "Parent_component_0TaiDayHrlo", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 361, + 388 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_missing_custom_inlined_functions.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_missing_custom_inlined_functions.snap new file mode 100644 index 00000000000..42fb1cb59cf --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_missing_custom_inlined_functions.snap @@ -0,0 +1,68 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1343 +expression: output +--- +==INPUT== + + +import { component$ as Component, $ as onRender, useStore, wrap, useEffect } from '@qwik.dev/core'; + + +export const useMemo$ = (qrt) => { + useEffect(qrt); +}; + +export const App = component$((props) => { + const state = useStore({count: 0}); + useMemo$(() => { + console.log(state.count); + }); + return $(() => ( +
{state.count}
+ )); +}); + +============================= test.js == + +import { _wrapProp } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { useStore, useEffect } from '@qwik.dev/core'; +// +export const useMemo$ = (qrt)=>{ + useEffect(qrt); +}; +export const App = component$((props)=>{ + const state = useStore({ + count: 0 + }); + useMemo$(()=>{ + console.log(state.count); + }); + return $(()=>/*#__PURE__*/ _jsxSorted("div", null, null, _wrapProp(state, "count"), 3, "u6_0")); +}); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;AACA,SAAiD,QAAQ,EAAQ,SAAS,QAAQ,iBAAiB;;AAGnG,OAAO,MAAM,WAAW,CAAC;IACxB,UAAU;AACX,EAAE;AAEF,OAAO,MAAM,MAAM,WAAW,CAAC;IAC9B,MAAM,QAAQ,SAAS;QAAC,OAAO;IAAC;IAChC,SAAS;QACR,QAAQ,GAAG,CAAC,MAAM,KAAK;IACxB;IACA,OAAO,EAAE,kBACR,WAAC,6BAAK;AAER,GAAG\"}") +== DIAGNOSTICS == + +[ + { + "category": "error", + "code": "C05", + "file": "test.tsx", + "message": "Found 'useMemo$' but did not find the corresponding 'useMemoQrl' exported in the same file. Please check that it is exported and spelled correctly", + "highlights": [ + { + "lo": 241, + "hi": 249, + "startLine": 11, + "startCol": 5, + "endLine": 11, + "endCol": 12 + } + ], + "suggestions": null, + "scope": "optimizer" + } +] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_multi_capture.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_multi_capture.snap new file mode 100644 index 00000000000..5d48d09df29 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_multi_capture.snap @@ -0,0 +1,195 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 416 +expression: output +--- +==INPUT== + + +import { $, component$ } from '@qwik.dev/core'; + +export const Foo = component$(({foo}) => { + const arg0 = 20; + return $(() => { + const fn = ({aaa}) => aaa; + return ( +
+ {foo}{fn()}{arg0} +
+ ) + }); +}) + +export const Bar = component$(({bar}) => { + return $(() => { + return ( +
+ {bar} +
+ ) + }); +}) + +============================= test.tsx_Foo_component_HTDRsvUbLiE.jsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_1_DvU6FitWglY = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_1_DvU6FitWglY"), "Foo_component_1_DvU6FitWglY"); +// +export const Foo_component_HTDRsvUbLiE = (_rawProps)=>{ + return q_Foo_component_1_DvU6FitWglY.w([ + _rawProps + ]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;yCAG8B;IAE7B;;;AAQD\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "jsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 81, + 221 + ], + "paramNames": [ + "_rawProps" + ] +} +*/ +============================= test.jsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Bar_component_L80pS8Hxf1Y = /*#__PURE__*/ qrl(()=>import("./test.tsx_Bar_component_L80pS8Hxf1Y"), "Bar_component_L80pS8Hxf1Y"); +const q_Foo_component_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "Foo_component_HTDRsvUbLiE"); +// +export const Foo = /*#__PURE__*/ componentQrl(q_Foo_component_HTDRsvUbLiE); +export const Bar = /*#__PURE__*/ componentQrl(q_Bar_component_L80pS8Hxf1Y); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;AAGA,OAAO,MAAM,oBAAM,0CAUjB;AAEF,OAAO,MAAM,oBAAM,0CAQjB\"}") +============================= test.tsx_Bar_component_L80pS8Hxf1Y.jsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_Bar_component_1_0xSyNSnVu3k = /*#__PURE__*/ qrl(()=>import("./test.tsx_Bar_component_1_0xSyNSnVu3k"), "Bar_component_1_0xSyNSnVu3k"); +// +export const Bar_component_L80pS8Hxf1Y = (_rawProps)=>{ + return q_Bar_component_1_0xSyNSnVu3k.w([ + _rawProps + ]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;yCAe8B;IAC7B;;;AAOD\"}") +/* +{ + "origin": "test.tsx", + "name": "Bar_component_L80pS8Hxf1Y", + "entry": null, + "displayName": "test.tsx_Bar_component", + "hash": "L80pS8Hxf1Y", + "canonicalFilename": "test.tsx_Bar_component_L80pS8Hxf1Y", + "path": "", + "extension": "jsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 254, + 335 + ], + "paramNames": [ + "_rawProps" + ] +} +*/ +============================= test.tsx_Foo_component_1_DvU6FitWglY.jsx (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const Foo_component_1_DvU6FitWglY = ()=>{ + const _rawProps = _captures[0]; + const fn = ({ aaa })=>aaa; + return
+ {_rawProps.foo}{fn()}{20} +
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;2CAKU;;IACR,MAAM,KAAK,CAAC,EAAC,GAAG,EAAC,GAAK;IACtB,QACE,IAAI;IACJ,WAN4B,KAMtB,MALI,GAKO;GAClB,EAAE\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_1_DvU6FitWglY", + "entry": null, + "displayName": "test.tsx_Foo_component_1", + "hash": "DvU6FitWglY", + "canonicalFilename": "test.tsx_Foo_component_1_DvU6FitWglY", + "path": "", + "extension": "jsx", + "parent": "Foo_component_HTDRsvUbLiE", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 122, + 217 + ], + "captureNames": [ + "_rawProps" + ] +} +*/ +============================= test.tsx_Bar_component_1_0xSyNSnVu3k.jsx (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const Bar_component_1_0xSyNSnVu3k = ()=>{ + const _rawProps = _captures[0]; + return
+ {_rawProps.bar} +
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;2CAgBU;;IACR,QACE,IAAI;IACJ,WAJ4B,IAIvB;GACN,EAAE\"}") +/* +{ + "origin": "test.tsx", + "name": "Bar_component_1_0xSyNSnVu3k", + "entry": null, + "displayName": "test.tsx_Bar_component_1", + "hash": "0xSyNSnVu3k", + "canonicalFilename": "test.tsx_Bar_component_1_0xSyNSnVu3k", + "path": "", + "extension": "jsx", + "parent": "Bar_component_L80pS8Hxf1Y", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 277, + 331 + ], + "captureNames": [ + "_rawProps" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_mutable_children.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_mutable_children.snap new file mode 100644 index 00000000000..9875d128a1f --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_mutable_children.snap @@ -0,0 +1,200 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2496 +expression: output +--- +==INPUT== + + +import { component$, useStore, Slot, Fragment } from '@qwik.dev/core'; +import Image from './image.jpg?jsx'; + +export function Fn1(props: Stuff) { + return ( + <> +
{prop < 2 ?

1

: 2}
+ + ); +} + +export function Fn2(props: Stuff) { + return ( +
{prop.value && }
+ ); +} + +export function Fn3(props: Stuff) { + if (prop.value) { + return ( + + ); + } + return ( +
+ ); +} + +export function Fn4(props: Stuff) { + if (prop.value) { + return ( +
+ ); + } + return ( + + ); +} + +export const Arrow = (props: Stuff) =>
{prop < 2 ?

1

: 2}
; + +export const AppDynamic1 = component$((props: Stuff) => { + return ( + <> +
{prop < 2 ?

1

: 2}
+ + ); +}); +export const AppDynamic2 = component$((props: Stuff) => { + return ( +
{prop.value && }
+ ); +}); + +export const AppDynamic3 = component$((props: Stuff) => { + if (prop.value) { + return ( + + ); + } + return ( +
+ ); +}); + +export const AppDynamic4 = component$((props: Stuff) => { + if (prop.value) { + return ( +
+ ); + } + return ( + + ); +}); + +export const AppStatic = component$((props: Stuff) => { + return ( + <> +
Static {f ? 1 : 3}
+
{prop < 2 ?

1

:

2

}
+ +
{prop.value &&
}
+
{prop.value && }
+
{prop.value && <>
}
+
{prop.value && }
+
Static {f ? 1 : 3}
+
Static
+
Static {props.value}
+
Static {stuff()}
+
Static {stuff()}
+ + ); +}); + +============================= test.js == + +import { _jsxSorted } from "@qwik.dev/core"; +import { componentQrl } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { Slot, Fragment } from '@qwik.dev/core'; +import Image from './image.jpg?jsx'; +// +const q_AppDynamic1_component_R00UJ05gbes = /*#__PURE__*/ _noopQrl("AppDynamic1_component_R00UJ05gbes"); +const q_AppDynamic2_component_3EY2zm0v00A = /*#__PURE__*/ _noopQrl("AppDynamic2_component_3EY2zm0v00A"); +const q_AppDynamic3_component_FVq83NlbTDQ = /*#__PURE__*/ _noopQrl("AppDynamic3_component_FVq83NlbTDQ"); +const q_AppDynamic4_component_IO0yr8UvWEI = /*#__PURE__*/ _noopQrl("AppDynamic4_component_IO0yr8UvWEI"); +const q_AppStatic_component_gYRXqF3G5nE = /*#__PURE__*/ _noopQrl("AppStatic_component_gYRXqF3G5nE"); +// +export function Fn1(props) { + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, /*#__PURE__*/ _jsxSorted("div", null, null, prop < 2 ? /*#__PURE__*/ _jsxSorted("p", null, null, "1", 3, "u6_0") : /*#__PURE__*/ _jsxSorted(Stuff, null, null, "2", 3, "u6_1"), 1, null), 1, "u6_2"); +} +export function Fn2(props) { + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + prop.value && /*#__PURE__*/ _jsxSorted(Stuff, null, null, null, 3, "u6_3"), + /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, null) + ], 1, "u6_4"); +} +export function Fn3(props) { + if (prop.value) return /*#__PURE__*/ _jsxSorted(Stuff, null, null, null, 3, "u6_5"); + return /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_6"); +} +export function Fn4(props) { + if (prop.value) return /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_7"); + return /*#__PURE__*/ _jsxSorted(Stuff, null, null, null, 3, "u6_8"); +} +export const Arrow = (props)=>/*#__PURE__*/ _jsxSorted("div", null, null, prop < 2 ? /*#__PURE__*/ _jsxSorted("p", null, null, "1", 3, "u6_9") : /*#__PURE__*/ _jsxSorted(Stuff, null, null, "2", 3, "u6_10"), 1, "u6_11"); +const AppDynamic1_component_R00UJ05gbes = (props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, /*#__PURE__*/ _jsxSorted("div", null, null, prop < 2 ? /*#__PURE__*/ _jsxSorted("p", null, null, "1", 3, "u6_12") : /*#__PURE__*/ _jsxSorted(Stuff, null, null, "2", 3, "u6_13"), 1, null), 1, "u6_14"); +}; +q_AppDynamic1_component_R00UJ05gbes.s(AppDynamic1_component_R00UJ05gbes); +export const AppDynamic1 = /*#__PURE__*/ componentQrl(q_AppDynamic1_component_R00UJ05gbes); +const AppDynamic2_component_3EY2zm0v00A = (props)=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + prop.value && /*#__PURE__*/ _jsxSorted(Stuff, null, null, null, 3, "u6_15"), + /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, null) + ], 1, "u6_16"); +}; +q_AppDynamic2_component_3EY2zm0v00A.s(AppDynamic2_component_3EY2zm0v00A); +export const AppDynamic2 = /*#__PURE__*/ componentQrl(q_AppDynamic2_component_3EY2zm0v00A); +const AppDynamic3_component_FVq83NlbTDQ = (props)=>{ + if (prop.value) return /*#__PURE__*/ _jsxSorted(Stuff, null, null, null, 3, "u6_17"); + return /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_18"); +}; +q_AppDynamic3_component_FVq83NlbTDQ.s(AppDynamic3_component_FVq83NlbTDQ); +export const AppDynamic3 = /*#__PURE__*/ componentQrl(q_AppDynamic3_component_FVq83NlbTDQ); +const AppDynamic4_component_IO0yr8UvWEI = (props)=>{ + if (prop.value) return /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_19"); + return /*#__PURE__*/ _jsxSorted(Stuff, null, null, null, 3, "u6_20"); +}; +q_AppDynamic4_component_IO0yr8UvWEI.s(AppDynamic4_component_IO0yr8UvWEI); +export const AppDynamic4 = /*#__PURE__*/ componentQrl(q_AppDynamic4_component_IO0yr8UvWEI); +const AppStatic_component_gYRXqF3G5nE = (props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "Static ", + f ? 1 : 3 + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, prop < 2 ? /*#__PURE__*/ _jsxSorted("p", null, null, "1", 3, "u6_21") : /*#__PURE__*/ _jsxSorted("p", null, null, "2", 3, "u6_22"), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, prop.value && /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_23"), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, prop.value && /*#__PURE__*/ _jsxSorted(Fragment, null, null, /*#__PURE__*/ _jsxSorted(Slot, null, null, null, 3, "u6_24"), 1, "u6_25"), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, prop.value && /*#__PURE__*/ _jsxSorted(_Fragment, null, null, /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, null), 3, "u6_26"), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, prop.value && /*#__PURE__*/ _jsxSorted(Image, null, null, null, 3, "u6_27"), 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "Static ", + f ? 1 : 3 + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, "Static", 3, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "Static ", + _wrapProp(props) + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "Static ", + stuff() + ], 1, null), + /*#__PURE__*/ _jsxSorted("div", null, null, [ + "Static ", + stuff() + ], 1, null) + ], 1, "u6_28"); +}; +q_AppStatic_component_gYRXqF3G5nE.s(AppStatic_component_gYRXqF3G5nE); +export const AppStatic = /*#__PURE__*/ componentQrl(q_AppStatic_component_gYRXqF3G5nE); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAA+B,IAAI,EAAE,QAAQ,QAAQ,iBAAiB;AACtE,OAAO,WAAW,kBAAkB;;;;;;;;AAEpC,OAAO,SAAS,IAAI,KAAY;IAC/B,qBACC,gDACC,WAAC,mBAAK,OAAO,kBAAI,WAAC,iBAAE,gCAAQ,WAAC,mBAAM;AAGtC;AAEA,OAAO,SAAS,IAAI,KAAY;IAC/B,qBACC,WAAC;QAAK,KAAK,KAAK,kBAAI,WAAC;sBAAe,WAAC;;AAEvC;AAEA,OAAO,SAAS,IAAI,KAAY;IAC/B,IAAI,KAAK,KAAK,EACb,qBACC,WAAC;IAGH,qBACC,WAAC;AAEH;AAEA,OAAO,SAAS,IAAI,KAAY;IAC/B,IAAI,KAAK,KAAK,EACb,qBACC,WAAC;IAGH,qBACC,WAAC;AAEH;AAEA,OAAO,MAAM,QAAQ,CAAC,sBAAiB,WAAC,mBAAK,OAAO,kBAAI,WAAC,iBAAE,gCAAQ,WAAC,mBAAM,8BAAiB;0CAErD,CAAC;IACtC,qBACC,gDACC,WAAC,mBAAK,OAAO,kBAAI,WAAC,iBAAE,iCAAQ,WAAC,mBAAM;AAGtC;;AANA,OAAO,MAAM,4BAAc,kDAMxB;0CACmC,CAAC;IACtC,qBACC,WAAC;QAAK,KAAK,KAAK,kBAAI,WAAC;sBAAe,WAAC;;AAEvC;;AAJA,OAAO,MAAM,4BAAc,kDAIxB;0CAEmC,CAAC;IACtC,IAAI,KAAK,KAAK,EACb,qBACC,WAAC;IAGH,qBACC,WAAC;AAEH;;AATA,OAAO,MAAM,4BAAc,kDASxB;0CAEmC,CAAC;IACtC,IAAI,KAAK,KAAK,EACb,qBACC,WAAC;IAGH,qBACC,WAAC;AAEH;;AATA,OAAO,MAAM,4BAAc,kDASxB;wCAEiC,CAAC;IACpC,qBACC;sBACC,WAAC;YAAI;YAAQ,IAAI,IAAI;;sBACrB,WAAC,mBAAK,OAAO,kBAAI,WAAC,iBAAE,iCAAQ,WAAC,iBAAE;sBAE/B,WAAC,mBAAK,KAAK,KAAK,kBAAI,WAAC;sBACrB,WAAC,mBAAK,KAAK,KAAK,kBAAI,WAAC,oCAAS,WAAC;sBAC/B,WAAC,mBAAK,KAAK,KAAK,kBAAI,gDAAE,WAAC;sBACvB,WAAC,mBAAK,KAAK,KAAK,kBAAI,WAAC;sBACrB,WAAC;YAAI;YAAQ,IAAI,IAAI;;sBACrB,WAAC,mBAAI;sBACL,WAAC;YAAI;sBAAQ;;sBACb,WAAC;YAAI;YAAQ;;sBACb,WAAC;YAAI;YAAQ;;;AAGhB;;AAjBA,OAAO,MAAM,0BAAY,gDAiBtB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_noop_dev_mode.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_noop_dev_mode.snap new file mode 100644 index 00000000000..97594577c93 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_noop_dev_mode.snap @@ -0,0 +1,235 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3813 +expression: output +--- +==INPUT== + + +import { component$, useStore, serverStuff$, $ } from '@qwik.dev/core'; + +export const App = component$(() => { + const stuff = useStore(); + serverStuff$(async () => { + // should be removed but keep scope + console.log(stuff.count) + }) + serverStuff$(async () => { + // should be removed + }) + + return ( + +

stuff.count} + onClick$={() => console.log('warn')} + > + Hello Qwik +

+
+ ); +}); + +============================= test.tsx_App_component_serverStuff_ebyHaP15ytQ.js (ENTRY POINT)== + +export const App_component_serverStuff_ebyHaP15ytQ = null; + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_serverStuff_ebyHaP15ytQ", + "entry": null, + "displayName": "test.tsx_App_component_serverStuff", + "hash": "ebyHaP15ytQ", + "canonicalFilename": "test.tsx_App_component_serverStuff_ebyHaP15ytQ", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "serverStuff$", + "captures": true, + "loc": [ + 0, + 0 + ], + "captureNames": [ + "stuff" + ] +} +*/ +============================= test.tsx_App_component_serverStuff_1_PQCqO0ANabY.js (ENTRY POINT)== + +export const App_component_serverStuff_1_PQCqO0ANabY = null; + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_serverStuff_1_PQCqO0ANabY", + "entry": null, + "displayName": "test.tsx_App_component_serverStuff_1", + "hash": "PQCqO0ANabY", + "canonicalFilename": "test.tsx_App_component_serverStuff_1_PQCqO0ANabY", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "function", + "ctxName": "serverStuff$", + "captures": false, + "loc": [ + 0, + 0 + ] +} +*/ +============================= test.tsx_App_component_Cmp_p_shouldRemove_uU0MG0jvQD4.js (ENTRY POINT)== + +export const App_component_Cmp_p_shouldRemove_uU0MG0jvQD4 = null; + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_Cmp_p_shouldRemove_uU0MG0jvQD4", + "entry": null, + "displayName": "test.tsx_App_component_Cmp_p_shouldRemove", + "hash": "uU0MG0jvQD4", + "canonicalFilename": "test.tsx_App_component_Cmp_p_shouldRemove_uU0MG0jvQD4", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "shouldRemove$", + "captures": false, + "loc": [ + 0, + 0 + ] +} +*/ +============================= test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4.js (ENTRY POINT)== + +export const App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 = null; + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", + "entry": null, + "displayName": "test.tsx_App_component_Cmp_p_q_e_click", + "hash": "Yl4ybrJWrt4", + "canonicalFilename": "test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 0, + 0 + ] +} +*/ +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrlDEV } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrlDEV(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0", { + file: "/hello/from/dev/test.tsx", + lo: 105, + hi: 452, + displayName: "test.tsx_App_component" +}); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;AAGA,OAAO,MAAM,oBAAM,0CAoBhB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrlDEV } from "@qwik.dev/core"; +import { serverStuffQrl } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +// +const q_qrl_4294901760 = /*#__PURE__*/ _noopQrlDEV("App_component_serverStuff_ebyHaP15ytQ", { + file: "/hello/from/dev/test.tsx", + lo: 0, + hi: 0, + displayName: "test.tsx_App_component_serverStuff" +}); +const q_qrl_4294901762 = /*#__PURE__*/ _noopQrlDEV("App_component_serverStuff_1_PQCqO0ANabY", { + file: "/hello/from/dev/test.tsx", + lo: 0, + hi: 0, + displayName: "test.tsx_App_component_serverStuff_1" +}); +const q_qrl_4294901764 = /*#__PURE__*/ _noopQrlDEV("App_component_Cmp_p_shouldRemove_uU0MG0jvQD4", { + file: "/hello/from/dev/test.tsx", + lo: 0, + hi: 0, + displayName: "test.tsx_App_component_Cmp_p_shouldRemove" +}); +const q_qrl_4294901766 = /*#__PURE__*/ _noopQrlDEV("App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", { + file: "/hello/from/dev/test.tsx", + lo: 0, + hi: 0, + displayName: "test.tsx_App_component_Cmp_p_q_e_click" +}); +// +export const App_component_ckEPmXZlub0 = ()=>{ + const stuff = useStore(); + serverStuffQrl(q_qrl_4294901760.w([ + stuff + ])); + serverStuffQrl(q_qrl_4294901762); + return /*#__PURE__*/ _jsxSorted(Cmp, null, null, /*#__PURE__*/ _jsxSorted("p", { + "q:p": stuff + }, { + class: "stuff", + shouldRemove$: q_qrl_4294901764, + "q-e:click": q_qrl_4294901766 + }, "Hello Qwik", 7, null, { + fileName: "/hello/from/dev/test.tsx", + lineNumber: 16, + columnNumber: 4 + }), 1, "u6_0", { + fileName: "/hello/from/dev/test.tsx", + lineNumber: 15, + columnNumber: 3 + }); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAG8B;IAC7B,MAAM,QAAQ;IACd;;;IAIA;IAIA,qBACC,WAAC,+BACA,WAAC;;;QAAE,OAAM;QACR,aAAa;QACb,WAAQ;OACR;;;;;;;;;AAKJ\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 105, + 452 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_of_synchronous_qrl.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_of_synchronous_qrl.snap new file mode 100644 index 00000000000..07ce298adf3 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_of_synchronous_qrl.snap @@ -0,0 +1,86 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3592 +expression: output +--- +==INPUT== + + + import { sync$, component$ } from "@qwik.dev/core"; + + export default component$(() => { + return ( + <> + + { + event.preventDefault(); + })}/> + event.preventDefault())}/> + + ); + }); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_test_component_LUXeXe0DQrg = /*#__PURE__*/ qrl(()=>import("./test.tsx_test_component_LUXeXe0DQrg"), "test_component_LUXeXe0DQrg"); +// +export default /*#__PURE__*/ componentQrl(q_test_component_LUXeXe0DQrg); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGE,6BAAe,2CAaZ\"}") +============================= test.tsx_test_component_LUXeXe0DQrg.js (ENTRY POINT)== + +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _qrlSync } from "@qwik.dev/core"; +// +export const test_component_LUXeXe0DQrg = ()=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("input", { + "q-e:click": _qrlSync(function(event, target) { + // comment should be removed + event.preventDefault(); + }, "function(event,target){event.preventDefault();}") + }, null, null, 2, null), + /*#__PURE__*/ _jsxSorted("input", { + "q-e:click": _qrlSync((event, target)=>{ + event.preventDefault(); + }, "(event,target)=>{event.preventDefault();}") + }, null, null, 2, null), + /*#__PURE__*/ _jsxSorted("input", { + "q-e:click": _qrlSync((event, target)=>event.preventDefault(), "(event,target)=>event.preventDefault()") + }, null, null, 2, null) + ], 1, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;0CAG4B;IAC1B,qBACC;sBACC,WAAC;YAAM,WAAQ,WAAQ,SAAS,KAAK,EAAE,MAAM;gBAC5C,4BAA4B;gBAC5B,MAAM,cAAc;YACrB;;sBACA,WAAC;YAAM,WAAQ,WAAQ,CAAC,OAAO;gBAC9B,MAAM,cAAc;YACrB;;sBACA,WAAC;YAAM,WAAQ,WAAQ,CAAC,OAAO,SAAW,MAAM,cAAc;;;AAGhE\"}") +/* +{ + "origin": "test.tsx", + "name": "test_component_LUXeXe0DQrg", + "entry": null, + "displayName": "test.tsx_test_component", + "hash": "LUXeXe0DQrg", + "canonicalFilename": "test.tsx_test_component_LUXeXe0DQrg", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 85, + 411 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3542.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3542.snap new file mode 100644 index 00000000000..ae02acad1ec --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3542.snap @@ -0,0 +1,58 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 769 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export const AtomStatus = component$(({ctx,atom})=>{ + let status = atom.status; + if(!atom.real) { + status="WILL-VANISH" + } else if (JSON.stringify(atom.atom)==JSON.stringify(atom.real)) { + status="WTFED" + } + return ( + atomStatusClick(ctx,ev,[atom])} class={["atom",status,ctx.store[atom.ID]?"selected":null]}> + + ); +}) + +============================= test.jsx == + +import { componentQrl } from "@qwik.dev/core"; +import { _captures } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +// +const q_AtomStatus_component_hdwpoUtydSA = /*#__PURE__*/ _noopQrl("AtomStatus_component_hdwpoUtydSA"); +const q_AtomStatus_component_span_q_e_click_0yqKAycyBF0 = /*#__PURE__*/ _noopQrl("AtomStatus_component_span_q_e_click_0yqKAycyBF0"); +// +q_AtomStatus_component_span_q_e_click_0yqKAycyBF0.s((ev)=>{ + const _rawProps = _captures[0]; + return atomStatusClick(_rawProps.ctx, ev, [ + _rawProps.atom + ]); +}); +q_AtomStatus_component_hdwpoUtydSA.s((_rawProps)=>{ + let status = _rawProps.atom.status; + if (!_rawProps.atom.real) status = "WILL-VANISH"; + else if (JSON.stringify(_rawProps.atom.atom) == JSON.stringify(_rawProps.atom.real)) status = "WTFED"; + return + ; +}); +export const AtomStatus = /*#__PURE__*/ componentQrl(q_AtomStatus_component_hdwpoUtydSA); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;oDAWkC,CAAC;;WAAK,0BARD,KAQqB,IAAG;kBARpB;KAQ0B;;qCARhC;IACpC,IAAI,SAAS,UAD6B,KACxB,MAAM;IACxB,IAAG,CAAC,UAFsC,KAEjC,IAAI,EACZ,SAAO;SACD,IAAI,KAAK,SAAS,CAAC,UAJgB,KAIX,IAAI,KAAG,KAAK,SAAS,CAAC,UAJX,KAIgB,IAAI,GAC7D,SAAO;IAER,QACE,KAAK,OAAO,UAR4B,KAQvB,EAAE,EAAE;;QAAgD,OAAO;QAAC;QAAO;QAAO,UARvD,IAQ2D,KAAK,CAAC,UAR7D,KAQkE,EAAE,CAAC,GAAC,aAAW;KAAK,EAAE;EACjI,EAAE;AAEJ;AAXA,OAAO,MAAM,2BAAa,iDAWxB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3561.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3561.snap new file mode 100644 index 00000000000..2c7b054f64c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3561.snap @@ -0,0 +1,57 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 707 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export const Issue3561 = component$(() => { + const props = useStore({ + product: { + currentVariant: { + variantImage: 'image', + variantNumber: 'number', + setContents: 'contents', + }, + }, + }); + const { + currentVariant: { variantImage, variantNumber, setContents } = {}, + } = props.product; + + console.log(variantImage, variantNumber, setContents) + + return

; + }); + +============================= test.jsx == + +import { componentQrl } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +// +const q_Issue3561_component_hHTw654BZB8 = /*#__PURE__*/ _noopQrl("Issue3561_component_hHTw654BZB8"); +// +q_Issue3561_component_hHTw654BZB8.s(()=>{ + const props = useStore({ + product: { + currentVariant: { + variantImage: 'image', + variantNumber: 'number', + setContents: 'contents' + } + } + }); + const { currentVariant: { variantImage, variantNumber, setContents } = {} } = props.product; + console.log(variantImage, variantNumber, setContents); + return

; +}); +export const Issue3561 = /*#__PURE__*/ componentQrl(q_Issue3561_component_hHTw654BZB8); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;oCAGoC;IACnC,MAAM,QAAQ,SAAS;QACtB,SAAS;YACT,gBAAgB;gBACf,cAAc;gBACd,eAAe;gBACf,aAAa;YACd;QACA;IACD;IACA,MAAM,EACL,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC,EACjE,GAAG,MAAM,OAAO;IAEjB,QAAQ,GAAG,CAAC,cAAc,eAAe;IAEzC,QAAQ,IAAI;AACZ;AAjBD,OAAO,MAAM,0BAAY,gDAiBrB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3795.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3795.snap new file mode 100644 index 00000000000..f5e9ba7f713 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_3795.snap @@ -0,0 +1,48 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 797 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export const Issue3795 = component$(() => { + let base = "foo"; + const firstAssignment = base; + base += "bar"; + const secondAssignment = base; + return ( +
{firstAssignment} {secondAssignment}
+ ) + }); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +// +const q_Issue3795_component_wsE8beycatI = /*#__PURE__*/ _noopQrl("Issue3795_component_wsE8beycatI"); +// +q_Issue3795_component_wsE8beycatI.s(()=>{ + let base = "foo"; + const firstAssignment = base; + base += "bar"; + const secondAssignment = base; + return /*#__PURE__*/ _jsxSorted("div", null, { + id: "issue-3795-result" + }, [ + firstAssignment, + " ", + secondAssignment + ], 1, "u6_0"); +}); +export const Issue3795 = /*#__PURE__*/ componentQrl(q_Issue3795_component_wsE8beycatI); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;oCAGoC;IACnC,IAAI,OAAO;IACX,MAAM,kBAAkB;IACxB,QAAQ;IACR,MAAM,mBAAmB;IACzB,qBACC,WAAC;QAAI,IAAG;;QAAqB;QAAgB;QAAE;;AAEhD;AARD,OAAO,MAAM,0BAAY,gDAQrB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_4386.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_4386.snap new file mode 100644 index 00000000000..9861e899b82 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_optimization_issue_4386.snap @@ -0,0 +1,45 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 741 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export const FOO_MAPPING = { + A: 1, + B: 2, + C: 3, + }; + + export default component$(() => { + const key = 'A'; + const value = FOO_MAPPING[key]; + + return <>{value}; + }); + +============================= test.jsx == + +import { componentQrl } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +// +const q_test_component_LUXeXe0DQrg = /*#__PURE__*/ _noopQrl("test_component_LUXeXe0DQrg"); +// +export const FOO_MAPPING = { + A: 1, + B: 2, + C: 3 +}; +q_test_component_LUXeXe0DQrg.s(()=>{ + return <>{FOO_MAPPING['A']}; +}); +export default /*#__PURE__*/ componentQrl(q_test_component_LUXeXe0DQrg); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,cAAc;IAC1B,GAAG;IACH,GAAG;IACH,GAAG;AACH,EAAE;+BAEwB;IAI1B,UAFc,WAAW,CADb,IACkB;AAG9B;AALA,6BAAe,2CAKZ\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_parsed_inlined_qrls.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_parsed_inlined_qrls.snap new file mode 100644 index 00000000000..5dc610f2fba --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_parsed_inlined_qrls.snap @@ -0,0 +1,87 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1615 +expression: output +--- +==INPUT== + + +import { componentQrl, inlinedQrl, useStore, jsxs, jsx, useLexicalScope } from '@qwik.dev/core'; + +export const App = /*#__PURE__*/ componentQrl(inlinedQrl(()=>{ + useStyles$(inlinedQrl(STYLES, "STYLES_odz7dfdfdM")); + useStyles$(inlinedQrl(STYLES, "STYLES_odzdfdfdM")); + + const store = useStore({ + count: 0 + }); + return /*#__PURE__*/ jsxs("div", { + children: [ + /*#__PURE__*/ jsxs("p", { + children: [ + "Count: ", + store.count + ] + }), + /*#__PURE__*/ jsx("p", { + children: /*#__PURE__*/ jsx("button", { + onClick$: inlinedQrl(()=>{ + const [store] = useLexicalScope(); + return store.count++; + }, "App_component_div_p_button_onClick_odz7eidI4GM", [ + store + ]), + children: "Click" + }) + }) + ] + }); +}, "App_component_Fh88JClhbC0")); + +export const STYLES = ".red { color: red; }"; + + +============================= test.tsx == + +import { _noopQrl } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { componentQrl, useStore, useLexicalScope } from '@qwik.dev/core'; +// +const q_s_Fh88JClhbC0 = /*#__PURE__*/ _noopQrl("s_Fh88JClhbC0"); +const q_s_odz7dfdfdM = /*#__PURE__*/ _noopQrl("s_odz7dfdfdM"); +const q_s_odz7eidI4GM = /*#__PURE__*/ _noopQrl("s_odz7eidI4GM"); +const q_s_odzdfdfdM = /*#__PURE__*/ _noopQrl("s_odzdfdfdM"); +// +q_s_odz7eidI4GM.s(()=>{ + const [store] = useLexicalScope(); + return store.count++; +}); +q_s_Fh88JClhbC0.s(()=>{ + useStyles$(q_s_odz7dfdfdM); + useStyles$(q_s_odzdfdfdM); + const store = useStore({ + count: 0 + }); + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + /*#__PURE__*/ _jsxSorted("p", null, null, [ + "Count: ", + _wrapProp(store, "count") + ], 3, null), + /*#__PURE__*/ _jsxSorted("p", null, null, /*#__PURE__*/ _jsxSorted("button", { + "q-e:click": q_s_odz7eidI4GM.w([ + store + ]) + }, null, "Click", 2, null), 1, null) + ], 1, "u6_0"); +}); +export const App = /*#__PURE__*/ componentQrl(q_s_Fh88JClhbC0); +export const STYLES = ".red { color: red; }"; +q_s_odz7dfdfdM.s(STYLES); +q_s_odzdfdfdM.s(STYLES); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;AACA,SAAS,YAAY,EAAc,QAAQ,EAAa,eAAe,QAAQ,iBAAiB;;;;;;;kBAmBtE;IACpB,MAAM,CAAC,MAAM,GAAG;IAChB,OAAO,MAAM,KAAK;AACnB;kBApBoD;IACxD;IACA;IAEA,MAAM,QAAQ,SAAS;QACtB,OAAO;IACR;IACA,OAAO,WAAW,GAAG,WAAK,mBACf;QACT,WAAW,GAAG,WAAK,iBACR;YACT;sBACA;SACA;QAEF,WAAW,GAAG,WAAI,iBACP,WAAW,GAAG,WAAI;YAC3B,WAAQ;;;iBAME;KAGZ;AAEH;AA5BA,OAAO,MAAM,MAAM,WAAW,GAAG,8BA4BA;AAEjC,OAAO,MAAM,SAAS,uBAAuB;iBA7BtB;gBACA\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_preserve_filenames.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_preserve_filenames.snap new file mode 100644 index 00000000000..39610e2db1f --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_preserve_filenames.snap @@ -0,0 +1,41 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2681 +expression: output +--- +==INPUT== + + +import { component$, useStore } from '@qwik.dev/core'; + +export const App = component$((props) => { + return ( + +

console.log('warn')}>Hello Qwik

+
+ ); +}); + +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 = /*#__PURE__*/ _noopQrl("App_component_Cmp_p_q_e_click_Yl4ybrJWrt4"); +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ _noopQrl("App_component_ckEPmXZlub0"); +// +q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4.s(()=>console.log('warn')); +q_App_component_ckEPmXZlub0.s((props)=>{ + return /*#__PURE__*/ _jsxSorted(Cmp, null, null, /*#__PURE__*/ _jsxSorted("p", null, { + class: "stuff", + "q-e:click": q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 + }, "Hello Qwik", 3, null), 3, "u6_0"); +}); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;8CAM8B,IAAM,QAAQ,GAAG,CAAC;8BAHlB,CAAC;IAC9B,qBACC,WAAC,+BACA,WAAC;QAAE,OAAM;QAAQ,WAAQ;OAA6B;AAGzD;AANA,OAAO,MAAM,oBAAM,0CAMhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_preserve_filenames_segments.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_preserve_filenames_segments.snap new file mode 100644 index 00000000000..8f8c2125d95 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_preserve_filenames_segments.snap @@ -0,0 +1,103 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2705 +expression: output +--- +==INPUT== + + +import { component$, useStore } from '@qwik.dev/core'; + +export const App = component$((props: Stuff) => { + foo(); + return ( + +

console.log('warn')}>Hello Qwik

+
+ ); +}); + +export const foo = () => console.log('foo'); + +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0.js"), "App_component_ckEPmXZlub0"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); +export const foo = ()=>console.log('foo'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CAOhB;AAEH,OAAO,MAAM,MAAM,IAAM,QAAQ,GAAG,CAAC,OAAO\"}") +============================= test.tsx_App_component_ckEPmXZlub0.js (ENTRY POINT)== + +import { foo } from "./test.tsx"; +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4.js"), "App_component_Cmp_p_q_e_click_Yl4ybrJWrt4"); +// +export const App_component_ckEPmXZlub0 = (props)=>{ + foo(); + return /*#__PURE__*/ _jsxSorted(Cmp, null, null, /*#__PURE__*/ _jsxSorted("p", null, { + class: "stuff", + "q-e:click": q_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 + }, "Hello Qwik", 3, null), 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;yCAG8B,CAAC;IAC9B;IACA,qBACC,WAAC,+BACA,WAAC;QAAE,OAAM;QAAQ,WAAQ;OAA6B;AAGzD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 88, + 220 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4.js (ENTRY POINT)== + +export const App_component_Cmp_p_q_e_click_Yl4ybrJWrt4 = ()=>console.log('warn'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"yDAO8B,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", + "entry": null, + "displayName": "test.tsx_App_component_Cmp_p_q_e_click", + "hash": "Yl4ybrJWrt4", + "canonicalFilename": "test.tsx_App_component_Cmp_p_q_e_click_Yl4ybrJWrt4", + "path": "", + "extension": "js", + "parent": "App_component_ckEPmXZlub0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 164, + 189 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_prod_node.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_prod_node.snap new file mode 100644 index 00000000000..f4b9c3ed9fc --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_prod_node.snap @@ -0,0 +1,150 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1458 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +export const Foo = component$(() => { + return ( +
+
console.log('first')}/> +
console.log('second')}/> +
console.log('third')}/> +
+ ); +}); + +============================= test.tsx_Foo_component_HTDRsvUbLiE.tsx (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +// +const q_s_VSoqbTjzr4w = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_div_q_e_click_1_VSoqbTjzr4w"), "s_VSoqbTjzr4w"); +const q_s_n19LdlqL6To = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_div_q_e_click_2_n19LdlqL6To"), "s_n19LdlqL6To"); +const q_s_vKrX4PmH2aM = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_div_q_e_click_vKrX4PmH2aM"), "s_vKrX4PmH2aM"); +// +export const s_HTDRsvUbLiE = ()=>{ + return
+
+
+
+
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;6BAG8B;IAC7B,QACE,IAAI;GACJ,CAAC,IAAI,6BAAuC;GAC5C,CAAC,IAAI,6BAAwC;GAC7C,CAAC,IAAI,6BAAuC;EAC7C,EAAE;AAEJ\"}") +/* +{ + "origin": "test.tsx", + "name": "s_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 78, + 263 + ] +} +*/ +============================= test.tsx_Foo_component_div_div_q_e_click_2_n19LdlqL6To.tsx (ENTRY POINT)== + +export const s_n19LdlqL6To = ()=>console.log('third'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"6BAQkB,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "s_n19LdlqL6To", + "entry": null, + "displayName": "test.tsx_Foo_component_div_div_q_e_click_2", + "hash": "n19LdlqL6To", + "canonicalFilename": "test.tsx_Foo_component_div_div_q_e_click_2_n19LdlqL6To", + "path": "", + "extension": "tsx", + "parent": "s_HTDRsvUbLiE", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 219, + 245 + ] +} +*/ +============================= test.tsx_Foo_component_div_div_q_e_click_1_VSoqbTjzr4w.tsx (ENTRY POINT)== + +export const s_VSoqbTjzr4w = ()=>console.log('second'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"6BAOkB,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "s_VSoqbTjzr4w", + "entry": null, + "displayName": "test.tsx_Foo_component_div_div_q_e_click_1", + "hash": "VSoqbTjzr4w", + "canonicalFilename": "test.tsx_Foo_component_div_div_q_e_click_1_VSoqbTjzr4w", + "path": "", + "extension": "tsx", + "parent": "s_HTDRsvUbLiE", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 170, + 197 + ] +} +*/ +============================= test.tsx_Foo_component_div_div_q_e_click_vKrX4PmH2aM.tsx (ENTRY POINT)== + +export const s_vKrX4PmH2aM = ()=>console.log('first'); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"6BAMkB,IAAM,QAAQ,GAAG,CAAC\"}") +/* +{ + "origin": "test.tsx", + "name": "s_vKrX4PmH2aM", + "entry": null, + "displayName": "test.tsx_Foo_component_div_div_q_e_click", + "hash": "vKrX4PmH2aM", + "canonicalFilename": "test.tsx_Foo_component_div_div_q_e_click_vKrX4PmH2aM", + "path": "", + "extension": "tsx", + "parent": "s_HTDRsvUbLiE", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 122, + 148 + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_s_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "s_HTDRsvUbLiE"); +// +export const Foo = /*#__PURE__*/ componentQrl(q_s_HTDRsvUbLiE); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,8BAQhB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_optimization.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_optimization.snap new file mode 100644 index 00000000000..df660f6c882 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_optimization.snap @@ -0,0 +1,146 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 516 +expression: output +--- +==INPUT== + + +import { $, component$, useTask$ } from '@qwik.dev/core'; +import { CONST } from 'const'; +export const Works = component$(({ + count, + some = 1+2, + hello = CONST, + stuff: hey, + stuffDefault: hey2 = 123, + ...rest}) => { + console.log(hey, some); + useTask$(({track}) => { + track(() => count); + console.log(count, rest, hey, some, hey2); + }); + return ( +
{count}
+ ); +}); + +export const NoWorks2 = component$(({count, stuff: {hey}}) => { + console.log(hey); + useTask$(({track}) => { + track(() => count); + console.log(count); + }); + return ( +
{count}
+ ); +}); + +export const NoWorks3 = component$(({count, stuff = hola()}) => { + console.log(stuff); + useTask$(({track}) => { + track(() => count); + console.log(count); + }); + return ( +
{count}
+ ); +}); + +============================= test.js == + +import { _restProps } from "@qwik.dev/core"; +import { componentQrl } from "@qwik.dev/core"; +import { useTaskQrl } from "@qwik.dev/core"; +import { _captures } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _getVarProps } from "@qwik.dev/core"; +import { _getConstProps } from "@qwik.dev/core"; +import { _jsxSplit } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.some ?? 3; +const _hf0_str = "p0.some??1+2"; +const _hf1 = (p0)=>({ + some: p0.some ?? 3 + }); +const _hf1_str = "{some:p0.some??1+2}"; +// +const q_NoWorks2_component_JPD9t2HyEKg = /*#__PURE__*/ _noopQrl("NoWorks2_component_JPD9t2HyEKg"); +const q_NoWorks2_component_useTask_lXiqwbxxjq0 = /*#__PURE__*/ _noopQrl("NoWorks2_component_useTask_lXiqwbxxjq0"); +const q_NoWorks3_component_fc13h5yYn14 = /*#__PURE__*/ _noopQrl("NoWorks3_component_fc13h5yYn14"); +const q_NoWorks3_component_useTask_3cQGU0s1VwU = /*#__PURE__*/ _noopQrl("NoWorks3_component_useTask_3cQGU0s1VwU"); +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +const q_Works_component_useTask_pjo5U5Ikll0 = /*#__PURE__*/ _noopQrl("Works_component_useTask_pjo5U5Ikll0"); +// +q_Works_component_useTask_pjo5U5Ikll0.s(({ track })=>{ + const _rawProps = _captures[0], rest = _captures[1]; + track(()=>_rawProps.count); + console.log(_rawProps.count, rest, _rawProps.stuff, _rawProps.some ?? 3, _rawProps.stuffDefault ?? 123); +}); +q_Works_component_t45qL4vNGv0.s((_rawProps)=>{ + const rest = _restProps(_rawProps, [ + "count", + "some", + "hello", + "stuff", + "stuffDefault" + ]); + console.log(_rawProps.stuff, _rawProps.some ?? 3); + useTaskQrl(q_Works_component_useTask_pjo5U5Ikll0.w([ + _rawProps, + rest + ])); + return /*#__PURE__*/ _jsxSplit("div", { + some: _fnSignal(_hf0, [ + _rawProps + ], _hf0_str), + params: _fnSignal(_hf1, [ + _rawProps + ], _hf1_str), + class: _wrapProp(_rawProps, "count"), + ..._getVarProps(rest) + }, { + ..._getConstProps(rest), + override: true + }, _wrapProp(_rawProps, "count"), 0, "u6_0"); +}); +q_NoWorks2_component_useTask_lXiqwbxxjq0.s(({ track })=>{ + const count = _captures[0]; + track(()=>count); + console.log(count); +}); +q_NoWorks2_component_JPD9t2HyEKg.s(({ count, stuff: { hey } })=>{ + console.log(hey); + useTaskQrl(q_NoWorks2_component_useTask_lXiqwbxxjq0.w([ + count + ])); + return /*#__PURE__*/ _jsxSorted("div", { + class: count + }, null, count, 1, "u6_1"); +}); +q_NoWorks3_component_useTask_3cQGU0s1VwU.s(({ track })=>{ + const count = _captures[0]; + track(()=>count); + console.log(count); +}); +q_NoWorks3_component_fc13h5yYn14.s(({ count, stuff = hola() })=>{ + console.log(stuff); + useTaskQrl(q_NoWorks3_component_useTask_3cQGU0s1VwU.w([ + count + ])); + return /*#__PURE__*/ _jsxSorted("div", { + class: count + }, null, count, 1, "u6_2"); +}); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); +export const NoWorks2 = /*#__PURE__*/ componentQrl(q_NoWorks2_component_JPD9t2HyEKg); +export const NoWorks3 = /*#__PURE__*/ componentQrl(q_NoWorks3_component_fc13h5yYn14); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;sBAKC,QAAO;;mBAWmB,CAAA;QAAE,IAAI,KAXhC,QAAO;IAW0B,CAAA;;;;;;;;;;wCALxB,CAAC,EAAC,KAAK,EAAC;;IAChB,MAAM,cARP;IASC,QAAQ,GAAG,WATZ,OASoB,gBANpB,iBAFA,QAAO,aAGP,gBAAqB;;gCALU;;;;;;;;IAO/B,QAAQ,GAAG,WAHX,iBAFA,QAAO;IAMP;;;;IAIA,qBACC,UAAC;QAAI,IAAI;;;QAAQ,MAAM;;;QAAY,KAAK;wBAAa;;0BAAA;QAAM,QAAQ;;AAErE;2CAIU,CAAC,EAAC,KAAK,EAAC;;IAChB,MAAM,IAAM;IACZ,QAAQ,GAAG,CAAC;;mCAJqB,CAAC,EAAC,KAAK,EAAE,OAAO,EAAC,GAAG,EAAC,EAAC;IACxD,QAAQ,GAAG,CAAC;IACZ;;;IAIA,qBACC,WAAC;QAAI,OAAO;aAAQ;AAEtB;2CAIU,CAAC,EAAC,KAAK,EAAC;;IAChB,MAAM,IAAM;IACZ,QAAQ,GAAG,CAAC;;mCAJqB,CAAC,EAAC,KAAK,EAAE,QAAQ,MAAM,EAAC;IAC1D,QAAQ,GAAG,CAAC;IACZ;;;IAIA,qBACC,WAAC;QAAI,OAAO;aAAQ;AAEtB;AArCA,OAAO,MAAM,sBAAQ,4CAelB;AAEH,OAAO,MAAM,yBAAW,+CASrB;AAEH,OAAO,MAAM,yBAAW,+CASrB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping.snap new file mode 100644 index 00000000000..6c6f6a36af9 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping.snap @@ -0,0 +1,71 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 569 +expression: output +--- +==INPUT== + + +import { $, component$, useSignal } from '@qwik.dev/core'; +export const Works = component$(({fromProps}) => { + let fromLocal = useSignal(0); + return ( +
+
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { useSignal } from '@qwik.dev/core'; +// +const _hf0 = (p0, p1)=>p1 + p0.fromProps; +const _hf0_str = "p1+p0.fromProps"; +const _hf1 = (p0)=>({ + props: p0.fromProps + }); +const _hf1_str = "{props:p0.fromProps}"; +const _hf2 = (p0, p1)=>({ + props: p0.fromProps, + local: p1 + }); +const _hf2_str = "{props:p0.fromProps,local:p1}"; +// +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +// +q_Works_component_t45qL4vNGv0.s((_rawProps)=>{ + let fromLocal = useSignal(0); + return /*#__PURE__*/ _jsxSorted("div", { + computed: _fnSignal(_hf0, [ + _rawProps, + fromLocal + ], _hf0_str), + local: fromLocal, + props: _fnSignal(_hf2, [ + _rawProps, + fromLocal + ], _hf2_str), + "props-only": _fnSignal(_hf1, [ + _rawProps + ], _hf1_str), + "props-wrap": _wrapProp(_rawProps, "fromProps") + }, null, null, 3, "u6_0"); +}); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAAwB,SAAS,QAAQ,iBAAiB;;uBAK7C,QAJqB;;mBAOnB,CAAA;QAAC,KAAK,KAPa;IAOF,CAAA;;uBACtB,CAAA;QAAC,KAAK,KARkB;QAQL,KAAK;IAAW,CAAA;;;;;gCARb;IAC/B,IAAI,YAAY,UAAU;IAC1B,qBACC,WAAC;QACA,QAAQ;;;;QACR,OAAO;QAGP,KAAK;;;;QADL,YAAU;;;QADV,YAAU;;AAMb;AAZA,OAAO,MAAM,sBAAQ,4CAYlB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping2.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping2.snap new file mode 100644 index 00000000000..b27f64d1465 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping2.snap @@ -0,0 +1,71 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 596 +expression: output +--- +==INPUT== + + +import { $, component$, useSignal } from '@qwik.dev/core'; +export const Works = component$((props: { fromProps: number }) => { + let fromLocal = useSignal(0); + return ( +
+
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { useSignal } from '@qwik.dev/core'; +// +const _hf0 = (p0, p1)=>p0 + p1.fromProps; +const _hf0_str = "p0+p1.fromProps"; +const _hf1 = (p0)=>({ + props: p0.fromProps + }); +const _hf1_str = "{props:p0.fromProps}"; +const _hf2 = (p0, p1)=>({ + props: p1.fromProps, + local: p0 + }); +const _hf2_str = "{props:p1.fromProps,local:p0}"; +// +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +// +q_Works_component_t45qL4vNGv0.s((props)=>{ + let fromLocal = useSignal(0); + return /*#__PURE__*/ _jsxSorted("div", { + computed: _fnSignal(_hf0, [ + fromLocal, + props + ], _hf0_str), + local: fromLocal, + props: _fnSignal(_hf2, [ + fromLocal, + props + ], _hf2_str), + "props-only": _fnSignal(_hf1, [ + props + ], _hf1_str), + "props-wrap": _wrapProp(props, "fromProps") + }, null, null, 3, "u6_0"); +}); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAAwB,SAAS,QAAQ,iBAAiB;;uBAK7C,KAAY,GAAM,SAAS;;mBAGzB,CAAA;QAAC,OAAO,GAAM,SAAS;IAAA,CAAA;;uBAC5B,CAAA;QAAC,OAAO,GAAM,SAAS;QAAE,KAAK;IAAW,CAAA;;;;;gCARnB,CAAC;IAChC,IAAI,YAAY,UAAU;IAC1B,qBACC,WAAC;QACA,QAAQ;;;;QACR,OAAO;QAGP,KAAK;;;;QADL,YAAU;;;QADV,YAAU,YAAE;;AAMf;AAZA,OAAO,MAAM,sBAAQ,4CAYlB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping_children.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping_children.snap new file mode 100644 index 00000000000..f6866ddd0eb --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping_children.snap @@ -0,0 +1,74 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 623 +expression: output +--- +==INPUT== + + +import { $, component$, useSignal } from '@qwik.dev/core'; +export const Works = component$(({fromProps}) => { + let fromLocal = useSignal(0); + return ( +
+ {fromLocal} + {fromProps} + {fromLocal + fromProps} + {{props: fromProps}} + {{local: fromLocal}} + {{props: fromProps, local: fromLocal}} +
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { useSignal } from '@qwik.dev/core'; +// +const _hf0 = (p0, p1)=>p1 + p0.fromProps; +const _hf0_str = "p1+p0.fromProps"; +const _hf1 = (p0)=>({ + props: p0.fromProps + }); +const _hf1_str = "{props:p0.fromProps}"; +const _hf2 = (p0, p1)=>({ + props: p0.fromProps, + local: p1 + }); +const _hf2_str = "{props:p0.fromProps,local:p1}"; +// +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +// +q_Works_component_t45qL4vNGv0.s((_rawProps)=>{ + let fromLocal = useSignal(0); + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + fromLocal, + _wrapProp(_rawProps, "fromProps"), + _fnSignal(_hf0, [ + _rawProps, + fromLocal + ], _hf0_str), + _fnSignal(_hf1, [ + _rawProps + ], _hf1_str), + { + local: fromLocal + }, + _fnSignal(_hf2, [ + _rawProps, + fromLocal + ], _hf2_str) + ], 1, "u6_0"); +}); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAAwB,SAAS,QAAQ,iBAAiB;;uBAOtD,QAN8B;;mBAO9B,CAAA;QAAC,KAAK,KAPwB;IAOb,CAAA;;uBAEjB,CAAA;QAAC,KAAK,KATwB;QASX,KAAK;IAAW,CAAA;;;;;gCATP;IAC/B,IAAI,YAAY,UAAU;IAC1B,qBACC,WAAC;QACC;;;;;;;;;QAIA;YAAC,OAAO;QAAS;;;;;;AAIrB;AAZA,OAAO,MAAM,sBAAQ,4CAYlB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping_children2.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping_children2.snap new file mode 100644 index 00000000000..a631c9b361f --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_props_wrapping_children2.snap @@ -0,0 +1,78 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 650 +expression: output +--- +==INPUT== + + +import { $, component$, useSignal } from '@qwik.dev/core'; +export const Works = component$((props) => { + let fromLocal = useSignal(0); + return ( +
+ before- + {fromLocal} + {props.fromProps} + {fromLocal + props.fromProps} + {{props: props.fromProps}} + {{local: fromLocal}} + {{props: props.fromProps, local: fromLocal}} + -after +
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { useSignal } from '@qwik.dev/core'; +// +const _hf0 = (p0, p1)=>p0 + p1.fromProps; +const _hf0_str = "p0+p1.fromProps"; +const _hf1 = (p0)=>({ + props: p0.fromProps + }); +const _hf1_str = "{props:p0.fromProps}"; +const _hf2 = (p0, p1)=>({ + props: p1.fromProps, + local: p0 + }); +const _hf2_str = "{props:p1.fromProps,local:p0}"; +// +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +// +q_Works_component_t45qL4vNGv0.s((props)=>{ + let fromLocal = useSignal(0); + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + "before-", + fromLocal, + _wrapProp(props, "fromProps"), + _fnSignal(_hf0, [ + fromLocal, + props + ], _hf0_str), + _fnSignal(_hf1, [ + props + ], _hf1_str), + { + local: fromLocal + }, + _fnSignal(_hf2, [ + fromLocal, + props + ], _hf2_str), + "-after" + ], 1, "u6_0"); +}); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AACA,SAAwB,SAAS,QAAQ,iBAAiB;;uBAQtD,KAAY,GAAM,SAAS;;mBAC3B,CAAA;QAAC,OAAO,GAAM,SAAS;IAAA,CAAA;;uBAEvB,CAAA;QAAC,OAAO,GAAM,SAAS;QAAE,KAAK;IAAW,CAAA;;;;;gCAVb,CAAC;IAChC,IAAI,YAAY,UAAU;IAC1B,qBACC,WAAC;QAAI;QAEH;kBACA;;;;;;;;QAGA;YAAC,OAAO;QAAS;;;;;QAC0B;;AAI/C;AAdA,OAAO,MAAM,sBAAQ,4CAclB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_conflict.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_conflict.snap new file mode 100644 index 00000000000..caceea2823d --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_conflict.snap @@ -0,0 +1,222 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1238 +expression: output +--- +==INPUT== + + +import { $, component$, useStyles } from '@qwik.dev/core'; +import { qrl } from '@qwik.dev/core/what'; + +export const hW = 12; +export const handleWatch = 42; + +const componentQrl = () => console.log('not this', qrl()); + +componentQrl(); +export const Foo = component$(() => { + useStyles$('thing'); + const qwik = hW + handleWatch; + console.log(qwik); + const qrl = 23; + return ( +
console.log(qrl)}/> + ) +}, { + tagName: "my-foo", +}); + +export const Root = component$(() => { + useStyles($('thing')); + return $(() => { + return ( +
+ ) + }); +}, { + tagName: "my-foo", +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { qrl as qrl1 } from '@qwik.dev/core/what'; +// +const q_Foo_component_HTDRsvUbLiE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_HTDRsvUbLiE"), "Foo_component_HTDRsvUbLiE"); +const q_Root_component_royhjYaCbYE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Root_component_royhjYaCbYE"), "Root_component_royhjYaCbYE"); +// +export const hW = 12; +export const handleWatch = 42; +const componentQrl1 = ()=>console.log('not this', qrl1()); +componentQrl1(); +export const Foo = /*#__PURE__*/ componentQrl(q_Foo_component_HTDRsvUbLiE, { + tagName: "my-foo" +}); +export const Root = /*#__PURE__*/ componentQrl(q_Root_component_royhjYaCbYE, { + tagName: "my-foo" +}); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;AAEA,SAAS,OAAA,IAAG,QAAQ,sBAAsB;;;;;AAE1C,OAAO,MAAM,KAAK,GAAG;AACrB,OAAO,MAAM,cAAc,GAAG;AAE9B,MAAM,gBAAe,IAAM,QAAQ,GAAG,CAAC,YAAY;AAEnD;AACA,OAAO,MAAM,oBAAM,0CAQhB;IACF,SAAS;AACV,GAAG;AAEH,OAAO,MAAM,qBAAO,2CAOjB;IACF,SAAS;AACV,GAAG\"}") +============================= test.tsx_Foo_component_HTDRsvUbLiE.js (ENTRY POINT)== + +import { hW } from "./test"; +import { handleWatch } from "./test"; +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_Foo_component_div_q_e_click_YEa2A5ADUOg = /*#__PURE__*/ qrl(()=>import("./test.tsx_Foo_component_div_q_e_click_YEa2A5ADUOg"), "Foo_component_div_q_e_click_YEa2A5ADUOg"); +// +export const Foo_component_HTDRsvUbLiE = ()=>{ + useStyles$('thing'); + const qwik = hW + handleWatch; + console.log(qwik); + return /*#__PURE__*/ _jsxSorted("div", null, { + "q-e:click": q_Foo_component_div_q_e_click_YEa2A5ADUOg + }, null, 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;yCAU8B;IAC7B,WAAW;IACX,MAAM,OAAO,KAAK;IAClB,QAAQ,GAAG,CAAC;IAEZ,qBACC,WAAC;QAAI,WAAQ;;AAEf\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_HTDRsvUbLiE", + "entry": null, + "displayName": "test.tsx_Foo_component", + "hash": "HTDRsvUbLiE", + "canonicalFilename": "test.tsx_Foo_component_HTDRsvUbLiE", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 265, + 420 + ] +} +*/ +============================= test.tsx_Root_component_useStyles_u5DkUxGrGnU.js (ENTRY POINT)== + +export const Root_component_useStyles_u5DkUxGrGnU = 'thing'; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"oDAuBa\"}") +/* +{ + "origin": "test.tsx", + "name": "Root_component_useStyles_u5DkUxGrGnU", + "entry": null, + "displayName": "test.tsx_Root_component_useStyles", + "hash": "u5DkUxGrGnU", + "canonicalFilename": "test.tsx_Root_component_useStyles_u5DkUxGrGnU", + "path": "", + "extension": "js", + "parent": "Root_component_royhjYaCbYE", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 501, + 508 + ] +} +*/ +============================= test.tsx_Root_component_royhjYaCbYE.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +import { useStyles } from "@qwik.dev/core"; +// +const q_Root_component_1_cBpQNYDUHI4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_Root_component_1_cBpQNYDUHI4"), "Root_component_1_cBpQNYDUHI4"); +const q_Root_component_useStyles_u5DkUxGrGnU = /*#__PURE__*/ qrl(()=>import("./test.tsx_Root_component_useStyles_u5DkUxGrGnU"), "Root_component_useStyles_u5DkUxGrGnU"); +// +export const Root_component_royhjYaCbYE = ()=>{ + useStyles(q_Root_component_useStyles_u5DkUxGrGnU); + return q_Root_component_1_cBpQNYDUHI4; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;0CAsB+B;IAC9B;IACA;AAKD\"}") +/* +{ + "origin": "test.tsx", + "name": "Root_component_royhjYaCbYE", + "entry": null, + "displayName": "test.tsx_Root_component", + "hash": "royhjYaCbYE", + "canonicalFilename": "test.tsx_Root_component_royhjYaCbYE", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 480, + 561 + ] +} +*/ +============================= test.tsx_Root_component_1_cBpQNYDUHI4.js (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +// +export const Root_component_1_cBpQNYDUHI4 = ()=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, null, 3, "u6_1"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;4CAwBU;IACR,qBACC,WAAC;AAEH\"}") +/* +{ + "origin": "test.tsx", + "name": "Root_component_1_cBpQNYDUHI4", + "entry": null, + "displayName": "test.tsx_Root_component_1", + "hash": "cBpQNYDUHI4", + "canonicalFilename": "test.tsx_Root_component_1_cBpQNYDUHI4", + "path": "", + "extension": "js", + "parent": "Root_component_royhjYaCbYE", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 522, + 557 + ] +} +*/ +============================= test.tsx_Foo_component_div_q_e_click_YEa2A5ADUOg.js (ENTRY POINT)== + +export const Foo_component_div_q_e_click_YEa2A5ADUOg = ()=>console.log(23); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\"uDAgBiB,IAAK,QAAQ,GAAG,CAFpB\"}") +/* +{ + "origin": "test.tsx", + "name": "Foo_component_div_q_e_click_YEa2A5ADUOg", + "entry": null, + "displayName": "test.tsx_Foo_component_div_q_e_click", + "hash": "YEa2A5ADUOg", + "canonicalFilename": "test.tsx_Foo_component_div_q_e_click_YEa2A5ADUOg", + "path": "", + "extension": "js", + "parent": "Foo_component_HTDRsvUbLiE", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 391, + 412 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_react.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_react.snap new file mode 100644 index 00000000000..a8068dcef93 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_react.snap @@ -0,0 +1,278 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3120 +expression: output +--- +==INPUT== + + +import { componentQrl, inlinedQrl, useLexicalScope, useHostElement, useStore, useTaskQrl, noSerialize, SkipRerender, implicit$FirstArg } from '@qwik.dev/core'; +import { jsx, Fragment } from '@qwik.dev/core/jsx-runtime'; +import { isBrowser, isServer } from '@qwik.dev/core'; + +function qwikifyQrl(reactCmpQrl) { + return /*#__PURE__*/ componentQrl(inlinedQrl((props)=>{ + const [reactCmpQrl] = useLexicalScope(); + const hostElement = useHostElement(); + const store = useStore({}); + let run; + if (props['client:visible']) run = 'visible'; + else if (props['client:load'] || props['client:only']) run = 'load'; + useTaskQrl(inlinedQrl(async (track)=>{ + const [hostElement, props, reactCmpQrl, store] = useLexicalScope(); + track(props); + if (isBrowser) { + if (store.data) store.data.root.render(store.data.client.Main(store.data.cmp, filterProps(props))); + else { + const [Cmp, client] = await Promise.all([ + reactCmpQrl.resolve(), + import('./client-f762f78c.js') + ]); + let root; + if (hostElement.childElementCount > 0) root = client.hydrateRoot(hostElement, client.Main(Cmp, filterProps(props), store.event)); + else { + root = client.createRoot(hostElement); + root.render(client.Main(Cmp, filterProps(props))); + } + store.data = noSerialize({ + client, + cmp: Cmp, + root + }); + } + } + }, "qwikifyQrl_component_useWatch_x04JC5xeP1U", [ + hostElement, + props, + reactCmpQrl, + store + ]), { + run + }); + if (isServer && !props['client:only']) { + const jsx$1 = Promise.all([ + reactCmpQrl.resolve(), + import('./server-9ac6caad.js') + ]).then(([Cmp, server])=>{ + const html = server.render(Cmp, filterProps(props)); + return /*#__PURE__*/ jsx(Host, { + dangerouslySetInnerHTML: html, + [_IMMUTABLE]: [ + "dangerouslySetInnerHTML" + ] + }); + }); + return /*#__PURE__*/ jsx(Fragment, { + children: jsx$1 + }); + } + return /*#__PURE__*/ jsx(Host, { + children: /*#__PURE__*/ jsx(SkipRerender, {}) + }); + }, "qwikifyQrl_component_zH94hIe0Ick", [ + reactCmpQrl + ]), { + tagName: 'qwik-wrap' + }); +} +const filterProps = (props)=>{ + const obj = {}; + Object.keys(props).forEach((key)=>{ + if (!key.startsWith('client:')) obj[key] = props[key]; + }); + return obj; +}; +const qwikify$ = implicit$FirstArg(qwikifyQrl); + +async function renderToString(rootNode, opts) { + const mod = await import('./server-9ac6caad.js'); + const result = await mod.renderToString(rootNode, opts); + const styles = mod.getGlobalStyleTag(result.html); + const finalHtml = styles + result.html; + return { + ...result, + html: finalHtml + }; +} + +export { qwikify$, qwikifyQrl, renderToString }; + +============================= ../node_modules/@qwik.dev/react/index.qwik.mjs_qwikifyQrl_component_useWatch_x04JC5xeP1U.mjs (ENTRY POINT)== + +import { _auto_filterProps as filterProps } from "./index.qwik.mjs"; +import { isBrowser } from "@qwik.dev/core"; +import { noSerialize } from "@qwik.dev/core"; +import { useLexicalScope } from "@qwik.dev/core"; +// +export const qwikifyQrl_component_useWatch_x04JC5xeP1U = async (track)=>{ + const [hostElement, props, reactCmpQrl, store] = useLexicalScope(); + track(props); + if (isBrowser) { + if (store.data) store.data.root.render(store.data.client.Main(store.data.cmp, filterProps(props))); + else { + const [Cmp, client] = await Promise.all([ + reactCmpQrl.resolve(), + import('./client-f762f78c.js') + ]); + let root; + if (hostElement.childElementCount > 0) root = client.hydrateRoot(hostElement, client.Main(Cmp, filterProps(props), store.event)); + else { + root = client.createRoot(hostElement); + root.render(client.Main(Cmp, filterProps(props))); + } + store.data = noSerialize({ + client, + cmp: Cmp, + root + }); + } + } +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/react/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;yDAawB,OAAO;IAC5B,MAAM,CAAC,aAAa,OAAO,aAAa,MAAM,GAAG;IACjD,MAAM;IACN,IAAI;QACH,IAAI,MAAM,IAAI,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,YAAY;aACrF;YACJ,MAAM,CAAC,KAAK,OAAO,GAAG,MAAM,QAAQ,GAAG,CAAC;gBACvC,YAAY,OAAO;gBACnB,MAAM,CAAC;aACP;YACD,IAAI;YACJ,IAAI,YAAY,iBAAiB,GAAG,GAAG,OAAO,OAAO,WAAW,CAAC,aAAa,OAAO,IAAI,CAAC,KAAK,YAAY,QAAQ,MAAM,KAAK;iBACzH;gBACJ,OAAO,OAAO,UAAU,CAAC;gBACzB,KAAK,MAAM,CAAC,OAAO,IAAI,CAAC,KAAK,YAAY;YAC1C;YACA,MAAM,IAAI,GAAG,YAAY;gBACxB;gBACA,KAAK;gBACL;YACD;QACD;;AAEF\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/react/index.qwik.mjs", + "name": "qwikifyQrl_component_useWatch_x04JC5xeP1U", + "entry": null, + "displayName": "index.qwik.mjs_qwikifyQrl_component_useWatch", + "hash": "x04JC5xeP1U", + "canonicalFilename": "index.qwik.mjs_qwikifyQrl_component_useWatch_x04JC5xeP1U", + "path": "../node_modules/@qwik.dev/react", + "extension": "mjs", + "parent": "qwikifyQrl_component_zH94hIe0Ick", + "ctxKind": "function", + "ctxName": "useTask$", + "captures": true, + "loc": [ + 636, + 1365 + ], + "paramNames": [ + "track" + ], + "captureNames": [ + "hostElement", + "props", + "reactCmpQrl", + "store" + ] +} +*/ +============================= ../node_modules/@qwik.dev/react/index.qwik.mjs_qwikifyQrl_component_zH94hIe0Ick.mjs (ENTRY POINT)== + +import { _auto_filterProps as filterProps } from "./index.qwik.mjs"; +import { Fragment } from "@qwik.dev/core/jsx-runtime"; +import { SkipRerender } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { isServer } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useHostElement } from "@qwik.dev/core"; +import { useLexicalScope } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +import { useTaskQrl } from "@qwik.dev/core"; +// +const q_qwikifyQrl_component_useWatch_x04JC5xeP1U = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_qwikifyQrl_component_useWatch_x04JC5xeP1U.mjs"), "qwikifyQrl_component_useWatch_x04JC5xeP1U"); +// +export const qwikifyQrl_component_zH94hIe0Ick = (props)=>{ + const [reactCmpQrl] = useLexicalScope(); + const hostElement = useHostElement(); + const store = useStore({}); + let run; + if (props['client:visible']) run = 'visible'; + else if (props['client:load'] || props['client:only']) run = 'load'; + useTaskQrl(q_qwikifyQrl_component_useWatch_x04JC5xeP1U.w([ + hostElement, + props, + reactCmpQrl, + store + ]), { + run + }); + if (isServer && !props['client:only']) { + const jsx$1 = Promise.all([ + reactCmpQrl.resolve(), + import('./server-9ac6caad.js') + ]).then(([Cmp, server])=>{ + const html = server.render(Cmp, filterProps(props)); + return /*#__PURE__*/ _jsxSorted(Host, { + dangerouslySetInnerHTML: html, + [_IMMUTABLE]: [ + "dangerouslySetInnerHTML" + ] + }, null, null, 3, "8p_0"); + }); + return /*#__PURE__*/ _jsxSorted(Fragment, null, null, jsx$1, 1, "8p_1"); + } + return /*#__PURE__*/ _jsxSorted(Host, null, null, /*#__PURE__*/ _jsxSorted(SkipRerender, null, null, null, 3, "8p_2"), 1, "8p_3"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/react/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;gDAM8C,CAAC;IAC7C,MAAM,CAAC,YAAY,GAAG;IACtB,MAAM,cAAc;IACpB,MAAM,QAAQ,SAAS,CAAC;IACxB,IAAI;IACJ,IAAI,KAAK,CAAC,iBAAiB,EAAE,MAAM;SAC9B,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,cAAc,EAAE,MAAM;IAC7D;;;;;QA4BI;QACH;IACD;IACA,IAAI,YAAY,CAAC,KAAK,CAAC,cAAc,EAAE;QACtC,MAAM,QAAQ,QAAQ,GAAG,CAAC;YACzB,YAAY,OAAO;YACnB,MAAM,CAAC;SACP,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO;YACrB,MAAM,OAAO,OAAO,MAAM,CAAC,KAAK,YAAY;YAC5C,OAAO,WAAW,GAAG,WAAI;gBACxB,yBAAyB;gBACzB,CAAC,WAAW,EAAE;oBACb;iBACA;;QAEH;QACA,OAAO,WAAW,GAAG,WAAI,sBACd;IAEZ;IACA,OAAO,WAAW,GAAG,WAAI,kBACd,WAAW,GAAG,WAAI;AAE9B\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/react/index.qwik.mjs", + "name": "qwikifyQrl_component_zH94hIe0Ick", + "entry": null, + "displayName": "index.qwik.mjs_qwikifyQrl_component", + "hash": "zH94hIe0Ick", + "canonicalFilename": "index.qwik.mjs_qwikifyQrl_component_zH94hIe0Ick", + "path": "../node_modules/@qwik.dev/react", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": true, + "loc": [ + 358, + 2020 + ], + "paramNames": [ + "props" + ], + "captureNames": [ + "reactCmpQrl" + ] +} +*/ +============================= ../node_modules/@qwik.dev/react/index.qwik.mjs == + +import { qrl } from "@qwik.dev/core"; +import { componentQrl, implicit$FirstArg } from '@qwik.dev/core'; +// +const q_qwikifyQrl_component_zH94hIe0Ick = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_qwikifyQrl_component_zH94hIe0Ick.mjs"), "qwikifyQrl_component_zH94hIe0Ick"); +// +function qwikifyQrl(reactCmpQrl) { + return /*#__PURE__*/ componentQrl(q_qwikifyQrl_component_zH94hIe0Ick.w([ + reactCmpQrl + ]), { + tagName: 'qwik-wrap' + }); +} +const filterProps = (props)=>{ + const obj = {}; + Object.keys(props).forEach((key)=>{ + if (!key.startsWith('client:')) obj[key] = props[key]; + }); + return obj; +}; +const qwikify$ = implicit$FirstArg(qwikifyQrl); +async function renderToString(rootNode, opts) { + const mod = await import('./server-9ac6caad.js'); + const result = await mod.renderToString(rootNode, opts); + const styles = mod.getGlobalStyleTag(result.html); + const finalHtml = styles + result.html; + return { + ...result, + html: finalHtml + }; +} +export { qwikify$, qwikifyQrl, renderToString }; +export { filterProps as _auto_filterProps }; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/react/index.qwik.mjs\"],\"names\":[],\"mappings\":\";AACA,SAAS,YAAY,EAAgG,iBAAiB,QAAQ,iBAAiB;;;;AAI/J,SAAS,WAAW,WAAW;IAC9B,OAAO,WAAW,GAAG;;QA4DjB;QACH,SAAS;IACV;AACD;AACA,MAAM,cAAc,CAAC;IACpB,MAAM,MAAM,CAAC;IACb,OAAO,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,UAAU,CAAC,YAAY,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;IACtD;IACA,OAAO;AACR;AACA,MAAM,WAAW,kBAAkB;AAEnC,eAAe,eAAe,QAAQ,EAAE,IAAI;IAC3C,MAAM,MAAM,MAAM,MAAM,CAAC;IACzB,MAAM,SAAS,MAAM,IAAI,cAAc,CAAC,UAAU;IAClD,MAAM,SAAS,IAAI,iBAAiB,CAAC,OAAO,IAAI;IAChD,MAAM,YAAY,SAAS,OAAO,IAAI;IACtC,OAAO;QACN,GAAG,MAAM;QACT,MAAM;IACP;AACD;AAEA,SAAS,QAAQ,EAAE,UAAU,EAAE,cAAc,GAAG\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_react_inline.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_react_inline.snap new file mode 100644 index 00000000000..4c24607ce8c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_react_inline.snap @@ -0,0 +1,199 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3223 +expression: output +--- +==INPUT== + + +import { componentQrl, inlinedQrl, useLexicalScope, useHostElement, useStore, useTaskQrl, noSerialize, SkipRerender, implicit$FirstArg } from '@qwik.dev/core'; +import { jsx, Fragment } from '@qwik.dev/core/jsx-runtime'; +import { isBrowser, isServer } from '@qwik.dev/core'; + +function qwikifyQrl(reactCmpQrl) { + return /*#__PURE__*/ componentQrl(inlinedQrl((props)=>{ + const [reactCmpQrl] = useLexicalScope(); + const hostElement = useHostElement(); + const store = useStore({}); + let run; + if (props['client:visible']) run = 'visible'; + else if (props['client:load'] || props['client:only']) run = 'load'; + useTaskQrl(inlinedQrl(async (track)=>{ + const [hostElement, props, reactCmpQrl, store] = useLexicalScope(); + track(props); + if (isBrowser) { + if (store.data) store.data.root.render(store.data.client.Main(store.data.cmp, filterProps(props))); + else { + const [Cmp, client] = await Promise.all([ + reactCmpQrl.resolve(), + import('./client-f762f78c.js') + ]); + let root; + if (hostElement.childElementCount > 0) root = client.hydrateRoot(hostElement, client.Main(Cmp, filterProps(props), store.event)); + else { + root = client.createRoot(hostElement); + root.render(client.Main(Cmp, filterProps(props))); + } + store.data = noSerialize({ + client, + cmp: Cmp, + root + }); + } + } + }, "qwikifyQrl_component_useWatch_x04JC5xeP1U", [ + hostElement, + props, + reactCmpQrl, + store + ]), { + run + }); + if (isServer && !props['client:only']) { + const jsx$1 = Promise.all([ + reactCmpQrl.resolve(), + import('./server-9ac6caad.js') + ]).then(([Cmp, server])=>{ + const html = server.render(Cmp, filterProps(props)); + return /*#__PURE__*/ jsx(Host, { + dangerouslySetInnerHTML: html, + [_IMMUTABLE]: [ + "dangerouslySetInnerHTML" + ] + }); + }); + return /*#__PURE__*/ jsx(Fragment, { + children: jsx$1 + }); + } + return /*#__PURE__*/ jsx(Host, { + children: /*#__PURE__*/ jsx(SkipRerender, {}) + }); + }, "qwikifyQrl_component_zH94hIe0Ick", [ + reactCmpQrl + ]), { + tagName: 'qwik-wrap' + }); +} +const filterProps = (props)=>{ + const obj = {}; + Object.keys(props).forEach((key)=>{ + if (!key.startsWith('client:')) obj[key] = props[key]; + }); + return obj; +}; +const qwikify$ = implicit$FirstArg(qwikifyQrl); + +async function renderToString(rootNode, opts) { + const mod = await import('./server-9ac6caad.js'); + const result = await mod.renderToString(rootNode, opts); + const styles = mod.getGlobalStyleTag(result.html); + const finalHtml = styles + result.html; + return { + ...result, + html: finalHtml + }; +} + +export { qwikify$, qwikifyQrl, renderToString }; + +============================= ../node_modules/@qwik.dev/react/index.qwik.mjs == + +import { _noopQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { componentQrl, useLexicalScope, useHostElement, useStore, useTaskQrl, noSerialize, SkipRerender, implicit$FirstArg } from '@qwik.dev/core'; +import { Fragment } from '@qwik.dev/core/jsx-runtime'; +import { isBrowser, isServer } from '@qwik.dev/core'; +// +const q_qwikifyQrl_component_useWatch_x04JC5xeP1U = /*#__PURE__*/ _noopQrl("qwikifyQrl_component_useWatch_x04JC5xeP1U"); +const q_qwikifyQrl_component_zH94hIe0Ick = /*#__PURE__*/ _noopQrl("qwikifyQrl_component_zH94hIe0Ick"); +// +function qwikifyQrl(reactCmpQrl) { + return /*#__PURE__*/ componentQrl(q_qwikifyQrl_component_zH94hIe0Ick.w([ + reactCmpQrl + ]), { + tagName: 'qwik-wrap' + }); +} +const filterProps = (props)=>{ + const obj = {}; + Object.keys(props).forEach((key)=>{ + if (!key.startsWith('client:')) obj[key] = props[key]; + }); + return obj; +}; +q_qwikifyQrl_component_useWatch_x04JC5xeP1U.s(async (track)=>{ + const [hostElement, props, reactCmpQrl, store] = useLexicalScope(); + track(props); + if (isBrowser) { + if (store.data) store.data.root.render(store.data.client.Main(store.data.cmp, filterProps(props))); + else { + const [Cmp, client] = await Promise.all([ + reactCmpQrl.resolve(), + import('./client-f762f78c.js') + ]); + let root; + if (hostElement.childElementCount > 0) root = client.hydrateRoot(hostElement, client.Main(Cmp, filterProps(props), store.event)); + else { + root = client.createRoot(hostElement); + root.render(client.Main(Cmp, filterProps(props))); + } + store.data = noSerialize({ + client, + cmp: Cmp, + root + }); + } + } +}); +q_qwikifyQrl_component_zH94hIe0Ick.s((props)=>{ + const [reactCmpQrl] = useLexicalScope(); + const hostElement = useHostElement(); + const store = useStore({}); + let run; + if (props['client:visible']) run = 'visible'; + else if (props['client:load'] || props['client:only']) run = 'load'; + useTaskQrl(q_qwikifyQrl_component_useWatch_x04JC5xeP1U.w([ + hostElement, + props, + reactCmpQrl, + store + ]), { + run + }); + if (isServer && !props['client:only']) { + const jsx$1 = Promise.all([ + reactCmpQrl.resolve(), + import('./server-9ac6caad.js') + ]).then(([Cmp, server])=>{ + const html = server.render(Cmp, filterProps(props)); + return /*#__PURE__*/ _jsxSorted(Host, { + dangerouslySetInnerHTML: html, + [_IMMUTABLE]: [ + "dangerouslySetInnerHTML" + ] + }, null, null, 3, "8p_0"); + }); + return /*#__PURE__*/ _jsxSorted(Fragment, null, null, jsx$1, 1, "8p_1"); + } + return /*#__PURE__*/ _jsxSorted(Host, null, null, /*#__PURE__*/ _jsxSorted(SkipRerender, null, null, null, 3, "8p_2"), 1, "8p_3"); +}); +const qwikify$ = implicit$FirstArg(qwikifyQrl); +async function renderToString(rootNode, opts) { + const mod = await import('./server-9ac6caad.js'); + const result = await mod.renderToString(rootNode, opts); + const styles = mod.getGlobalStyleTag(result.html); + const finalHtml = styles + result.html; + return { + ...result, + html: finalHtml + }; +} +export { qwikify$, qwikifyQrl, renderToString }; +export { filterProps as _auto_filterProps }; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/react/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;AACA,SAAS,YAAY,EAAc,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,QAAQ,iBAAiB;AAC/J,SAAc,QAAQ,QAAQ,6BAA6B;AAC3D,SAAS,SAAS,EAAE,QAAQ,QAAQ,iBAAiB;;;;;AAErD,SAAS,WAAW,WAAW;IAC9B,OAAO,WAAW,GAAG;;QA4DjB;QACH,SAAS;IACV;AACD;AACA,MAAM,cAAc,CAAC;IACpB,MAAM,MAAM,CAAC;IACb,OAAO,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,UAAU,CAAC,YAAY,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;IACtD;IACA,OAAO;AACR;8CA/DwB,OAAO;IAC5B,MAAM,CAAC,aAAa,OAAO,aAAa,MAAM,GAAG;IACjD,MAAM;IACN,IAAI;QACH,IAAI,MAAM,IAAI,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,YAAY;aACrF;YACJ,MAAM,CAAC,KAAK,OAAO,GAAG,MAAM,QAAQ,GAAG,CAAC;gBACvC,YAAY,OAAO;gBACnB,MAAM,CAAC;aACP;YACD,IAAI;YACJ,IAAI,YAAY,iBAAiB,GAAG,GAAG,OAAO,OAAO,WAAW,CAAC,aAAa,OAAO,IAAI,CAAC,KAAK,YAAY,QAAQ,MAAM,KAAK;iBACzH;gBACJ,OAAO,OAAO,UAAU,CAAC;gBACzB,KAAK,MAAM,CAAC,OAAO,IAAI,CAAC,KAAK,YAAY;YAC1C;YACA,MAAM,IAAI,GAAG,YAAY;gBACxB;gBACA,KAAK;gBACL;YACD;QACD;;AAEF;qCA9B4C,CAAC;IAC7C,MAAM,CAAC,YAAY,GAAG;IACtB,MAAM,cAAc;IACpB,MAAM,QAAQ,SAAS,CAAC;IACxB,IAAI;IACJ,IAAI,KAAK,CAAC,iBAAiB,EAAE,MAAM;SAC9B,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,cAAc,EAAE,MAAM;IAC7D;;;;;QA4BI;QACH;IACD;IACA,IAAI,YAAY,CAAC,KAAK,CAAC,cAAc,EAAE;QACtC,MAAM,QAAQ,QAAQ,GAAG,CAAC;YACzB,YAAY,OAAO;YACnB,MAAM,CAAC;SACP,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO;YACrB,MAAM,OAAO,OAAO,MAAM,CAAC,KAAK,YAAY;YAC5C,OAAO,WAAW,GAAG,WAAI;gBACxB,yBAAyB;gBACzB,CAAC,WAAW,EAAE;oBACb;iBACA;;QAEH;QACA,OAAO,WAAW,GAAG,WAAI,sBACd;IAEZ;IACA,OAAO,WAAW,GAAG,WAAI,kBACd,WAAW,GAAG,WAAI;AAE9B;AAaD,MAAM,WAAW,kBAAkB;AAEnC,eAAe,eAAe,QAAQ,EAAE,IAAI;IAC3C,MAAM,MAAM,MAAM,MAAM,CAAC;IACzB,MAAM,SAAS,MAAM,IAAI,cAAc,CAAC,UAAU;IAClD,MAAM,SAAS,IAAI,iBAAiB,CAAC,OAAO,IAAI;IAChD,MAAM,YAAY,SAAS,OAAO,IAAI;IACtC,OAAO;QACN,GAAG,MAAM;QACT,MAAM;IACP;AACD;AAEA,SAAS,QAAQ,EAAE,UAAU,EAAE,cAAc,GAAG\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_router_client.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_router_client.snap new file mode 100644 index 00000000000..7d751eb715c --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_qwik_router_client.snap @@ -0,0 +1,4218 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 3326 +expression: output +--- +==INPUT== + +import { jsx, Fragment, jsxs } from '@qwik.dev/core/jsx-runtime'; +import { + component$, + useErrorBoundary, + useOnWindow, + $, + Slot, + createContextId, + useContext, + implicit$FirstArg, + noSerialize, + useVisibleTask$, + useServerData, + useSignal, + untrack, + sync$, + isDev, + withLocale, + event$, + isServer, + useStyles$, + useStore, + isBrowser, + useContextProvider, + useTask$, + getLocale, + jsx as jsx$1, + SkipRender, + createElement, +} from '@qwik.dev/core'; +import { + g as getClientNavPath, + s as shouldPreload, + p as preloadRouteBundles, + l as loadClientData, + i as isPromise, + a as isSamePath, + c as createLoaderSignal, + t as toUrl, + b as isSameOrigin, + d as loadRoute, + D as DEFAULT_LOADERS_SERIALIZATION_STRATEGY, + C as CLIENT_DATA_CACHE, + Q as Q_ROUTE, + e as clientNavigate, + f as QFN_KEY, + h as QACTION_KEY, + j as QDATA_KEY, +} from './chunks/routing.qwik.mjs'; +import * as qwikRouterConfig from '@qwik-router-config'; +import { + _getContextContainer, + SerializerSymbol, + _UNINITIALIZED, + _hasStoreEffects, + forceStoreEffects, + _waitUntilRendered, + _getContextHostElement, + _getContextEvent, + _serialize, + _deserialize, + _resolveContextWithoutSequentialScope, +} from '@qwik.dev/core/internal'; +import { _asyncRequestStore } from '@qwik.dev/router/middleware/request-handler'; +import * as v from 'valibot'; +import * as z from 'zod'; +export { z } from 'zod'; +import swRegister from '@qwik-router-sw-register'; +import { renderToStream } from '@qwik.dev/core/server'; +import '@qwik.dev/core/preloader'; +import './chunks/types.qwik.mjs'; + +const ErrorBoundary = component$((props) => { + const store = useErrorBoundary(); + useOnWindow( + 'qerror', + $((e) => { + store.error = e.detail.error; + }) + ); + if (store.error && props.fallback$) { + return /* @__PURE__ */ jsx(Fragment, { children: props.fallback$(store.error) }); + } + return /* @__PURE__ */ jsx(Slot, {}); +}); + +const RouteStateContext = /* @__PURE__ */ createContextId('qc-s'); +const ContentContext = /* @__PURE__ */ createContextId('qc-c'); +const ContentInternalContext = /* @__PURE__ */ createContextId('qc-ic'); +const DocumentHeadContext = /* @__PURE__ */ createContextId('qc-h'); +const RouteLocationContext = /* @__PURE__ */ createContextId('qc-l'); +const RouteNavigateContext = /* @__PURE__ */ createContextId('qc-n'); +const RouteActionContext = /* @__PURE__ */ createContextId('qc-a'); +const RoutePreventNavigateContext = /* @__PURE__ */ createContextId('qc-p'); + +const useContent = () => useContext(ContentContext); +const useDocumentHead = () => useContext(DocumentHeadContext); +const useLocation = () => useContext(RouteLocationContext); +const useNavigate = () => useContext(RouteNavigateContext); +const usePreventNavigateQrl = (fn) => { + if (!__EXPERIMENTAL__.preventNavigate) { + throw new Error( + 'usePreventNavigate$ is experimental and must be enabled with `experimental: ["preventNavigate"]` in the `qwikVite` plugin.' + ); + } + const registerPreventNav = useContext(RoutePreventNavigateContext); + useVisibleTask$(() => registerPreventNav(fn)); +}; +const usePreventNavigate$ = implicit$FirstArg(usePreventNavigateQrl); +const useAction = () => useContext(RouteActionContext); +const useQwikRouterEnv = () => noSerialize(useServerData('qwikrouter')); + +const Link = component$((props) => { + const nav = useNavigate(); + const loc = useLocation(); + const originalHref = props.href; + const anchorRef = useSignal(); + const { + onClick$, + prefetch: prefetchProp, + reload, + replaceState, + scroll, + ...linkProps + } = /* @__PURE__ */ (() => props)(); + const clientNavPath = untrack(getClientNavPath, { ...linkProps, reload }, loc); + linkProps.href = clientNavPath || originalHref; + const prefetchData = + (!!clientNavPath && prefetchProp !== false && prefetchProp !== 'js') || void 0; + const prefetch = + prefetchData || + (!!clientNavPath && prefetchProp !== false && untrack(shouldPreload, clientNavPath, loc)); + const handlePrefetch = prefetch + ? $((_, elm) => { + if (navigator.connection?.saveData) { + return; + } + if (elm && elm.href) { + const url = new URL(elm.href); + preloadRouteBundles(url.pathname); + if (elm.hasAttribute('data-prefetch')) { + loadClientData(url, { + preloadRouteBundles: false, + isPrefetch: true, + }); + } + } + }) + : void 0; + const preventDefault = clientNavPath + ? sync$((event) => { + if (!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) { + event.preventDefault(); + } + }) + : void 0; + const handleClientSideNavigation = clientNavPath + ? $((event, elm) => { + if (event.defaultPrevented) { + if (elm.href) { + elm.setAttribute('aria-pressed', 'true'); + nav(elm.href, { forceReload: reload, replaceState, scroll }).then(() => { + elm.removeAttribute('aria-pressed'); + }); + } + } + }) + : void 0; + const handlePreload = $((_, elm) => { + const url = new URL(elm.href); + preloadRouteBundles(url.pathname, 1); + }); + useVisibleTask$(({ track }) => { + track(() => loc.url.pathname); + const handler = linkProps.onQVisible$; + if (handler) { + const event = new CustomEvent('qvisible'); + if (Array.isArray(handler)) { + handler.flat(10).forEach((handler2) => handler2?.(event, anchorRef.value)); + } else { + handler?.(event, anchorRef.value); + } + } + if (!isDev && anchorRef.value) { + handlePrefetch?.(void 0, anchorRef.value); + } + }); + return /* @__PURE__ */ jsx('a', { + ref: anchorRef, + ...{ 'q:link': !!clientNavPath }, + ...linkProps, + onClick$: [ + preventDefault, + handlePreload, + // needs to be in between preventDefault and onClick$ to ensure it starts asap. + onClick$, + handleClientSideNavigation, + ], + 'data-prefetch': prefetchData, + onMouseOver$: [linkProps.onMouseOver$, handlePrefetch], + onFocus$: [linkProps.onFocus$, handlePrefetch], + onQVisible$: [], + children: /* @__PURE__ */ jsx(Slot, {}), + }); +}); + +const resolveHead = (endpoint, routeLocation, contentModules, locale, defaults) => + withLocale(locale, () => { + const head = createDocumentHead(defaults); + const getData = (loaderOrAction) => { + const id = loaderOrAction.__id; + if (loaderOrAction.__brand === 'server_loader') { + if (!(id in endpoint.loaders)) { + throw new Error( + 'You can not get the returned data of a loader that has not been executed for this request.' + ); + } + } + const data = endpoint.loaders[id]; + if (isPromise(data)) { + throw new Error('Loaders returning a promise can not be resolved for the head function.'); + } + return data; + }; + const fns = []; + for (const contentModule of contentModules) { + const contentModuleHead = contentModule?.head; + if (contentModuleHead) { + if (typeof contentModuleHead === 'function') { + fns.unshift(contentModuleHead); + } else if (typeof contentModuleHead === 'object') { + resolveDocumentHead(head, contentModuleHead); + } + } + } + if (fns.length) { + const headProps = { + head, + withLocale: (fn) => fn(), + resolveValue: getData, + ...routeLocation, + }; + for (const fn of fns) { + resolveDocumentHead(head, fn(headProps)); + } + } + return head; + }); +const resolveDocumentHead = (resolvedHead, updatedHead) => { + if (typeof updatedHead.title === 'string') { + resolvedHead.title = updatedHead.title; + } + mergeArray(resolvedHead.meta, updatedHead.meta); + mergeArray(resolvedHead.links, updatedHead.links); + mergeArray(resolvedHead.styles, updatedHead.styles); + mergeArray(resolvedHead.scripts, updatedHead.scripts); + Object.assign(resolvedHead.frontmatter, updatedHead.frontmatter); +}; +const mergeArray = (existingArr, newArr) => { + if (Array.isArray(newArr)) { + for (const newItem of newArr) { + if (typeof newItem.key === 'string') { + const existingIndex = existingArr.findIndex((i) => i.key === newItem.key); + if (existingIndex > -1) { + existingArr[existingIndex] = newItem; + continue; + } + } + existingArr.push(newItem); + } + } +}; +const createDocumentHead = (defaults) => ({ + title: defaults?.title || '', + meta: [...(defaults?.meta || [])], + links: [...(defaults?.links || [])], + styles: [...(defaults?.styles || [])], + scripts: [...(defaults?.scripts || [])], + frontmatter: { ...defaults?.frontmatter }, +}); + +const transitionCss = + '@layer qwik{@supports selector(html:active-view-transition-type(type)){html:active-view-transition-type(qwik-navigation){:root{view-transition-name:none}}}@supports not selector(html:active-view-transition-type(type)){:root{view-transition-name:none}}}'; + +function callRestoreScrollOnDocument() { + if (document.__q_scroll_restore__) { + document.__q_scroll_restore__(); + document.__q_scroll_restore__ = void 0; + } +} +const restoreScroll = (type, toUrl, fromUrl, scroller, scrollState) => { + if (type === 'popstate' && scrollState) { + scroller.scrollTo(scrollState.x, scrollState.y); + } else if (type === 'link' || type === 'form') { + if (!hashScroll(toUrl, fromUrl)) { + scroller.scrollTo(0, 0); + } + } +}; +const hashScroll = (toUrl, fromUrl) => { + const elmId = toUrl.hash.slice(1); + const elm = elmId && document.getElementById(elmId); + if (elm) { + elm.scrollIntoView(); + return true; + } else if (!elm && toUrl.hash && isSamePath(toUrl, fromUrl)) { + return true; + } + return false; +}; +const currentScrollState = (elm) => { + return { + x: elm.scrollLeft, + y: elm.scrollTop, + w: Math.max(elm.scrollWidth, elm.clientWidth), + h: Math.max(elm.scrollHeight, elm.clientHeight), + }; +}; +const getScrollHistory = () => { + const state = history.state; + return state?._qRouterScroll; +}; +const saveScrollHistory = (scrollState) => { + const state = history.state || {}; + state._qRouterScroll = scrollState; + history.replaceState(state, ''); +}; + +const spaInit = event$((_, el) => { + if (!window._qRouterSPA && !window._qRouterInitPopstate) { + const currentPath = location.pathname + location.search; + const checkAndScroll = (scrollState) => { + if (scrollState) { + window.scrollTo(scrollState.x, scrollState.y); + } + }; + const currentScrollState = () => { + const elm = document.documentElement; + return { + x: elm.scrollLeft, + y: elm.scrollTop, + w: Math.max(elm.scrollWidth, elm.clientWidth), + h: Math.max(elm.scrollHeight, elm.clientHeight), + }; + }; + const saveScrollState = (scrollState) => { + const state = history.state || {}; + state._qRouterScroll = scrollState || currentScrollState(); + history.replaceState(state, ''); + }; + saveScrollState(); + window._qRouterInitPopstate = () => { + if (window._qRouterSPA) { + return; + } + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + if (currentPath !== location.pathname + location.search) { + const getContainer = (el2) => + el2.closest('[q\\:container]:not([q\\:container=html]):not([q\\:container=text])'); + const container = getContainer(el); + const domContainer = container.qContainer; + const hostElement = domContainer.vNodeLocate(el); + const nav = domContainer?.resolveContext(hostElement, { + id: 'qc--n', + }); + if (nav) { + nav(location.href, { type: 'popstate' }); + } else { + location.reload(); + } + } else { + if (history.scrollRestoration === 'manual') { + const scrollState = history.state?._qRouterScroll; + checkAndScroll(scrollState); + window._qRouterScrollEnabled = true; + } + } + }; + if (!window._qRouterHistoryPatch) { + window._qRouterHistoryPatch = true; + const pushState = history.pushState; + const replaceState = history.replaceState; + const prepareState = (state) => { + if (state === null || typeof state === 'undefined') { + state = {}; + } else if (state?.constructor !== Object) { + state = { _data: state }; + if (isDev) { + console.warn( + 'In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`' + ); + } + } + state._qRouterScroll = state._qRouterScroll || currentScrollState(); + return state; + }; + history.pushState = (state, title, url) => { + state = prepareState(state); + return pushState.call(history, state, title, url); + }; + history.replaceState = (state, title, url) => { + state = prepareState(state); + return replaceState.call(history, state, title, url); + }; + } + window._qRouterInitAnchors = (event) => { + if (window._qRouterSPA || event.defaultPrevented) { + return; + } + const target = event.target.closest('a[href]'); + if (target && !target.hasAttribute('preventdefault:click')) { + const href = target.getAttribute('href'); + const prev = new URL(location.href); + const dest = new URL(href, prev); + const sameOrigin = dest.origin === prev.origin; + const samePath = dest.pathname + dest.search === prev.pathname + prev.search; + if (sameOrigin && samePath) { + event.preventDefault(); + if (dest.href !== prev.href) { + history.pushState(null, '', dest); + } + if (!dest.hash) { + if (dest.href.endsWith('#')) { + window.scrollTo(0, 0); + } else { + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + saveScrollState({ ...currentScrollState(), x: 0, y: 0 }); + location.reload(); + } + } else { + const elmId = dest.hash.slice(1); + const elm = document.getElementById(elmId); + if (elm) { + elm.scrollIntoView(); + } + } + } + } + }; + window._qRouterInitVisibility = () => { + if ( + !window._qRouterSPA && + window._qRouterScrollEnabled && + document.visibilityState === 'hidden' + ) { + saveScrollState(); + } + }; + window._qRouterInitScroll = () => { + if (window._qRouterSPA || !window._qRouterScrollEnabled) { + return; + } + clearTimeout(window._qRouterScrollDebounce); + window._qRouterScrollDebounce = setTimeout(() => { + saveScrollState(); + window._qRouterScrollDebounce = void 0; + }, 200); + }; + window._qRouterScrollEnabled = true; + setTimeout(() => { + window.addEventListener('popstate', window._qRouterInitPopstate); + window.addEventListener('scroll', window._qRouterInitScroll, { passive: true }); + document.addEventListener('click', window._qRouterInitAnchors); + if (!window.navigation) { + document.addEventListener('visibilitychange', window._qRouterInitVisibility, { + passive: true, + }); + } + }, 0); + } +}); + +const startViewTransition = (params) => { + if (!params.update) { + return; + } + if ('startViewTransition' in document) { + let transition; + try { + transition = document.startViewTransition(params); + } catch { + transition = document.startViewTransition(params.update); + } + const event = new CustomEvent('qviewtransition', { detail: transition }); + document.dispatchEvent(event); + return transition; + } else { + params.update?.(); + } +}; + +const QWIK_CITY_SCROLLER = '_qCityScroller'; +const QWIK_ROUTER_SCROLLER = '_qRouterScroller'; +const preventNav = {}; +const internalState = { navCount: 0 }; +const useQwikRouter = (props) => { + if (!isServer) { + throw new Error( + 'useQwikRouter can only run during SSR on the server. If you are seeing this, it means you are re-rendering the root of your application. Fix that or use the component around the root of your application.' + ); + } + useStyles$(transitionCss); + const env = useQwikRouterEnv(); + if (!env?.params) { + throw new Error( + `Missing Qwik Router Env Data for help visit https://github.com/QwikDev/qwik/issues/6237` + ); + } + const urlEnv = useServerData('url'); + if (!urlEnv) { + throw new Error(`Missing Qwik URL Env Data`); + } + const serverHead = useServerData('documentHead'); + if ( + env.ev.originalUrl.pathname !== env.ev.url.pathname && + !__EXPERIMENTAL__.enableRequestRewrite + ) { + throw new Error( + `enableRequestRewrite is an experimental feature and is not enabled. Please enable the feature flag by adding \`experimental: ["enableRequestRewrite"]\` to your qwikVite plugin options.` + ); + } + const url = new URL(urlEnv); + const routeLocationTarget = { + url, + params: env.params, + isNavigating: false, + prevUrl: void 0, + }; + const routeLocation = useStore(routeLocationTarget, { deep: false }); + const navResolver = {}; + const container = _getContextContainer(); + const getSerializationStrategy = (loaderId) => { + return ( + env.response.loadersSerializationStrategy.get(loaderId) || + DEFAULT_LOADERS_SERIALIZATION_STRATEGY + ); + }; + const loadersObject = {}; + const loaderState = {}; + for (const [key, value] of Object.entries(env.response.loaders)) { + loadersObject[key] = value; + loaderState[key] = createLoaderSignal( + loadersObject, + key, + url, + getSerializationStrategy(key), + container + ); + } + loadersObject[SerializerSymbol] = (obj) => { + const loadersSerializationObject = {}; + for (const [k, v] of Object.entries(obj)) { + loadersSerializationObject[k] = getSerializationStrategy(k) === 'always' ? v : _UNINITIALIZED; + } + return loadersSerializationObject; + }; + const routeInternal = useSignal({ + type: 'initial', + dest: url, + scroll: true, + }); + const documentHead = useStore(() => createDocumentHead(serverHead)); + const content = useStore({ + headings: void 0, + menu: void 0, + }); + const contentInternal = useSignal(); + const currentActionId = env.response.action; + const currentAction = currentActionId ? env.response.loaders[currentActionId] : void 0; + const actionState = useSignal( + currentAction + ? { + id: currentActionId, + data: env.response.formData, + output: { + result: currentAction, + status: env.response.status, + }, + } + : void 0 + ); + const registerPreventNav = $((fn$) => { + if (!isBrowser) { + return; + } + preventNav.$handler$ ||= (event) => { + internalState.navCount++; + if (!preventNav.$cbs$) { + return; + } + const prevents = [...preventNav.$cbs$.values()].map((cb) => + cb.resolved ? cb.resolved() : cb() + ); + if (prevents.some(Boolean)) { + event.preventDefault(); + event.returnValue = true; + } + }; + (preventNav.$cbs$ ||= /* @__PURE__ */ new Set()).add(fn$); + fn$.resolve(); + window.addEventListener('beforeunload', preventNav.$handler$); + return () => { + if (preventNav.$cbs$) { + preventNav.$cbs$.delete(fn$); + if (!preventNav.$cbs$.size) { + preventNav.$cbs$ = void 0; + window.removeEventListener('beforeunload', preventNav.$handler$); + } + } + }; + }); + const goto = $(async (path, opt) => { + const { + type = 'link', + forceReload = path === void 0, + // Hack for nav() because this API is already set. + replaceState = false, + scroll = true, + } = typeof opt === 'object' ? opt : { forceReload: opt }; + internalState.navCount++; + if (isBrowser && type === 'link' && routeInternal.value.type === 'initial') { + const url2 = new URL(window.location.href); + routeInternal.value.dest = url2; + routeLocation.url = url2; + } + const lastDest = routeInternal.value.dest; + const dest = + path === void 0 ? lastDest : typeof path === 'number' ? path : toUrl(path, routeLocation.url); + if ( + preventNav.$cbs$ && + (forceReload || + typeof dest === 'number' || + !isSamePath(dest, lastDest) || + !isSameOrigin(dest, lastDest)) + ) { + const ourNavId = internalState.navCount; + const prevents = await Promise.all([...preventNav.$cbs$.values()].map((cb) => cb(dest))); + if (ourNavId !== internalState.navCount || prevents.some(Boolean)) { + if (ourNavId === internalState.navCount && type === 'popstate') { + history.pushState(null, '', lastDest); + } + return; + } + } + if (typeof dest === 'number') { + if (isBrowser) { + history.go(dest); + } + return; + } + if (!isSameOrigin(dest, lastDest)) { + if (isBrowser) { + location.href = dest.href; + } + return; + } + if (!forceReload && isSamePath(dest, lastDest)) { + if (isBrowser) { + if (type === 'link' && dest.href !== location.href) { + history.pushState(null, '', dest); + } + let scroller = document.getElementById(QWIK_ROUTER_SCROLLER); + if (!scroller) { + scroller = document.getElementById(QWIK_CITY_SCROLLER); + if (scroller && isDev) { + console.warn( + `Please update your scroller ID to "${QWIK_ROUTER_SCROLLER}" as "${QWIK_CITY_SCROLLER}" is deprecated and will be removed in V3` + ); + } + } + if (!scroller) { + scroller = document.documentElement; + } + restoreScroll(type, dest, new URL(location.href), scroller, getScrollHistory()); + if (type === 'popstate') { + window._qRouterScrollEnabled = true; + } + } + return; + } + routeInternal.value = { + type, + dest, + forceReload, + replaceState, + scroll, + }; + if (isBrowser) { + loadClientData(dest); + loadRoute( + qwikRouterConfig.routes, + qwikRouterConfig.menus, + qwikRouterConfig.cacheModules, + dest.pathname + ); + } + actionState.value = void 0; + routeLocation.isNavigating = true; + return new Promise((resolve) => { + navResolver.r = resolve; + }); + }); + useContextProvider(ContentContext, content); + useContextProvider(ContentInternalContext, contentInternal); + useContextProvider(DocumentHeadContext, documentHead); + useContextProvider(RouteLocationContext, routeLocation); + useContextProvider(RouteNavigateContext, goto); + useContextProvider(RouteStateContext, loaderState); + useContextProvider(RouteActionContext, actionState); + useContextProvider(RoutePreventNavigateContext, registerPreventNav); + useTask$(({ track }) => { + async function run() { + const navigation = track(routeInternal); + const action = track(actionState); + const locale = getLocale(''); + const prevUrl = routeLocation.url; + const navType = action ? 'form' : navigation.type; + const replaceState = navigation.replaceState; + let trackUrl; + let clientPageData; + let loadedRoute = null; + let container2; + if (isServer) { + trackUrl = new URL(navigation.dest, routeLocation.url); + loadedRoute = env.loadedRoute; + clientPageData = env.response; + } else { + trackUrl = new URL(navigation.dest, location); + if (trackUrl.pathname.endsWith('/')) { + if (globalThis.__NO_TRAILING_SLASH__) { + trackUrl.pathname = trackUrl.pathname.slice(0, -1); + } + } else if (!globalThis.__NO_TRAILING_SLASH__) { + trackUrl.pathname += '/'; + } + let loadRoutePromise = loadRoute( + qwikRouterConfig.routes, + qwikRouterConfig.menus, + qwikRouterConfig.cacheModules, + trackUrl.pathname + ); + container2 = _getContextContainer(); + const pageData = (clientPageData = await loadClientData(trackUrl, { + action, + clearCache: true, + })); + if (!pageData) { + routeInternal.untrackedValue = { type: navType, dest: trackUrl }; + return; + } + const newHref = pageData.href; + const newURL = new URL(newHref, trackUrl); + if (!isSamePath(newURL, trackUrl)) { + if (!pageData.isRewrite) { + trackUrl = newURL; + } + loadRoutePromise = loadRoute( + qwikRouterConfig.routes, + qwikRouterConfig.menus, + qwikRouterConfig.cacheModules, + newURL.pathname + // Load the actual required path. + ); + } + try { + loadedRoute = await loadRoutePromise; + } catch (e) { + console.error(e); + window.location.href = newHref; + return; + } + } + if (loadedRoute) { + const [routeName, params, mods, menu] = loadedRoute; + const contentModules = mods; + const pageModule = contentModules[contentModules.length - 1]; + if (navigation.dest.search && !!isSamePath(trackUrl, prevUrl)) { + trackUrl.search = navigation.dest.search; + } + let shouldForcePrevUrl = false; + let shouldForceUrl = false; + let shouldForceParams = false; + if (!isSamePath(trackUrl, prevUrl)) { + if (_hasStoreEffects(routeLocation, 'prevUrl')) { + shouldForcePrevUrl = true; + } + routeLocationTarget.prevUrl = prevUrl; + } + if (routeLocationTarget.url !== trackUrl) { + if (_hasStoreEffects(routeLocation, 'url')) { + shouldForceUrl = true; + } + routeLocationTarget.url = trackUrl; + } + if (routeLocationTarget.params !== params) { + if (_hasStoreEffects(routeLocation, 'params')) { + shouldForceParams = true; + } + routeLocationTarget.params = params; + } + routeInternal.untrackedValue = { type: navType, dest: trackUrl }; + const resolvedHead = resolveHead( + clientPageData, + routeLocation, + contentModules, + locale, + serverHead + ); + content.headings = pageModule.headings; + content.menu = menu; + contentInternal.untrackedValue = noSerialize(contentModules); + documentHead.links = resolvedHead.links; + documentHead.meta = resolvedHead.meta; + documentHead.styles = resolvedHead.styles; + documentHead.scripts = resolvedHead.scripts; + documentHead.title = resolvedHead.title; + documentHead.frontmatter = resolvedHead.frontmatter; + if (isBrowser) { + let scrollState; + if (navType === 'popstate') { + scrollState = getScrollHistory(); + } + const scroller = + document.getElementById(QWIK_ROUTER_SCROLLER) ?? document.documentElement; + if ( + (navigation.scroll && + (!navigation.forceReload || !isSamePath(trackUrl, prevUrl)) && + (navType === 'link' || navType === 'popstate')) || // Action might have responded with a redirect. + (navType === 'form' && !isSamePath(trackUrl, prevUrl)) + ) { + document.__q_scroll_restore__ = () => + restoreScroll(navType, trackUrl, prevUrl, scroller, scrollState); + } + const loaders = clientPageData?.loaders; + if (loaders) { + const container3 = _getContextContainer(); + for (const [key, value] of Object.entries(loaders)) { + const signal = loaderState[key]; + const awaitedValue = await value; + loadersObject[key] = awaitedValue; + if (!signal) { + loaderState[key] = createLoaderSignal( + loadersObject, + key, + trackUrl, + DEFAULT_LOADERS_SERIALIZATION_STRATEGY, + container3 + ); + } else { + signal.invalidate(); + } + } + } + CLIENT_DATA_CACHE.clear(); + if (!window._qRouterSPA) { + window._qRouterSPA = true; + history.scrollRestoration = 'manual'; + window.addEventListener('popstate', () => { + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + goto(location.href, { + type: 'popstate', + }); + }); + window.removeEventListener('popstate', window._qRouterInitPopstate); + window._qRouterInitPopstate = void 0; + if (!window._qRouterHistoryPatch) { + window._qRouterHistoryPatch = true; + const pushState = history.pushState; + const replaceState2 = history.replaceState; + const prepareState = (state) => { + if (state === null || typeof state === 'undefined') { + state = {}; + } else if (state?.constructor !== Object) { + state = { _data: state }; + if (isDev) { + console.warn( + 'In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`' + ); + } + } + state._qRouterScroll = state._qRouterScroll || currentScrollState(scroller); + return state; + }; + history.pushState = (state, title, url2) => { + state = prepareState(state); + return pushState.call(history, state, title, url2); + }; + history.replaceState = (state, title, url2) => { + state = prepareState(state); + return replaceState2.call(history, state, title, url2); + }; + } + document.addEventListener('click', (event) => { + if (event.defaultPrevented) { + return; + } + const target = event.target.closest('a[href]'); + if (target && !target.hasAttribute('preventdefault:click')) { + const href = target.getAttribute('href'); + const prev = new URL(location.href); + const dest = new URL(href, prev); + if (isSameOrigin(dest, prev) && isSamePath(dest, prev)) { + event.preventDefault(); + if (!dest.hash && !dest.href.endsWith('#')) { + if (dest.href !== prev.href) { + history.pushState(null, '', dest); + } + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + saveScrollHistory({ + ...currentScrollState(scroller), + x: 0, + y: 0, + }); + location.reload(); + return; + } + goto(target.getAttribute('href')); + } + } + }); + document.removeEventListener('click', window._qRouterInitAnchors); + window._qRouterInitAnchors = void 0; + if (!window.navigation) { + document.addEventListener( + 'visibilitychange', + () => { + if ( + (window._qRouterScrollEnabled || window._qCityScrollEnabled) && + document.visibilityState === 'hidden' + ) { + if (window._qCityScrollEnabled) { + console.warn( + '"_qCityScrollEnabled" is deprecated. Use "_qRouterScrollEnabled" instead.' + ); + } + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + } + }, + { passive: true } + ); + document.removeEventListener('visibilitychange', window._qRouterInitVisibility); + window._qRouterInitVisibility = void 0; + } + window.addEventListener( + 'scroll', + () => { + if (!window._qRouterScrollEnabled && !window._qCityScrollEnabled) { + return; + } + clearTimeout(window._qRouterScrollDebounce); + window._qRouterScrollDebounce = setTimeout(() => { + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + window._qRouterScrollDebounce = void 0; + }, 200); + }, + { passive: true } + ); + removeEventListener('scroll', window._qRouterInitScroll); + window._qRouterInitScroll = void 0; + spaInit.resolve(); + } + if (navType !== 'popstate') { + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + } + const navigate = () => { + clientNavigate(window, navType, prevUrl, trackUrl, replaceState); + contentInternal.trigger(); + return _waitUntilRendered(container2); + }; + const _waitNextPage = () => { + if (isServer || props?.viewTransition === false) { + return navigate(); + } else { + const viewTransition = startViewTransition({ + update: navigate, + types: ['qwik-navigation'], + }); + if (!viewTransition) { + return Promise.resolve(); + } + return viewTransition.ready; + } + }; + _waitNextPage() + .catch((err) => { + navigate(); + throw err; + }) + .finally(() => { + container2.element.setAttribute?.(Q_ROUTE, routeName); + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + window._qRouterScrollEnabled = true; + if (isBrowser) { + callRestoreScrollOnDocument(); + } + if (shouldForcePrevUrl) { + forceStoreEffects(routeLocation, 'prevUrl'); + } + if (shouldForceUrl) { + forceStoreEffects(routeLocation, 'url'); + } + if (shouldForceParams) { + forceStoreEffects(routeLocation, 'params'); + } + routeLocation.isNavigating = false; + navResolver.r?.(); + }); + } + } + } + if (isServer) { + return run(); + } else { + run(); + } + }); +}; +const QwikRouterProvider = component$((props) => { + useQwikRouter(props); + return /* @__PURE__ */ jsx(Slot, {}); +}); +const QwikCityProvider = QwikRouterProvider; +const useQwikMockRouter = (props) => { + const urlEnv = props.url ?? 'http://localhost/'; + const url = new URL(urlEnv); + const routeLocation = useStore( + { + url, + params: props.params ?? {}, + isNavigating: false, + prevUrl: void 0, + }, + { deep: false } + ); + const loadersData = props.loaders?.reduce((acc, { loader, data }) => { + acc[loader.__id] = data; + return acc; + }, {}); + const loaderState = useStore(loadersData ?? {}, { deep: false }); + const goto = + props.goto ?? + $(async () => { + console.warn('QwikRouterMockProvider: goto not provided'); + }); + const documentHead = useStore(createDocumentHead, { deep: false }); + const content = useStore( + { + headings: void 0, + menu: void 0, + }, + { deep: false } + ); + const contentInternal = useSignal(); + const actionState = useSignal(); + useContextProvider(ContentContext, content); + useContextProvider(ContentInternalContext, contentInternal); + useContextProvider(DocumentHeadContext, documentHead); + useContextProvider(RouteLocationContext, routeLocation); + useContextProvider(RouteNavigateContext, goto); + useContextProvider(RouteStateContext, loaderState); + useContextProvider(RouteActionContext, actionState); + const actionsMocks = props.actions?.reduce((acc, { action, handler }) => { + acc[action.__id] = handler; + return acc; + }, {}); + useTask$(async ({ track }) => { + const action = track(actionState); + if (!action?.resolve) { + return; + } + const mock = actionsMocks?.[action.id]; + if (mock) { + const actionResult = await mock(action.data); + action.resolve(actionResult); + } + }); +}; +const QwikRouterMockProvider = component$((props) => { + useQwikMockRouter(props); + return /* @__PURE__ */ jsx(Slot, {}); +}); +const QwikCityMockProvider = QwikRouterMockProvider; + +const RouterOutlet = component$(() => { + const serverData = useServerData('containerAttributes'); + if (!serverData) { + throw new Error('PrefetchServiceWorker component must be rendered on the server.'); + } + const internalContext = useContext(ContentInternalContext); + const contents = internalContext.value; + if (contents && contents.length > 0) { + const contentsLen = contents.length; + let cmp = null; + for (let i = contentsLen - 1; i >= 0; i--) { + if (contents[i].default) { + cmp = jsx$1(contents[i].default, { + children: cmp, + }); + } + } + return /* @__PURE__ */ jsxs(Fragment, { + children: [ + cmp, + !__EXPERIMENTAL__.noSPA && + /* @__PURE__ */ jsx('script', { + 'document:onQCInit$': spaInit, + 'document:onQInit$': sync$(() => { + ((w, h) => { + if (!w._qcs && h.scrollRestoration === 'manual') { + w._qcs = true; + const s = h.state?._qRouterScroll; + if (s) { + w.scrollTo(s.x, s.y); + } + document.dispatchEvent(new Event('qcinit')); + } + })(window, history); + }), + }), + ], + }); + } + return SkipRender; +}); + +const routeActionQrl = (actionQrl, ...rest) => { + const { id, validators } = getValidators(rest, actionQrl); + function action() { + const loc = useLocation(); + const currentAction = useAction(); + const initialState = { + actionPath: `?${QACTION_KEY}=${id}`, + submitted: false, + isRunning: false, + status: void 0, + value: void 0, + formData: void 0, + }; + const state = useStore(() => { + const value = currentAction.value; + if (value && value?.id === id) { + const data = value.data; + if (data instanceof FormData) { + initialState.formData = data; + } + if (value.output) { + const { status, result } = value.output; + initialState.status = status; + initialState.value = result; + } + } + return initialState; + }); + const submit = $((input = {}) => { + if (isServer) { + throw new Error(`Actions can not be invoked within the server during SSR. +Action.run() can only be called on the browser, for example when a user clicks a button, or submits a form.`); + } + let data; + let form; + if (input instanceof SubmitEvent) { + form = input.target; + data = new FormData(form); + if ( + (input.submitter instanceof HTMLInputElement || + input.submitter instanceof HTMLButtonElement) && + input.submitter.name + ) { + if (input.submitter.name) { + data.append(input.submitter.name, input.submitter.value); + } + } + } else { + data = input; + } + return new Promise((resolve) => { + if (data instanceof FormData) { + state.formData = data; + } + state.submitted = true; + state.isRunning = true; + loc.isNavigating = true; + currentAction.value = { + data, + id, + resolve: noSerialize(resolve), + }; + }).then(({ result, status }) => { + state.isRunning = false; + state.status = status; + state.value = result; + if (form) { + if (form.getAttribute('data-spa-reset') === 'true') { + form.reset(); + } + const detail = { status, value: result }; + form.dispatchEvent( + new CustomEvent('submitcompleted', { + bubbles: false, + cancelable: false, + composed: false, + detail, + }) + ); + } + return { + status, + value: result, + }; + }); + }); + initialState.submit = submit; + return state; + } + action.__brand = 'server_action'; + action.__validators = validators; + action.__qrl = actionQrl; + action.__id = id; + Object.freeze(action); + return action; +}; +const globalActionQrl = (actionQrl, ...rest) => { + const action = routeActionQrl(actionQrl, ...rest); + if (isServer) { + if (typeof globalThis._qwikActionsMap === 'undefined') { + globalThis._qwikActionsMap = /* @__PURE__ */ new Map(); + } + globalThis._qwikActionsMap.set(action.__id, action); + } + return action; +}; +const routeAction$ = /* @__PURE__ */ implicit$FirstArg(routeActionQrl); +const globalAction$ = /* @__PURE__ */ implicit$FirstArg(globalActionQrl); +const getValue = (obj) => obj.value; +const routeLoaderQrl = (loaderQrl, ...rest) => { + const { id, validators, serializationStrategy } = getValidators(rest, loaderQrl); + function loader() { + const state = _resolveContextWithoutSequentialScope(RouteStateContext); + if (!(id in state)) { + throw new Error(`routeLoader$ "${loaderQrl.getSymbol()}" was invoked in a route where it was not declared. + This is because the routeLoader$ was not exported in a 'layout.tsx' or 'index.tsx' file of the existing route. + For more information check: https://qwik.dev/docs/route-loader/ + + If your are managing reusable logic or a library it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception. + For more information check: https://qwik.dev/docs/re-exporting-loaders/`); + } + const loaderData = state[id]; + untrack(getValue, loaderData); + return loaderData; + } + loader.__brand = 'server_loader'; + loader.__qrl = loaderQrl; + loader.__validators = validators; + loader.__id = id; + loader.__serializationStrategy = serializationStrategy; + loader.__expires = -1; + Object.freeze(loader); + return loader; +}; +const routeLoader$ = /* @__PURE__ */ implicit$FirstArg(routeLoaderQrl); +const validatorQrl = (validator) => { + if (isServer) { + return { + validate: validator, + }; + } + return void 0; +}; +const validator$ = /* @__PURE__ */ implicit$FirstArg(validatorQrl); +const flattenValibotIssues = (issues) => { + return issues.reduce((acc, issue) => { + if (issue.path) { + const hasArrayType = issue.path.some((path) => path.type === 'array'); + if (hasArrayType) { + const keySuffix = issue.expected === 'Array' ? '[]' : ''; + const key = + issue.path + .map((item) => (item.type === 'array' ? '*' : item.key)) + .join('.') + .replace(/\.\*/g, '[]') + keySuffix; + acc[key] = acc[key] || []; + if (Array.isArray(acc[key])) { + acc[key].push(issue.message); + } + return acc; + } else { + acc[issue.path.map((item) => item.key).join('.')] = issue.message; + } + } + return acc; + }, {}); +}; +const valibotQrl = (qrl) => { + if (!__EXPERIMENTAL__.valibot) { + throw new Error( + 'Valibot is an experimental feature and is not enabled. Please enable the feature flag by adding `experimental: ["valibot"]` to your qwikVite plugin options.' + ); + } + if (isServer) { + return { + __brand: 'valibot', + async validate(ev, inputData) { + const schema = await qrl + .resolve() + .then((obj) => (typeof obj === 'function' ? obj(ev) : obj)); + const data = inputData ?? (await ev.parseBody()); + const result = await v.safeParseAsync(schema, data); + if (result.success) { + return { + success: true, + data: result.output, + }; + } else { + if (isDev) { + console.error('ERROR: Valibot validation failed', result.issues); + } + return { + success: false, + status: 400, + error: { + formErrors: v.flatten(result.issues).root ?? [], + fieldErrors: flattenValibotIssues(result.issues), + }, + }; + } + }, + }; + } + return void 0; +}; +const valibot$ = /* @__PURE__ */ implicit$FirstArg(valibotQrl); +const flattenZodIssues = (issues) => { + issues = Array.isArray(issues) ? issues : [issues]; + return issues.reduce((acc, issue) => { + const isExpectingArray = 'expected' in issue && issue.expected === 'array'; + const hasArrayType = issue.path.some((path) => typeof path === 'number') || isExpectingArray; + if (hasArrayType) { + const keySuffix = 'expected' in issue && issue.expected === 'array' ? '[]' : ''; + const key = + issue.path + .map((path) => (typeof path === 'number' ? '*' : path)) + .join('.') + .replace(/\.\*/g, '[]') + keySuffix; + acc[key] = acc[key] || []; + if (Array.isArray(acc[key])) { + acc[key].push(issue.message); + } + return acc; + } else { + acc[issue.path.join('.')] = issue.message; + } + return acc; + }, {}); +}; +const zodQrl = (qrl) => { + if (isServer) { + return { + __brand: 'zod', + async validate(ev, inputData) { + const schema = await qrl.resolve().then((obj) => { + if (typeof obj === 'function') { + obj = obj(z, ev); + } + if (obj instanceof z.Schema) { + return obj; + } else { + return z.object(obj); + } + }); + const data = inputData ?? (await ev.parseBody()); + const result = await withLocale(ev.locale(), () => schema.safeParseAsync(data)); + if (result.success) { + return result; + } else { + if (isDev) { + console.error('ERROR: Zod validation failed', result.error.issues); + } + return { + success: false, + status: 400, + error: { + formErrors: result.error.flatten().formErrors, + fieldErrors: flattenZodIssues(result.error.issues), + }, + }; + } + }, + }; + } + return void 0; +}; +const zod$ = /* @__PURE__ */ implicit$FirstArg(zodQrl); +const serverQrl = (qrl, options) => { + if (isServer) { + const captured = qrl.getCaptured(); + if (captured && captured.length > 0 && !_getContextHostElement()) { + throw new Error('For security reasons, we cannot serialize QRLs that capture lexical scope.'); + } + } + const method = options?.method?.toUpperCase?.() || 'POST'; + const headers = options?.headers || {}; + const origin = options?.origin || ''; + const fetchOptions = options?.fetchOptions || {}; + return $(async function (...args) { + const abortSignal = args.length > 0 && args[0] instanceof AbortSignal ? args.shift() : void 0; + if (isServer) { + let requestEvent = _asyncRequestStore?.getStore(); + if (!requestEvent) { + const contexts = [useQwikRouterEnv()?.ev, this, _getContextEvent()]; + requestEvent = contexts.find( + (v2) => + v2 && + Object.prototype.hasOwnProperty.call(v2, 'sharedMap') && + Object.prototype.hasOwnProperty.call(v2, 'cookie') + ); + } + return qrl.apply(requestEvent, args); + } else { + let filteredArgs = args.map((arg) => { + if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) { + return new FormData(arg.target); + } else if (arg instanceof Event) { + return null; + } else if (arg instanceof Node) { + return null; + } + return arg; + }); + if (!filteredArgs.length) { + filteredArgs = void 0; + } + const qrlHash = qrl.getHash(); + let query = ''; + const config = { + ...fetchOptions, + method, + headers: { + ...headers, + 'Content-Type': 'application/qwik-json', + Accept: 'application/json, application/qwik-json, text/qwik-json-stream, text/plain', + // Required so we don't call accidentally + 'X-QRL': qrlHash, + }, + signal: abortSignal, + }; + const captured = qrl.getCaptured(); + let toSend = [filteredArgs]; + if (captured?.length) { + toSend = [filteredArgs, ...captured]; + } else { + toSend = filteredArgs ? [filteredArgs] : []; + } + const body = await _serialize(toSend); + if (method === 'GET') { + query += `&${QDATA_KEY}=${encodeURIComponent(body)}`; + } else { + config.body = body; + } + const res = await fetch(`${origin}?${QFN_KEY}=${qrlHash}${query}`, config); + const contentType = res.headers.get('Content-Type'); + if (res.ok && contentType === 'text/qwik-json-stream' && res.body) { + return (async function* () { + try { + for await (const result of deserializeStream(res.body, abortSignal)) { + yield result; + } + } finally { + if (!abortSignal?.aborted) { + await res.body.cancel(); + } + } + })(); + } else if (contentType === 'application/qwik-json') { + const str = await res.text(); + const obj = _deserialize(str); + if (res.status >= 400) { + throw obj; + } + return obj; + } else if (contentType === 'application/json') { + const obj = await res.json(); + if (res.status >= 400) { + throw obj; + } + return obj; + } else if (contentType === 'text/plain' || contentType === 'text/html') { + const str = await res.text(); + if (res.status >= 400) { + throw str; + } + return str; + } + } + }); +}; +const server$ = /* @__PURE__ */ implicit$FirstArg(serverQrl); +const getValidators = (rest, qrl) => { + let id; + let serializationStrategy = DEFAULT_LOADERS_SERIALIZATION_STRATEGY; + const validators = []; + if (rest.length === 1) { + const options = rest[0]; + if (options && typeof options === 'object') { + if ('validate' in options) { + validators.push(options); + } else { + id = options.id; + if (options.serializationStrategy) { + serializationStrategy = options.serializationStrategy; + } + if (options.validation) { + validators.push(...options.validation); + } + } + } + } else if (rest.length > 1) { + validators.push(...rest.filter((v2) => !!v2)); + } + if (typeof id === 'string') { + if (isDev) { + if (!/^[\w/.-]+$/.test(id)) { + throw new Error(`Invalid id: ${id}, id can only contain [a-zA-Z0-9_.-]`); + } + } + id = `id_${id}`; + } else { + id = qrl.getHash(); + } + return { + validators: validators.reverse(), + id, + serializationStrategy, + }; +}; +const deserializeStream = async function* (stream, abortSignal) { + const reader = stream.getReader(); + try { + let buffer = ''; + const decoder = new TextDecoder(); + while (!abortSignal?.aborted) { + const result = await reader.read(); + if (result.done) { + break; + } + buffer += decoder.decode(result.value, { stream: true }); + const lines = buffer.split(/\n/); + buffer = lines.pop(); + for (const line of lines) { + const deserializedData = _deserialize(line); + yield deserializedData; + } + } + } finally { + reader.releaseLock(); + } +}; + +const ServiceWorkerRegister = (props) => + /* @__PURE__ */ jsx('script', { + type: 'module', + dangerouslySetInnerHTML: swRegister, + nonce: props.nonce, + }); + +const Form = ({ action, spaReset, reloadDocument, onSubmit$, ...rest }, key) => { + if (action) { + const isArrayApi = Array.isArray(onSubmit$); + if (isArrayApi) { + return jsx$1( + 'form', + { + ...rest, + action: action.actionPath, + 'preventdefault:submit': !reloadDocument, + onSubmit$: [ + ...onSubmit$, + // action.submit "submitcompleted" event for onSubmitCompleted$ events + !reloadDocument + ? $((evt) => { + if (!action.submitted) { + return action.submit(evt); + } + }) + : void 0, + ], + method: 'post', + ['data-spa-reset']: spaReset ? 'true' : void 0, + }, + key + ); + } + return jsx$1( + 'form', + { + ...rest, + action: action.actionPath, + 'preventdefault:submit': !reloadDocument, + onSubmit$: [ + // Since v2, this fires before the action is executed so it can be prevented + onSubmit$, + // action.submit "submitcompleted" event for onSubmitCompleted$ events + !reloadDocument ? action.submit : void 0, + ], + method: 'post', + ['data-spa-reset']: spaReset ? 'true' : void 0, + }, + key + ); + } else { + return /* @__PURE__ */ jsx( + GetForm, + { + spaReset, + reloadDocument, + onSubmit$, + ...rest, + }, + key + ); + } +}; +const GetForm = component$(({ action: _0, spaReset, reloadDocument, onSubmit$, ...rest }) => { + const nav = useNavigate(); + return /* @__PURE__ */ jsx('form', { + action: 'get', + 'preventdefault:submit': !reloadDocument, + 'data-spa-reset': spaReset ? 'true' : void 0, + ...rest, + onSubmit$: [ + ...(Array.isArray(onSubmit$) ? onSubmit$ : [onSubmit$]), + $(async (_evt, form) => { + const formData = new FormData(form); + const params = new URLSearchParams(); + formData.forEach((value, key) => { + if (typeof value === 'string') { + params.append(key, value); + } + }); + await nav('?' + params.toString(), { type: 'form', forceReload: true }); + }), + $((_evt, form) => { + if (form.getAttribute('data-spa-reset') === 'true') { + form.reset(); + } + form.dispatchEvent( + new CustomEvent('submitcompleted', { + bubbles: false, + cancelable: false, + composed: false, + detail: { + status: 200, + }, + }) + ); + }), + // end of array + ], + children: /* @__PURE__ */ jsx(Slot, {}), + }); +}); + +const untypedAppUrl = function appUrl(route, params, paramsPrefix = '') { + const path = route.split('/'); + for (let i = 0; i < path.length; i++) { + const segment = path[i]; + if (segment.startsWith('[') && segment.endsWith(']')) { + const isSpread = segment.startsWith('[...'); + const key = segment.substring(segment.startsWith('[...') ? 4 : 1, segment.length - 1); + const value = params ? params[paramsPrefix + key] || params[key] : ''; + path[i] = isSpread ? value : encodeURIComponent(value); + } + if (segment.startsWith('(') && segment.endsWith(')')) { + path.splice(i, 1); + } + } + let url = path.join('/'); + let baseURL = '/'; + if (baseURL) { + if (!baseURL.endsWith('/')) { + baseURL += '/'; + } + while (url.startsWith('/')) { + url = url.substring(1); + } + url = baseURL + url; + } + return url; +}; +function omitProps(obj, keys) { + const omittedObj = {}; + for (const key in obj) { + if (!key.startsWith('param:') && !keys.includes(key)) { + omittedObj[key] = obj[key]; + } + } + return omittedObj; +} + +const createRenderer = (getOptions) => { + return (opts) => { + const { jsx, options } = getOptions(opts); + return renderToStream(jsx, options); + }; +}; + +const DocumentHeadTags = component$((props) => { + let head = useDocumentHead(); + if (props) { + head = { ...head, ...props }; + } + return /* @__PURE__ */ jsxs(Fragment, { + children: [ + head.title && /* @__PURE__ */ jsx('title', { children: head.title }), + head.meta.map((m) => /* @__PURE__ */ jsx('meta', { ...m })), + head.links.map((l) => /* @__PURE__ */ jsx('link', { ...l })), + head.styles.map((s) => { + const props2 = s.props || s; + return /* @__PURE__ */ createElement('style', { + ...props2, + dangerouslySetInnerHTML: s.style || props2.dangerouslySetInnerHTML, + key: s.key, + }); + }), + head.scripts.map((s) => { + const props2 = s.props || s; + return /* @__PURE__ */ createElement('script', { + ...props2, + dangerouslySetInnerHTML: s.script || props2.dangerouslySetInnerHTML, + key: s.key, + }); + }), + ], + }); +}); + +export { + DocumentHeadTags, + ErrorBoundary, + Form, + Link, + QWIK_CITY_SCROLLER, + QWIK_ROUTER_SCROLLER, + QwikCityMockProvider, + QwikCityProvider, + QwikRouterMockProvider, + QwikRouterProvider, + RouterOutlet, + ServiceWorkerRegister, + createRenderer, + globalAction$, + globalActionQrl, + omitProps, + routeAction$, + routeActionQrl, + routeLoader$, + routeLoaderQrl, + server$, + serverQrl, + untypedAppUrl, + useContent, + useDocumentHead, + useLocation, + useNavigate, + usePreventNavigate$, + usePreventNavigateQrl, + useQwikRouter, + valibot$, + valibotQrl, + validator$, + validatorQrl, + zod$, + zodQrl, +}; + +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_GetForm_component_form_q_e_submit_1_0WWF0MwldwA.mjs (ENTRY POINT)== + +export const GetForm_component_form_q_e_submit_1_0WWF0MwldwA = (_evt, form)=>{ + if (form.getAttribute('data-spa-reset') === 'true') form.reset(); + form.dispatchEvent(new CustomEvent('submitcompleted', { + bubbles: false, + cancelable: false, + composed: false, + detail: { + status: 200 + } + })); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\"+DAknDQ,CAAC,MAAM;IACP,IAAI,KAAK,YAAY,CAAC,sBAAsB,QAC1C,KAAK,KAAK;IAEZ,KAAK,aAAa,CAChB,IAAI,YAAY,mBAAmB;QACjC,SAAS;QACT,YAAY;QACZ,UAAU;QACV,QAAQ;YACN,QAAQ;QACV;IACF;AAEJ\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "GetForm_component_form_q_e_submit_1_0WWF0MwldwA", + "entry": null, + "displayName": "index.qwik.mjs_GetForm_component_form_q_e_submit_1", + "hash": "0WWF0MwldwA", + "canonicalFilename": "index.qwik.mjs_GetForm_component_form_q_e_submit_1_0WWF0MwldwA", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": "GetForm_component_OIWHwJ5eKxg", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 55126, + 55498 + ], + "paramNames": [ + "_evt", + "form" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_GetForm_component_OIWHwJ5eKxg.mjs (ENTRY POINT)== + +import { useNavigate } from "./index.qwik.mjs"; +import { Slot } from "@qwik.dev/core"; +import { _fnSignal } from "@qwik.dev/core"; +import { _getConstProps } from "@qwik.dev/core"; +import { _getVarProps } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _jsxSplit } from "@qwik.dev/core"; +import { _restProps } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>!p0.reloadDocument; +const _hf0_str = "!p0.reloadDocument"; +const _hf1 = (p0)=>p0.spaReset ? 'true' : void 0; +const _hf1_str = 'p0.spaReset?"true":void 0'; +// +const q_GetForm_component_form_q_e_submit_1_0WWF0MwldwA = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_GetForm_component_form_q_e_submit_1_0WWF0MwldwA.mjs"), "GetForm_component_form_q_e_submit_1_0WWF0MwldwA"); +const q_GetForm_component_form_q_e_submit_D0PAP3eJ0Ng = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_GetForm_component_form_q_e_submit_D0PAP3eJ0Ng.mjs"), "GetForm_component_form_q_e_submit_D0PAP3eJ0Ng"); +// +export const GetForm_component_OIWHwJ5eKxg = (_rawProps)=>{ + const rest = _restProps(_rawProps, [ + "action", + "spaReset", + "reloadDocument", + "onSubmit$" + ]); + const nav = useNavigate(); + return /* @__PURE__ */ _jsxSplit('form', { + action: 'get', + 'preventdefault:submit': _fnSignal(_hf0, [ + _rawProps + ], _hf0_str), + 'data-spa-reset': _fnSignal(_hf1, [ + _rawProps + ], _hf1_str), + ..._getVarProps(rest), + ..._getConstProps(rest), + "q-e:submit": [ + ...Array.isArray(_rawProps.onSubmit$) ? _rawProps.onSubmit$ : [ + _rawProps.onSubmit$ + ], + q_GetForm_component_form_q_e_submit_D0PAP3eJ0Ng.w([ + nav + ]), + q_GetForm_component_form_q_e_submit_1_0WWF0MwldwA + ] + }, null, /* @__PURE__ */ _jsxSorted(Slot, null, null, null, 3, "0K_10"), 0, "0K_11"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;;;mBAmmD6B,IAJuB;;mBAK9B,GALoB,WAKT,SAAS,KAAK;;;;;;6CALpB;;;;;;;IACzB,MAAM,MAAM;IACZ,OAAO,aAAa,GAAG,UAAI;QACzB,QAAQ;QACR,uBAAuB;;;QACvB,gBAAgB;;;wBACb;0BAAA;QACH,cAAW;eACL,MAAM,OAAO,WAR6C,uBAAA,YAQnB;0BARmB;aAQR;;;;;SA2BvD;aACS,aAAa,GAAG,WAAI;AAElC\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "GetForm_component_OIWHwJ5eKxg", + "entry": null, + "displayName": "index.qwik.mjs_GetForm_component", + "hash": "OIWHwJ5eKxg", + "canonicalFilename": "index.qwik.mjs_GetForm_component_OIWHwJ5eKxg", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 54411, + 55582 + ], + "paramNames": [ + "_rawProps" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_useQwikRouter_useStyles_XNocHv0sxCQ.mjs (ENTRY POINT)== + +export const useQwikRouter_useStyles_XNocHv0sxCQ = '@layer qwik{@supports selector(html:active-view-transition-type(type)){html:active-view-transition-type(qwik-navigation){:root{view-transition-name:none}}}@supports not selector(html:active-view-transition-type(type)){:root{view-transition-name:none}}}'; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\"mDA0RE\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "useQwikRouter_useStyles_XNocHv0sxCQ", + "entry": null, + "displayName": "index.qwik.mjs_useQwikRouter_useStyles", + "hash": "XNocHv0sxCQ", + "canonicalFilename": "index.qwik.mjs_useQwikRouter_useStyles_XNocHv0sxCQ", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "useStyles$", + "captures": false, + "loc": [ + 8723, + 8977 + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_Link_component_useVisibleTask_6K6z063D0C4.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { isDev } from "@qwik.dev/core"; +// +export const Link_component_useVisibleTask_6K6z063D0C4 = ({ track })=>{ + const anchorRef = _captures[0], handlePrefetch = _captures[1], linkProps = _captures[2], loc = _captures[3]; + track(()=>loc.url.pathname); + const handler = linkProps.onQVisible$; + if (handler) { + const event = new CustomEvent('qvisible'); + if (Array.isArray(handler)) handler.flat(10).forEach((handler2)=>handler2?.(event, anchorRef.value)); + else handler?.(event, anchorRef.value); + } + if (!isDev && anchorRef.value) handlePrefetch?.(void 0, anchorRef.value); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;yDA4KkB,CAAC,EAAE,KAAK,EAAE;;IACxB,MAAM,IAAM,IAAI,GAAG,CAAC,QAAQ;IAC5B,MAAM,UAAU,UAAU,WAAW;IACrC,IAAI,SAAS;QACX,MAAM,QAAQ,IAAI,YAAY;QAC9B,IAAI,MAAM,OAAO,CAAC,UAChB,QAAQ,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,WAAa,WAAW,OAAO,UAAU,KAAK;aAExE,UAAU,OAAO,UAAU,KAAK;IAEpC;IACA,IAAI,CAAC,SAAS,UAAU,KAAK,EAC3B,iBAAiB,KAAK,GAAG,UAAU,KAAK\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "Link_component_useVisibleTask_6K6z063D0C4", + "entry": null, + "displayName": "index.qwik.mjs_Link_component_useVisibleTask", + "hash": "6K6z063D0C4", + "canonicalFilename": "index.qwik.mjs_Link_component_useVisibleTask_6K6z063D0C4", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": "Link_component_nhj84CU1784", + "ctxKind": "function", + "ctxName": "useVisibleTask$", + "captures": true, + "loc": [ + 5200, + 5650 + ], + "paramNames": [ + "{track}" + ], + "captureNames": [ + "anchorRef", + "handlePrefetch", + "linkProps", + "loc" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_RouterOutlet_component_hKWOEO9aIDM.mjs (ENTRY POINT)== + +import { _auto_ContentInternalContext as ContentInternalContext } from "./index.qwik.mjs"; +import { _auto_spaInit as spaInit } from "./index.qwik.mjs"; +import { Fragment } from "@qwik.dev/core/jsx-runtime"; +import { SkipRender } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _qrlSync } from "@qwik.dev/core"; +import { useContext } from "@qwik.dev/core"; +import { useServerData } from "@qwik.dev/core"; +// +export const RouterOutlet_component_hKWOEO9aIDM = ()=>{ + const serverData = useServerData('containerAttributes'); + if (!serverData) throw new Error('PrefetchServiceWorker component must be rendered on the server.'); + const internalContext = useContext(ContentInternalContext); + const contents = internalContext.value; + if (contents && contents.length > 0) { + const contentsLen = contents.length; + let cmp = null; + for(let i = contentsLen - 1; i >= 0; i--)if (contents[i].default) cmp = _jsxSorted(contents[i].default, null, null, cmp, 1, "0K_6"); + return /* @__PURE__ */ _jsxSorted(Fragment, null, null, [ + cmp, + !__EXPERIMENTAL__.noSPA && /* @__PURE__ */ _jsxSorted('script', { + "q-d:qinit": _qrlSync(()=>{ + ((w, h)=>{ + if (!w._qcs && h.scrollRestoration === 'manual') { + w._qcs = true; + const s = h.state?._qRouterScroll; + if (s) w.scrollTo(s.x, s.y); + document.dispatchEvent(new Event('qcinit')); + } + })(window, history); + }, '()=>{((w,h)=>{if(!w._qcs&&h.scrollRestoration==="manual"){w._qcs=true;const s=h.state?._qRouterScroll;if(s){w.scrollTo(s.x,s.y);}document.dispatchEvent(new Event("qcinit"));}})(window,history);}') + }, { + "q-d:qcinit": spaInit + }, null, 2, "0K_7") + ], 1, "0K_8"); + } + return SkipRender; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;;kDAqkCgC;IAC9B,MAAM,aAAa,cAAc;IACjC,IAAI,CAAC,YACH,MAAM,IAAI,MAAM;IAElB,MAAM,kBAAkB,WAAW;IACnC,MAAM,WAAW,gBAAgB,KAAK;IACtC,IAAI,YAAY,SAAS,MAAM,GAAG,GAAG;QACnC,MAAM,cAAc,SAAS,MAAM;QACnC,IAAI,MAAM;QACV,IAAK,IAAI,IAAI,cAAc,GAAG,KAAK,GAAG,IACpC,IAAI,QAAQ,CAAC,EAAE,CAAC,OAAO,EACrB,MAAM,WAAM,QAAQ,CAAC,EAAE,CAAC,OAAO,cACnB;QAIhB,OAAO,aAAa,GAAG,WAAK,sBAChB;YACR;YACA,CAAC,iBAAiB,KAAK,IACrB,aAAa,GAAG,WAAI;gBAElB,WAAmB,WAAQ;oBACzB,CAAC,CAAC,GAAG;wBACH,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,iBAAiB,KAAK,UAAU;4BAC/C,EAAE,IAAI,GAAG;4BACT,MAAM,IAAI,EAAE,KAAK,EAAE;4BACnB,IAAI,GACF,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;4BAErB,SAAS,aAAa,CAAC,IAAI,MAAM;wBACnC;oBACF,CAAC,EAAE,QAAQ;gBACb;;gBAZA,cAAsB;;SAc3B;IAEL;IACA,OAAO;AACT\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "RouterOutlet_component_hKWOEO9aIDM", + "entry": null, + "displayName": "index.qwik.mjs_RouterOutlet_component", + "hash": "hKWOEO9aIDM", + "canonicalFilename": "index.qwik.mjs_RouterOutlet_component_hKWOEO9aIDM", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 37647, + 38909 + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { useVisibleTaskQrl } from "@qwik.dev/core"; +import { _getVarProps } from "@qwik.dev/core"; +import { _getConstProps } from "@qwik.dev/core"; +import { _jsxSplit } from "@qwik.dev/core"; +import { eventQrl } from "@qwik.dev/core"; +import { useStylesQrl } from "@qwik.dev/core"; +import { useTaskQrl } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +import { createContextId, useContext, implicit$FirstArg, noSerialize, useServerData, useSignal, untrack, isDev, withLocale, isServer, useStore, useContextProvider } from '@qwik.dev/core'; +import { a as isSamePath, c as createLoaderSignal, D as DEFAULT_LOADERS_SERIALIZATION_STRATEGY, h as QACTION_KEY } from './chunks/routing.qwik.mjs'; +import { _getContextContainer, SerializerSymbol, _UNINITIALIZED, _getContextHostElement, _resolveContextWithoutSequentialScope } from '@qwik.dev/core/internal'; +import * as v from 'valibot'; +import * as z from 'zod'; +import swRegister from '@qwik-router-sw-register'; +import { renderToStream } from '@qwik.dev/core/server'; +import '@qwik.dev/core/preloader'; +import './chunks/types.qwik.mjs'; +// +const q_DocumentHeadTags_component_LaCcLS5Bz4c = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_DocumentHeadTags_component_LaCcLS5Bz4c.mjs"), "DocumentHeadTags_component_LaCcLS5Bz4c"); +const q_ErrorBoundary_component_yTCHi5s1o00 = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_ErrorBoundary_component_yTCHi5s1o00.mjs"), "ErrorBoundary_component_yTCHi5s1o00"); +const q_Form_form_q_e_submit_iIfbMzzXpIA = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_Form_form_q_e_submit_iIfbMzzXpIA.mjs"), "Form_form_q_e_submit_iIfbMzzXpIA"); +const q_GetForm_component_OIWHwJ5eKxg = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_GetForm_component_OIWHwJ5eKxg.mjs"), "GetForm_component_OIWHwJ5eKxg"); +const q_Link_component_nhj84CU1784 = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_Link_component_nhj84CU1784.mjs"), "Link_component_nhj84CU1784"); +const q_QwikRouterMockProvider_component_kN7AQXV0aXo = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_QwikRouterMockProvider_component_kN7AQXV0aXo.mjs"), "QwikRouterMockProvider_component_kN7AQXV0aXo"); +const q_QwikRouterProvider_component_lCQXGdS0iZM = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_QwikRouterProvider_component_lCQXGdS0iZM.mjs"), "QwikRouterProvider_component_lCQXGdS0iZM"); +const q_RouterOutlet_component_hKWOEO9aIDM = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_RouterOutlet_component_hKWOEO9aIDM.mjs"), "RouterOutlet_component_hKWOEO9aIDM"); +const q_routeActionQrl_action_submit_JY3C42B1B08 = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_routeActionQrl_action_submit_JY3C42B1B08.mjs"), "routeActionQrl_action_submit_JY3C42B1B08"); +const q_serverQrl_RA3PmZ4Oyak = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_serverQrl_RA3PmZ4Oyak.mjs"), "serverQrl_RA3PmZ4Oyak"); +const q_spaInit_event_Js1cotabL5I = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_spaInit_event_Js1cotabL5I.mjs"), "spaInit_event_Js1cotabL5I"); +const q_usePreventNavigateQrl_useVisibleTask_no0bm2fybZo = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_usePreventNavigateQrl_useVisibleTask_no0bm2fybZo.mjs"), "usePreventNavigateQrl_useVisibleTask_no0bm2fybZo"); +// +qrl(()=>import("./index.qwik.mjs_useQwikMockRouter_goto_ojVznvSDqoM.mjs"), "useQwikMockRouter_goto_ojVznvSDqoM"); +qrl(()=>import("./index.qwik.mjs_useQwikMockRouter_useTask_oml2hW1aK6I.mjs"), "useQwikMockRouter_useTask_oml2hW1aK6I"); +// +const q_useQwikRouter_goto_OSnb99dm7Ow = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_useQwikRouter_goto_OSnb99dm7Ow.mjs"), "useQwikRouter_goto_OSnb99dm7Ow"); +const q_useQwikRouter_registerPreventNav_W0LIs8PUJoA = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_useQwikRouter_registerPreventNav_W0LIs8PUJoA.mjs"), "useQwikRouter_registerPreventNav_W0LIs8PUJoA"); +const q_useQwikRouter_useStyles_XNocHv0sxCQ = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_useQwikRouter_useStyles_XNocHv0sxCQ.mjs"), "useQwikRouter_useStyles_XNocHv0sxCQ"); +const q_useQwikRouter_useTask_omhKiQfdzZU = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_useQwikRouter_useTask_omhKiQfdzZU.mjs"), "useQwikRouter_useTask_omhKiQfdzZU"); +// +export { z } from 'zod'; +const ErrorBoundary = /*#__PURE__*/ componentQrl(q_ErrorBoundary_component_yTCHi5s1o00); +const RouteStateContext = /* @__PURE__ */ createContextId('qc-s'); +const ContentContext = /* @__PURE__ */ createContextId('qc-c'); +const ContentInternalContext = /* @__PURE__ */ createContextId('qc-ic'); +const DocumentHeadContext = /* @__PURE__ */ createContextId('qc-h'); +const RouteLocationContext = /* @__PURE__ */ createContextId('qc-l'); +const RouteNavigateContext = /* @__PURE__ */ createContextId('qc-n'); +const RouteActionContext = /* @__PURE__ */ createContextId('qc-a'); +const RoutePreventNavigateContext = /* @__PURE__ */ createContextId('qc-p'); +const useContent = ()=>useContext(ContentContext); +const useDocumentHead = ()=>useContext(DocumentHeadContext); +const useLocation = ()=>useContext(RouteLocationContext); +const useNavigate = ()=>useContext(RouteNavigateContext); +const usePreventNavigateQrl = (fn)=>{ + if (!__EXPERIMENTAL__.preventNavigate) throw new Error('usePreventNavigate$ is experimental and must be enabled with `experimental: ["preventNavigate"]` in the `qwikVite` plugin.'); + const registerPreventNav = useContext(RoutePreventNavigateContext); + useVisibleTaskQrl(q_usePreventNavigateQrl_useVisibleTask_no0bm2fybZo.w([ + fn, + registerPreventNav + ])); +}; +const usePreventNavigate$ = implicit$FirstArg(usePreventNavigateQrl); +const useAction = ()=>useContext(RouteActionContext); +const useQwikRouterEnv = ()=>noSerialize(useServerData('qwikrouter')); +const Link = /*#__PURE__*/ componentQrl(q_Link_component_nhj84CU1784); +const createDocumentHead = (defaults)=>({ + title: defaults?.title || '', + meta: [ + ...defaults?.meta || [] + ], + links: [ + ...defaults?.links || [] + ], + styles: [ + ...defaults?.styles || [] + ], + scripts: [ + ...defaults?.scripts || [] + ], + frontmatter: { + ...defaults?.frontmatter + } + }); +const hashScroll = (toUrl, fromUrl)=>{ + const elmId = toUrl.hash.slice(1); + const elm = elmId && document.getElementById(elmId); + if (elm) { + elm.scrollIntoView(); + return true; + } else if (!elm && toUrl.hash && isSamePath(toUrl, fromUrl)) return true; + return false; +}; +const restoreScroll = (type, toUrl, fromUrl, scroller, scrollState)=>{ + if (type === 'popstate' && scrollState) scroller.scrollTo(scrollState.x, scrollState.y); + else if (type === 'link' || type === 'form') { + if (!hashScroll(toUrl, fromUrl)) scroller.scrollTo(0, 0); + } +}; +const getScrollHistory = ()=>{ + const state = history.state; + return state?._qRouterScroll; +}; +const spaInit = eventQrl(q_spaInit_event_Js1cotabL5I); +const QWIK_CITY_SCROLLER = '_qCityScroller'; +const QWIK_ROUTER_SCROLLER = '_qRouterScroller'; +const preventNav = {}; +const internalState = { + navCount: 0 +}; +const useQwikRouter = (props)=>{ + if (!isServer) throw new Error('useQwikRouter can only run during SSR on the server. If you are seeing this, it means you are re-rendering the root of your application. Fix that or use the component around the root of your application.'); + useStylesQrl(q_useQwikRouter_useStyles_XNocHv0sxCQ); + const env = useQwikRouterEnv(); + if (!env?.params) throw new Error(`Missing Qwik Router Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`); + const urlEnv = useServerData('url'); + if (!urlEnv) throw new Error(`Missing Qwik URL Env Data`); + const serverHead = useServerData('documentHead'); + if (env.ev.originalUrl.pathname !== env.ev.url.pathname && !__EXPERIMENTAL__.enableRequestRewrite) throw new Error(`enableRequestRewrite is an experimental feature and is not enabled. Please enable the feature flag by adding \`experimental: ["enableRequestRewrite"]\` to your qwikVite plugin options.`); + const url = new URL(urlEnv); + const routeLocationTarget = { + url, + params: env.params, + isNavigating: false, + prevUrl: void 0 + }; + const routeLocation = useStore(routeLocationTarget, { + deep: false + }); + const navResolver = {}; + const container = _getContextContainer(); + const getSerializationStrategy = (loaderId)=>{ + return env.response.loadersSerializationStrategy.get(loaderId) || DEFAULT_LOADERS_SERIALIZATION_STRATEGY; + }; + const loadersObject = {}; + const loaderState = {}; + for (const [key, value] of Object.entries(env.response.loaders)){ + loadersObject[key] = value; + loaderState[key] = createLoaderSignal(loadersObject, key, url, getSerializationStrategy(key), container); + } + loadersObject[SerializerSymbol] = (obj)=>{ + const loadersSerializationObject = {}; + for (const [k, v] of Object.entries(obj))loadersSerializationObject[k] = getSerializationStrategy(k) === 'always' ? v : _UNINITIALIZED; + return loadersSerializationObject; + }; + const routeInternal = useSignal({ + type: 'initial', + dest: url, + scroll: true + }); + const documentHead = useStore(()=>createDocumentHead(serverHead)); + const content = useStore({ + headings: void 0, + menu: void 0 + }); + const contentInternal = useSignal(); + const currentActionId = env.response.action; + const currentAction = currentActionId ? env.response.loaders[currentActionId] : void 0; + const actionState = useSignal(currentAction ? { + id: currentActionId, + data: env.response.formData, + output: { + result: currentAction, + status: env.response.status + } + } : void 0); + const registerPreventNav = q_useQwikRouter_registerPreventNav_W0LIs8PUJoA; + const goto = q_useQwikRouter_goto_OSnb99dm7Ow.w([ + actionState, + navResolver, + routeInternal, + routeLocation + ]); + useContextProvider(ContentContext, content); + useContextProvider(ContentInternalContext, contentInternal); + useContextProvider(DocumentHeadContext, documentHead); + useContextProvider(RouteLocationContext, routeLocation); + useContextProvider(RouteNavigateContext, goto); + useContextProvider(RouteStateContext, loaderState); + useContextProvider(RouteActionContext, actionState); + useContextProvider(RoutePreventNavigateContext, registerPreventNav); + useTaskQrl(q_useQwikRouter_useTask_omhKiQfdzZU.w([ + actionState, + content, + contentInternal, + documentHead, + env, + goto, + loaderState, + loadersObject, + navResolver, + props, + routeInternal, + routeLocation, + routeLocationTarget, + serverHead + ])); +}; +const QwikRouterProvider = /*#__PURE__*/ componentQrl(q_QwikRouterProvider_component_lCQXGdS0iZM); +const QwikCityProvider = QwikRouterProvider; +const QwikRouterMockProvider = /*#__PURE__*/ componentQrl(q_QwikRouterMockProvider_component_kN7AQXV0aXo); +const QwikCityMockProvider = QwikRouterMockProvider; +const RouterOutlet = /*#__PURE__*/ componentQrl(q_RouterOutlet_component_hKWOEO9aIDM); +const getValue = (obj)=>obj.value; +const validatorQrl = (validator)=>{ + if (isServer) return { + validate: validator + }; + return void 0; +}; +const validator$ = /* @__PURE__ */ implicit$FirstArg(validatorQrl); +const flattenValibotIssues = (issues)=>{ + return issues.reduce((acc, issue)=>{ + if (issue.path) { + const hasArrayType = issue.path.some((path)=>path.type === 'array'); + if (hasArrayType) { + const keySuffix = issue.expected === 'Array' ? '[]' : ''; + const key = issue.path.map((item)=>item.type === 'array' ? '*' : item.key).join('.').replace(/\.\*/g, '[]') + keySuffix; + acc[key] = acc[key] || []; + if (Array.isArray(acc[key])) acc[key].push(issue.message); + return acc; + } else acc[issue.path.map((item)=>item.key).join('.')] = issue.message; + } + return acc; + }, {}); +}; +const valibotQrl = (qrl)=>{ + if (!__EXPERIMENTAL__.valibot) throw new Error('Valibot is an experimental feature and is not enabled. Please enable the feature flag by adding `experimental: ["valibot"]` to your qwikVite plugin options.'); + if (isServer) return { + __brand: 'valibot', + async validate (ev, inputData) { + const schema = await qrl.resolve().then((obj)=>typeof obj === 'function' ? obj(ev) : obj); + const data = inputData ?? await ev.parseBody(); + const result = await v.safeParseAsync(schema, data); + if (result.success) return { + success: true, + data: result.output + }; + else { + if (isDev) console.error('ERROR: Valibot validation failed', result.issues); + return { + success: false, + status: 400, + error: { + formErrors: v.flatten(result.issues).root ?? [], + fieldErrors: flattenValibotIssues(result.issues) + } + }; + } + } + }; + return void 0; +}; +const valibot$ = /* @__PURE__ */ implicit$FirstArg(valibotQrl); +const flattenZodIssues = (issues)=>{ + issues = Array.isArray(issues) ? issues : [ + issues + ]; + return issues.reduce((acc, issue)=>{ + const isExpectingArray = 'expected' in issue && issue.expected === 'array'; + const hasArrayType = issue.path.some((path)=>typeof path === 'number') || isExpectingArray; + if (hasArrayType) { + const keySuffix = 'expected' in issue && issue.expected === 'array' ? '[]' : ''; + const key = issue.path.map((path)=>typeof path === 'number' ? '*' : path).join('.').replace(/\.\*/g, '[]') + keySuffix; + acc[key] = acc[key] || []; + if (Array.isArray(acc[key])) acc[key].push(issue.message); + return acc; + } else acc[issue.path.join('.')] = issue.message; + return acc; + }, {}); +}; +const zodQrl = (qrl)=>{ + if (isServer) return { + __brand: 'zod', + async validate (ev, inputData) { + const schema = await qrl.resolve().then((obj)=>{ + if (typeof obj === 'function') obj = obj(z, ev); + if (obj instanceof z.Schema) return obj; + else return z.object(obj); + }); + const data = inputData ?? await ev.parseBody(); + const result = await withLocale(ev.locale(), ()=>schema.safeParseAsync(data)); + if (result.success) return result; + else { + if (isDev) console.error('ERROR: Zod validation failed', result.error.issues); + return { + success: false, + status: 400, + error: { + formErrors: result.error.flatten().formErrors, + fieldErrors: flattenZodIssues(result.error.issues) + } + }; + } + } + }; + return void 0; +}; +const zod$ = /* @__PURE__ */ implicit$FirstArg(zodQrl); +const serverQrl = (qrl, options)=>{ + if (isServer) { + const captured = qrl.getCaptured(); + if (captured && captured.length > 0 && !_getContextHostElement()) throw new Error('For security reasons, we cannot serialize QRLs that capture lexical scope.'); + } + const method = options?.method?.toUpperCase?.() || 'POST'; + const headers = options?.headers || {}; + const origin = options?.origin || ''; + const fetchOptions = options?.fetchOptions || {}; + return q_serverQrl_RA3PmZ4Oyak.w([ + fetchOptions, + headers, + method, + origin, + qrl + ]); +}; +const server$ = /* @__PURE__ */ implicit$FirstArg(serverQrl); +const getValidators = (rest, qrl)=>{ + let id; + let serializationStrategy = DEFAULT_LOADERS_SERIALIZATION_STRATEGY; + const validators = []; + if (rest.length === 1) { + const options = rest[0]; + if (options && typeof options === 'object') { + if ('validate' in options) validators.push(options); + else { + id = options.id; + if (options.serializationStrategy) serializationStrategy = options.serializationStrategy; + if (options.validation) validators.push(...options.validation); + } + } + } else if (rest.length > 1) validators.push(...rest.filter((v2)=>!!v2)); + if (typeof id === 'string') { + if (isDev) { + if (!/^[\w/.-]+$/.test(id)) throw new Error(`Invalid id: ${id}, id can only contain [a-zA-Z0-9_.-]`); + } + id = `id_${id}`; + } else id = qrl.getHash(); + return { + validators: validators.reverse(), + id, + serializationStrategy + }; +}; +const routeActionQrl = (actionQrl, ...rest)=>{ + const { id, validators } = getValidators(rest, actionQrl); + function action() { + const loc = useLocation(); + const currentAction = useAction(); + const initialState = { + actionPath: `?${QACTION_KEY}=${id}`, + submitted: false, + isRunning: false, + status: void 0, + value: void 0, + formData: void 0 + }; + const state = useStore(()=>{ + const value = currentAction.value; + if (value && value?.id === id) { + const data = value.data; + if (data instanceof FormData) initialState.formData = data; + if (value.output) { + const { status, result } = value.output; + initialState.status = status; + initialState.value = result; + } + } + return initialState; + }); + const submit = q_routeActionQrl_action_submit_JY3C42B1B08.w([ + currentAction, + id, + loc, + state + ]); + initialState.submit = submit; + return state; + } + action.__brand = 'server_action'; + action.__validators = validators; + action.__qrl = actionQrl; + action.__id = id; + Object.freeze(action); + return action; +}; +const globalActionQrl = (actionQrl, ...rest)=>{ + const action = routeActionQrl(actionQrl, ...rest); + if (isServer) { + if (typeof globalThis._qwikActionsMap === 'undefined') globalThis._qwikActionsMap = /* @__PURE__ */ new Map(); + globalThis._qwikActionsMap.set(action.__id, action); + } + return action; +}; +const routeAction$ = /* @__PURE__ */ implicit$FirstArg(routeActionQrl); +const globalAction$ = /* @__PURE__ */ implicit$FirstArg(globalActionQrl); +const routeLoaderQrl = (loaderQrl, ...rest)=>{ + const { id, validators, serializationStrategy } = getValidators(rest, loaderQrl); + function loader() { + const state = _resolveContextWithoutSequentialScope(RouteStateContext); + if (!(id in state)) throw new Error(`routeLoader$ "${loaderQrl.getSymbol()}" was invoked in a route where it was not declared. + This is because the routeLoader$ was not exported in a 'layout.tsx' or 'index.tsx' file of the existing route. + For more information check: https://qwik.dev/docs/route-loader/ + + If your are managing reusable logic or a library it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception. + For more information check: https://qwik.dev/docs/re-exporting-loaders/`); + const loaderData = state[id]; + untrack(getValue, loaderData); + return loaderData; + } + loader.__brand = 'server_loader'; + loader.__qrl = loaderQrl; + loader.__validators = validators; + loader.__id = id; + loader.__serializationStrategy = serializationStrategy; + loader.__expires = -1; + Object.freeze(loader); + return loader; +}; +const routeLoader$ = /* @__PURE__ */ implicit$FirstArg(routeLoaderQrl); +const ServiceWorkerRegister = (props)=>/* @__PURE__ */ _jsxSorted('script', { + nonce: _wrapProp(props, "nonce") + }, { + type: 'module', + dangerouslySetInnerHTML: swRegister + }, null, 3, "0K_9"); +const GetForm = /*#__PURE__*/ componentQrl(q_GetForm_component_OIWHwJ5eKxg); +const Form = ({ action, spaReset, reloadDocument, onSubmit$, ...rest }, key)=>{ + if (action) { + const isArrayApi = Array.isArray(onSubmit$); + if (isArrayApi) return _jsxSplit('form', { + ..._getVarProps(rest), + ..._getConstProps(rest), + action: _wrapProp(action, "actionPath"), + 'preventdefault:submit': !reloadDocument, + "q-e:submit": [ + ...onSubmit$, + // action.submit "submitcompleted" event for onSubmitCompleted$ events + !reloadDocument ? q_Form_form_q_e_submit_iIfbMzzXpIA.w([ + action + ]) : void 0 + ], + ['data-spa-reset']: spaReset ? 'true' : void 0 + }, { + method: 'post' + }, null, 0, key); + return _jsxSplit('form', { + ..._getVarProps(rest), + ..._getConstProps(rest), + action: _wrapProp(action, "actionPath"), + 'preventdefault:submit': !reloadDocument, + "q-e:submit": [ + // Since v2, this fires before the action is executed so it can be prevented + onSubmit$, + // action.submit "submitcompleted" event for onSubmitCompleted$ events + !reloadDocument ? action.submit : void 0 + ], + ['data-spa-reset']: spaReset ? 'true' : void 0 + }, { + method: 'post' + }, null, 0, key); + } else return /* @__PURE__ */ _jsxSplit(GetForm, { + spaReset, + reloadDocument, + onSubmit$, + ..._getVarProps(rest) + }, _getConstProps(rest), null, 0, key); +}; +const untypedAppUrl = function appUrl(route, params, paramsPrefix = '') { + const path = route.split('/'); + for(let i = 0; i < path.length; i++){ + const segment = path[i]; + if (segment.startsWith('[') && segment.endsWith(']')) { + const isSpread = segment.startsWith('[...'); + const key = segment.substring(segment.startsWith('[...') ? 4 : 1, segment.length - 1); + const value = params ? params[paramsPrefix + key] || params[key] : ''; + path[i] = isSpread ? value : encodeURIComponent(value); + } + if (segment.startsWith('(') && segment.endsWith(')')) path.splice(i, 1); + } + let url = path.join('/'); + let baseURL = '/'; + if (baseURL) { + if (!baseURL.endsWith('/')) baseURL += '/'; + while(url.startsWith('/'))url = url.substring(1); + url = baseURL + url; + } + return url; +}; +function omitProps(obj, keys) { + const omittedObj = {}; + for(const key in obj)if (!key.startsWith('param:') && !keys.includes(key)) omittedObj[key] = obj[key]; + return omittedObj; +} +const createRenderer = (getOptions)=>{ + return (opts)=>{ + const { jsx, options } = getOptions(opts); + return renderToStream(jsx, options); + }; +}; +const DocumentHeadTags = /*#__PURE__*/ componentQrl(q_DocumentHeadTags_component_LaCcLS5Bz4c); +export { DocumentHeadTags, ErrorBoundary, Form, Link, QWIK_CITY_SCROLLER, QWIK_ROUTER_SCROLLER, QwikCityMockProvider, QwikCityProvider, QwikRouterMockProvider, QwikRouterProvider, RouterOutlet, ServiceWorkerRegister, createRenderer, globalAction$, globalActionQrl, omitProps, routeAction$, routeActionQrl, routeLoader$, routeLoaderQrl, server$, serverQrl, untypedAppUrl, useContent, useDocumentHead, useLocation, useNavigate, usePreventNavigate$, usePreventNavigateQrl, useQwikRouter, valibot$, valibotQrl, validator$, validatorQrl, zod$, zodQrl }; +export { ContentInternalContext as _auto_ContentInternalContext }; +export { getScrollHistory as _auto_getScrollHistory }; +export { internalState as _auto_internalState }; +export { preventNav as _auto_preventNav }; +export { restoreScroll as _auto_restoreScroll }; +export { spaInit as _auto_spaInit }; +export { useQwikRouterEnv as _auto_useQwikRouterEnv }; +export { ContentContext as _auto_ContentContext }; +export { DocumentHeadContext as _auto_DocumentHeadContext }; +export { RouteActionContext as _auto_RouteActionContext }; +export { RouteLocationContext as _auto_RouteLocationContext }; +export { RouteNavigateContext as _auto_RouteNavigateContext }; +export { RouteStateContext as _auto_RouteStateContext }; +export { createDocumentHead as _auto_createDocumentHead }; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\"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\"}") +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_Link_component_handlePreload_MhXmSxzp4GE.mjs (ENTRY POINT)== + +import { p as preloadRouteBundles } from "./chunks/routing.qwik.mjs"; +// +export const Link_component_handlePreload_MhXmSxzp4GE = (_, elm)=>{ + const url = new URL(elm.href); + preloadRouteBundles(url.pathname, 1); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;wDAwK0B,CAAC,GAAG;IAC1B,MAAM,MAAM,IAAI,IAAI,IAAI,IAAI;IAC5B,oBAAoB,IAAI,QAAQ,EAAE;AACpC\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "Link_component_handlePreload_MhXmSxzp4GE", + "entry": null, + "displayName": "index.qwik.mjs_Link_component_handlePreload", + "hash": "MhXmSxzp4GE", + "canonicalFilename": "index.qwik.mjs_Link_component_handlePreload_MhXmSxzp4GE", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": "Link_component_nhj84CU1784", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 5085, + 5179 + ], + "paramNames": [ + "_", + "elm" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_ErrorBoundary_component_useOnWindow_GYhPAutMLGk.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const ErrorBoundary_component_useOnWindow_GYhPAutMLGk = (e)=>{ + const store = _captures[0]; + store.error = e.detail.error; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;+DA4EM,CAAC;;IACD,MAAM,KAAK,GAAG,EAAE,MAAM,CAAC,KAAK\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "ErrorBoundary_component_useOnWindow_GYhPAutMLGk", + "entry": null, + "displayName": "index.qwik.mjs_ErrorBoundary_component_useOnWindow", + "hash": "GYhPAutMLGk", + "canonicalFilename": "index.qwik.mjs_ErrorBoundary_component_useOnWindow_GYhPAutMLGk", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": "ErrorBoundary_component_yTCHi5s1o00", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 1704, + 1754 + ], + "paramNames": [ + "e" + ], + "captureNames": [ + "store" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_QwikRouterMockProvider_component_kN7AQXV0aXo.mjs (ENTRY POINT)== + +import { _auto_ContentContext as ContentContext } from "./index.qwik.mjs"; +import { _auto_ContentInternalContext as ContentInternalContext } from "./index.qwik.mjs"; +import { _auto_DocumentHeadContext as DocumentHeadContext } from "./index.qwik.mjs"; +import { _auto_RouteActionContext as RouteActionContext } from "./index.qwik.mjs"; +import { _auto_RouteLocationContext as RouteLocationContext } from "./index.qwik.mjs"; +import { _auto_RouteNavigateContext as RouteNavigateContext } from "./index.qwik.mjs"; +import { _auto_RouteStateContext as RouteStateContext } from "./index.qwik.mjs"; +import { _auto_createDocumentHead as createDocumentHead } from "./index.qwik.mjs"; +import { Slot } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useContextProvider } from "@qwik.dev/core"; +import { useSignal } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +import { useTaskQrl } from "@qwik.dev/core"; +// +const q_useQwikMockRouter_goto_ojVznvSDqoM = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_useQwikMockRouter_goto_ojVznvSDqoM.mjs"), "useQwikMockRouter_goto_ojVznvSDqoM"); +const q_useQwikMockRouter_useTask_oml2hW1aK6I = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_useQwikMockRouter_useTask_oml2hW1aK6I.mjs"), "useQwikMockRouter_useTask_oml2hW1aK6I"); +// +const useQwikMockRouter = (props)=>{ + const urlEnv = props.url ?? 'http://localhost/'; + const url = new URL(urlEnv); + const routeLocation = useStore({ + url, + params: props.params ?? {}, + isNavigating: false, + prevUrl: void 0 + }, { + deep: false + }); + const loadersData = props.loaders?.reduce((acc, { loader, data })=>{ + acc[loader.__id] = data; + return acc; + }, {}); + const loaderState = useStore(loadersData ?? {}, { + deep: false + }); + const goto = props.goto ?? q_useQwikMockRouter_goto_ojVznvSDqoM; + const documentHead = useStore(createDocumentHead, { + deep: false + }); + const content = useStore({ + headings: void 0, + menu: void 0 + }, { + deep: false + }); + const contentInternal = useSignal(); + const actionState = useSignal(); + useContextProvider(ContentContext, content); + useContextProvider(ContentInternalContext, contentInternal); + useContextProvider(DocumentHeadContext, documentHead); + useContextProvider(RouteLocationContext, routeLocation); + useContextProvider(RouteNavigateContext, goto); + useContextProvider(RouteStateContext, loaderState); + useContextProvider(RouteActionContext, actionState); + const actionsMocks = props.actions?.reduce((acc, { action, handler })=>{ + acc[action.__id] = handler; + return acc; + }, {}); + useTaskQrl(q_useQwikMockRouter_useTask_oml2hW1aK6I.w([ + actionState, + actionsMocks + ])); +}; +export const QwikRouterMockProvider_component_kN7AQXV0aXo = (props)=>{ + useQwikMockRouter(props); + return /* @__PURE__ */ _jsxSorted(Slot, null, null, null, 3, "0K_5"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;;;;;;;MAwgCM,oBAAoB,CAAC;IACzB,MAAM,SAAS,MAAM,GAAG,IAAI;IAC5B,MAAM,MAAM,IAAI,IAAI;IACpB,MAAM,gBAAgB,SACpB;QACE;QACA,QAAQ,MAAM,MAAM,IAAI,CAAC;QACzB,cAAc;QACd,SAAS,KAAK;IAChB,GACA;QAAE,MAAM;IAAM;IAEhB,MAAM,cAAc,MAAM,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QAC9D,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG;QACnB,OAAO;IACT,GAAG,CAAC;IACJ,MAAM,cAAc,SAAS,eAAe,CAAC,GAAG;QAAE,MAAM;IAAM;IAC9D,MAAM,OACJ,MAAM,IAAI;IAIZ,MAAM,eAAe,SAAS,oBAAoB;QAAE,MAAM;IAAM;IAChE,MAAM,UAAU,SACd;QACE,UAAU,KAAK;QACf,MAAM,KAAK;IACb,GACA;QAAE,MAAM;IAAM;IAEhB,MAAM,kBAAkB;IACxB,MAAM,cAAc;IACpB,mBAAmB,gBAAgB;IACnC,mBAAmB,wBAAwB;IAC3C,mBAAmB,qBAAqB;IACxC,mBAAmB,sBAAsB;IACzC,mBAAmB,sBAAsB;IACzC,mBAAmB,mBAAmB;IACtC,mBAAmB,oBAAoB;IACvC,MAAM,eAAe,MAAM,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;QAClE,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG;QACnB,OAAO;IACT,GAAG,CAAC;IACJ;;;;AAWF;4DAC0C,CAAC;IACzC,kBAAkB;IAClB,OAAO,aAAa,GAAG,WAAI;AAC7B\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "QwikRouterMockProvider_component_kN7AQXV0aXo", + "entry": null, + "displayName": "index.qwik.mjs_QwikRouterMockProvider_component", + "hash": "kN7AQXV0aXo", + "canonicalFilename": "index.qwik.mjs_QwikRouterMockProvider_component_kN7AQXV0aXo", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 37476, + 37558 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_useQwikRouter_registerPreventNav_W0LIs8PUJoA.mjs (ENTRY POINT)== + +import { _auto_internalState as internalState } from "./index.qwik.mjs"; +import { _auto_preventNav as preventNav } from "./index.qwik.mjs"; +import { isBrowser } from "@qwik.dev/core"; +// +export const useQwikRouter_registerPreventNav_W0LIs8PUJoA = (fn$)=>{ + if (!isBrowser) return; + preventNav.$handler$ ||= (event)=>{ + internalState.navCount++; + if (!preventNav.$cbs$) return; + const prevents = [ + ...preventNav.$cbs$.values() + ].map((cb)=>cb.resolved ? cb.resolved() : cb()); + if (prevents.some(Boolean)) { + event.preventDefault(); + event.returnValue = true; + } + }; + (preventNav.$cbs$ ||= /* @__PURE__ */ new Set()).add(fn$); + fn$.resolve(); + window.addEventListener('beforeunload', preventNav.$handler$); + return ()=>{ + if (preventNav.$cbs$) { + preventNav.$cbs$.delete(fn$); + if (!preventNav.$cbs$.size) { + preventNav.$cbs$ = void 0; + window.removeEventListener('beforeunload', preventNav.$handler$); + } + } + }; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;4DAukB+B,CAAC;IAC5B,IAAI,CAAC,WACH;IAEF,WAAW,SAAS,KAAK,CAAC;QACxB,cAAc,QAAQ;QACtB,IAAI,CAAC,WAAW,KAAK,EACnB;QAEF,MAAM,WAAW;eAAI,WAAW,KAAK,CAAC,MAAM;SAAG,CAAC,GAAG,CAAC,CAAC,KACnD,GAAG,QAAQ,GAAG,GAAG,QAAQ,KAAK;QAEhC,IAAI,SAAS,IAAI,CAAC,UAAU;YAC1B,MAAM,cAAc;YACpB,MAAM,WAAW,GAAG;QACtB;IACF;IACA,CAAC,WAAW,KAAK,KAAK,aAAa,GAAG,IAAI,KAAK,EAAE,GAAG,CAAC;IACrD,IAAI,OAAO;IACX,OAAO,gBAAgB,CAAC,gBAAgB,WAAW,SAAS;IAC5D,OAAO;QACL,IAAI,WAAW,KAAK,EAAE;YACpB,WAAW,KAAK,CAAC,MAAM,CAAC;YACxB,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,EAAE;gBAC1B,WAAW,KAAK,GAAG,KAAK;gBACxB,OAAO,mBAAmB,CAAC,gBAAgB,WAAW,SAAS;YACjE;QACF;IACF;AACF\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "useQwikRouter_registerPreventNav_W0LIs8PUJoA", + "entry": null, + "displayName": "index.qwik.mjs_useQwikRouter_registerPreventNav", + "hash": "W0LIs8PUJoA", + "canonicalFilename": "index.qwik.mjs_useQwikRouter_registerPreventNav_W0LIs8PUJoA", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 19044, + 19876 + ], + "paramNames": [ + "fn$" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_Form_form_q_e_submit_iIfbMzzXpIA.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const Form_form_q_e_submit_iIfbMzzXpIA = (evt)=>{ + const action = _captures[0]; + if (!action.submitted) return action.submit(evt); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;gDAojDkB,CAAC;;IACD,IAAI,CAAC,OAAO,SAAS,EACnB,OAAO,OAAO,MAAM,CAAC\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "Form_form_q_e_submit_iIfbMzzXpIA", + "entry": null, + "displayName": "index.qwik.mjs_Form_form_q_e_submit", + "hash": "iIfbMzzXpIA", + "canonicalFilename": "index.qwik.mjs_Form_form_q_e_submit_iIfbMzzXpIA", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 53387, + 53525 + ], + "paramNames": [ + "evt" + ], + "captureNames": [ + "action" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_useQwikMockRouter_goto_ojVznvSDqoM.mjs (ENTRY POINT)== + +export const useQwikMockRouter_goto_ojVznvSDqoM = async ()=>{ + console.warn('QwikRouterMockProvider: goto not provided'); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\"kDA2hCM;IACA,QAAQ,IAAI,CAAC;AACf\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "useQwikMockRouter_goto_ojVznvSDqoM", + "entry": null, + "displayName": "index.qwik.mjs_useQwikMockRouter_goto", + "hash": "ojVznvSDqoM", + "canonicalFilename": "index.qwik.mjs_useQwikMockRouter_goto_ojVznvSDqoM", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 36289, + 36373 + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_DocumentHeadTags_component_LaCcLS5Bz4c.mjs (ENTRY POINT)== + +import { useDocumentHead } from "./index.qwik.mjs"; +import { Fragment } from "@qwik.dev/core/jsx-runtime"; +import { _getConstProps } from "@qwik.dev/core"; +import { _getVarProps } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _jsxSplit } from "@qwik.dev/core"; +import { createElement } from "@qwik.dev/core"; +// +export const DocumentHeadTags_component_LaCcLS5Bz4c = (props)=>{ + let head = useDocumentHead(); + if (props) head = { + ...head, + ...props + }; + return /* @__PURE__ */ _jsxSorted(Fragment, null, null, [ + head.title && /* @__PURE__ */ _jsxSorted('title', null, null, head.title, 1, "0K_12"), + head.meta.map((m)=>/* @__PURE__ */ _jsxSplit('meta', { + ..._getVarProps(m) + }, _getConstProps(m), null, 0, "0K_13")), + head.links.map((l)=>/* @__PURE__ */ _jsxSplit('link', { + ..._getVarProps(l) + }, _getConstProps(l), null, 0, "0K_14")), + head.styles.map((s)=>{ + const props2 = s.props || s; + return /* @__PURE__ */ createElement('style', { + ...props2, + dangerouslySetInnerHTML: s.style || props2.dangerouslySetInnerHTML, + key: s.key + }); + }), + head.scripts.map((s)=>{ + const props2 = s.props || s; + return /* @__PURE__ */ createElement('script', { + ...props2, + dangerouslySetInnerHTML: s.script || props2.dangerouslySetInnerHTML, + key: s.key + }); + }) + ], 1, "0K_15"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;sDAmrDoC,CAAC;IACnC,IAAI,OAAO;IACX,IAAI,OACF,OAAO;QAAE,GAAG,IAAI;QAAE,GAAG,KAAK;IAAC;IAE7B,OAAO,aAAa,GAAG,WAAK,sBAChB;QACR,KAAK,KAAK,IAAI,aAAa,GAAG,WAAI,qBAAqB,KAAK,KAAK;QACjE,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,IAAM,aAAa,GAAG,UAAI;gCAAa;8BAAA;QACtD,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,IAAM,aAAa,GAAG,UAAI;gCAAa;8BAAA;QACvD,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC;YACf,MAAM,SAAS,EAAE,KAAK,IAAI;YAC1B,OAAO,aAAa,GAAG,cAAc,SAAS;gBAC5C,GAAG,MAAM;gBACT,yBAAyB,EAAE,KAAK,IAAI,OAAO,uBAAuB;gBAClE,KAAK,EAAE,GAAG;YACZ;QACF;QACA,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;YAChB,MAAM,SAAS,EAAE,KAAK,IAAI;YAC1B,OAAO,aAAa,GAAG,cAAc,UAAU;gBAC7C,GAAG,MAAM;gBACT,yBAAyB,EAAE,MAAM,IAAI,OAAO,uBAAuB;gBACnE,KAAK,EAAE,GAAG;YACZ;QACF;KACD;AAEL\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "DocumentHeadTags_component_LaCcLS5Bz4c", + "entry": null, + "displayName": "index.qwik.mjs_DocumentHeadTags_component", + "hash": "LaCcLS5Bz4c", + "canonicalFilename": "index.qwik.mjs_DocumentHeadTags_component_LaCcLS5Bz4c", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 56859, + 57777 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_spaInit_event_Js1cotabL5I.mjs (ENTRY POINT)== + +import { isDev } from "@qwik.dev/core"; +// +export const spaInit_event_Js1cotabL5I = (_, el)=>{ + if (!window._qRouterSPA && !window._qRouterInitPopstate) { + const currentPath = location.pathname + location.search; + const checkAndScroll = (scrollState)=>{ + if (scrollState) window.scrollTo(scrollState.x, scrollState.y); + }; + const currentScrollState = ()=>{ + const elm = document.documentElement; + return { + x: elm.scrollLeft, + y: elm.scrollTop, + w: Math.max(elm.scrollWidth, elm.clientWidth), + h: Math.max(elm.scrollHeight, elm.clientHeight) + }; + }; + const saveScrollState = (scrollState)=>{ + const state = history.state || {}; + state._qRouterScroll = scrollState || currentScrollState(); + history.replaceState(state, ''); + }; + saveScrollState(); + window._qRouterInitPopstate = ()=>{ + if (window._qRouterSPA) return; + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + if (currentPath !== location.pathname + location.search) { + const getContainer = (el2)=>el2.closest('[q\\:container]:not([q\\:container=html]):not([q\\:container=text])'); + const container = getContainer(el); + const domContainer = container.qContainer; + const hostElement = domContainer.vNodeLocate(el); + const nav = domContainer?.resolveContext(hostElement, { + id: 'qc--n' + }); + if (nav) nav(location.href, { + type: 'popstate' + }); + else location.reload(); + } else if (history.scrollRestoration === 'manual') { + const scrollState = history.state?._qRouterScroll; + checkAndScroll(scrollState); + window._qRouterScrollEnabled = true; + } + }; + if (!window._qRouterHistoryPatch) { + window._qRouterHistoryPatch = true; + const pushState = history.pushState; + const replaceState = history.replaceState; + const prepareState = (state)=>{ + if (state === null || typeof state === 'undefined') state = {}; + else if (state?.constructor !== Object) { + state = { + _data: state + }; + if (isDev) console.warn('In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`'); + } + state._qRouterScroll = state._qRouterScroll || currentScrollState(); + return state; + }; + history.pushState = (state, title, url)=>{ + state = prepareState(state); + return pushState.call(history, state, title, url); + }; + history.replaceState = (state, title, url)=>{ + state = prepareState(state); + return replaceState.call(history, state, title, url); + }; + } + window._qRouterInitAnchors = (event)=>{ + if (window._qRouterSPA || event.defaultPrevented) return; + const target = event.target.closest('a[href]'); + if (target && !target.hasAttribute('preventdefault:click')) { + const href = target.getAttribute('href'); + const prev = new URL(location.href); + const dest = new URL(href, prev); + const sameOrigin = dest.origin === prev.origin; + const samePath = dest.pathname + dest.search === prev.pathname + prev.search; + if (sameOrigin && samePath) { + event.preventDefault(); + if (dest.href !== prev.href) history.pushState(null, '', dest); + if (!dest.hash) { + if (dest.href.endsWith('#')) window.scrollTo(0, 0); + else { + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + saveScrollState({ + ...currentScrollState(), + x: 0, + y: 0 + }); + location.reload(); + } + } else { + const elmId = dest.hash.slice(1); + const elm = document.getElementById(elmId); + if (elm) elm.scrollIntoView(); + } + } + } + }; + window._qRouterInitVisibility = ()=>{ + if (!window._qRouterSPA && window._qRouterScrollEnabled && document.visibilityState === 'hidden') saveScrollState(); + }; + window._qRouterInitScroll = ()=>{ + if (window._qRouterSPA || !window._qRouterScrollEnabled) return; + clearTimeout(window._qRouterScrollDebounce); + window._qRouterScrollDebounce = setTimeout(()=>{ + saveScrollState(); + window._qRouterScrollDebounce = void 0; + }, 200); + }; + window._qRouterScrollEnabled = true; + setTimeout(()=>{ + window.addEventListener('popstate', window._qRouterInitPopstate); + window.addEventListener('scroll', window._qRouterInitScroll, { + passive: true + }); + document.addEventListener('click', window._qRouterInitAnchors); + if (!window.navigation) document.addEventListener('visibilitychange', window._qRouterInitVisibility, { + passive: true + }); + }, 0); + } +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\"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\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "spaInit_event_Js1cotabL5I", + "entry": null, + "displayName": "index.qwik.mjs_spaInit_event", + "hash": "Js1cotabL5I", + "canonicalFilename": "index.qwik.mjs_spaInit_event_Js1cotabL5I", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "event$", + "captures": false, + "loc": [ + 10232, + 15588 + ], + "paramNames": [ + "_", + "el" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_QwikRouterProvider_component_lCQXGdS0iZM.mjs (ENTRY POINT)== + +import { useQwikRouter } from "./index.qwik.mjs"; +import { Slot } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +export const QwikRouterProvider_component_lCQXGdS0iZM = (props)=>{ + useQwikRouter(props); + return /* @__PURE__ */ _jsxSorted(Slot, null, null, null, 3, "0K_4"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;wDAmgCsC,CAAC;IACrC,cAAc;IACd,OAAO,aAAa,GAAG,WAAI;AAC7B\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "QwikRouterProvider_component_lCQXGdS0iZM", + "entry": null, + "displayName": "index.qwik.mjs_QwikRouterProvider_component", + "hash": "lCQXGdS0iZM", + "canonicalFilename": "index.qwik.mjs_QwikRouterProvider_component_lCQXGdS0iZM", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 35640, + 35718 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_Link_component_handlePrefetch_Evus9ZlzXpQ.mjs (ENTRY POINT)== + +import { l as loadClientData } from "./chunks/routing.qwik.mjs"; +import { p as preloadRouteBundles } from "./chunks/routing.qwik.mjs"; +// +export const Link_component_handlePrefetch_Evus9ZlzXpQ = (_, elm)=>{ + if (navigator.connection?.saveData) return; + if (elm && elm.href) { + const url = new URL(elm.href); + preloadRouteBundles(url.pathname); + if (elm.hasAttribute('data-prefetch')) loadClientData(url, { + preloadRouteBundles: false, + isPrefetch: true + }); + } +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;yDAqIQ,CAAC,GAAG;IACJ,IAAI,UAAU,UAAU,EAAE,UACxB;IAEF,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,MAAM,MAAM,IAAI,IAAI,IAAI,IAAI;QAC5B,oBAAoB,IAAI,QAAQ;QAChC,IAAI,IAAI,YAAY,CAAC,kBACnB,eAAe,KAAK;YAClB,qBAAqB;YACrB,YAAY;QACd;IAEJ;AACF\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "Link_component_handlePrefetch_Evus9ZlzXpQ", + "entry": null, + "displayName": "index.qwik.mjs_Link_component_handlePrefetch", + "hash": "Evus9ZlzXpQ", + "canonicalFilename": "index.qwik.mjs_Link_component_handlePrefetch_Evus9ZlzXpQ", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": "Link_component_nhj84CU1784", + "ctxKind": "function", + "ctxName": "$", + "captures": false, + "loc": [ + 4027, + 4436 + ], + "paramNames": [ + "_", + "elm" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_useQwikRouter_useTask_omhKiQfdzZU.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { QWIK_ROUTER_SCROLLER } from "./index.qwik.mjs"; +import { _auto_getScrollHistory as getScrollHistory } from "./index.qwik.mjs"; +import { _auto_restoreScroll as restoreScroll } from "./index.qwik.mjs"; +import { _auto_spaInit as spaInit } from "./index.qwik.mjs"; +import { _auto_createDocumentHead as createDocumentHead } from "./index.qwik.mjs"; +import { C as CLIENT_DATA_CACHE } from "./chunks/routing.qwik.mjs"; +import { D as DEFAULT_LOADERS_SERIALIZATION_STRATEGY } from "./chunks/routing.qwik.mjs"; +import { Q as Q_ROUTE } from "./chunks/routing.qwik.mjs"; +import { _getContextContainer } from "@qwik.dev/core/internal"; +import { _hasStoreEffects } from "@qwik.dev/core/internal"; +import { _waitUntilRendered } from "@qwik.dev/core/internal"; +import { e as clientNavigate } from "./chunks/routing.qwik.mjs"; +import { c as createLoaderSignal } from "./chunks/routing.qwik.mjs"; +import { forceStoreEffects } from "@qwik.dev/core/internal"; +import { getLocale } from "@qwik.dev/core"; +import { isBrowser } from "@qwik.dev/core"; +import { isDev } from "@qwik.dev/core"; +import { i as isPromise } from "./chunks/routing.qwik.mjs"; +import { b as isSameOrigin } from "./chunks/routing.qwik.mjs"; +import { a as isSamePath } from "./chunks/routing.qwik.mjs"; +import { isServer } from "@qwik.dev/core"; +import { l as loadClientData } from "./chunks/routing.qwik.mjs"; +import { d as loadRoute } from "./chunks/routing.qwik.mjs"; +import { noSerialize } from "@qwik.dev/core"; +import * as qwikRouterConfig from "@qwik-router-config"; +import { withLocale } from "@qwik.dev/core"; +// +const mergeArray = (existingArr, newArr)=>{ + if (Array.isArray(newArr)) for (const newItem of newArr){ + if (typeof newItem.key === 'string') { + const existingIndex = existingArr.findIndex((i)=>i.key === newItem.key); + if (existingIndex > -1) { + existingArr[existingIndex] = newItem; + continue; + } + } + existingArr.push(newItem); + } +}; +const resolveDocumentHead = (resolvedHead, updatedHead)=>{ + if (typeof updatedHead.title === 'string') resolvedHead.title = updatedHead.title; + mergeArray(resolvedHead.meta, updatedHead.meta); + mergeArray(resolvedHead.links, updatedHead.links); + mergeArray(resolvedHead.styles, updatedHead.styles); + mergeArray(resolvedHead.scripts, updatedHead.scripts); + Object.assign(resolvedHead.frontmatter, updatedHead.frontmatter); +}; +const resolveHead = (endpoint, routeLocation, contentModules, locale, defaults)=>withLocale(locale, ()=>{ + const head = createDocumentHead(defaults); + const getData = (loaderOrAction)=>{ + const id = loaderOrAction.__id; + if (loaderOrAction.__brand === 'server_loader') { + if (!(id in endpoint.loaders)) throw new Error('You can not get the returned data of a loader that has not been executed for this request.'); + } + const data = endpoint.loaders[id]; + if (isPromise(data)) throw new Error('Loaders returning a promise can not be resolved for the head function.'); + return data; + }; + const fns = []; + for (const contentModule of contentModules){ + const contentModuleHead = contentModule?.head; + if (contentModuleHead) { + if (typeof contentModuleHead === 'function') fns.unshift(contentModuleHead); + else if (typeof contentModuleHead === 'object') resolveDocumentHead(head, contentModuleHead); + } + } + if (fns.length) { + const headProps = { + head, + withLocale: (fn)=>fn(), + resolveValue: getData, + ...routeLocation + }; + for (const fn of fns)resolveDocumentHead(head, fn(headProps)); + } + return head; + }); +function callRestoreScrollOnDocument() { + if (document.__q_scroll_restore__) { + document.__q_scroll_restore__(); + document.__q_scroll_restore__ = void 0; + } +} +const currentScrollState = (elm)=>{ + return { + x: elm.scrollLeft, + y: elm.scrollTop, + w: Math.max(elm.scrollWidth, elm.clientWidth), + h: Math.max(elm.scrollHeight, elm.clientHeight) + }; +}; +const saveScrollHistory = (scrollState)=>{ + const state = history.state || {}; + state._qRouterScroll = scrollState; + history.replaceState(state, ''); +}; +const startViewTransition = (params)=>{ + if (!params.update) return; + if ('startViewTransition' in document) { + let transition; + try { + transition = document.startViewTransition(params); + } catch { + transition = document.startViewTransition(params.update); + } + const event = new CustomEvent('qviewtransition', { + detail: transition + }); + document.dispatchEvent(event); + return transition; + } else params.update?.(); +}; +export const useQwikRouter_useTask_omhKiQfdzZU = ({ track })=>{ + const actionState = _captures[0], content = _captures[1], contentInternal = _captures[2], documentHead = _captures[3], env = _captures[4], goto = _captures[5], loaderState = _captures[6], loadersObject = _captures[7], navResolver = _captures[8], props = _captures[9], routeInternal = _captures[10], routeLocation = _captures[11], routeLocationTarget = _captures[12], serverHead = _captures[13]; + async function run() { + const navigation = track(routeInternal); + const action = track(actionState); + const locale = getLocale(''); + const prevUrl = routeLocation.url; + const navType = action ? 'form' : navigation.type; + const replaceState = navigation.replaceState; + let trackUrl; + let clientPageData; + let loadedRoute = null; + let container2; + if (isServer) { + trackUrl = new URL(navigation.dest, routeLocation.url); + loadedRoute = env.loadedRoute; + clientPageData = env.response; + } else { + trackUrl = new URL(navigation.dest, location); + if (trackUrl.pathname.endsWith('/')) { + if (globalThis.__NO_TRAILING_SLASH__) trackUrl.pathname = trackUrl.pathname.slice(0, -1); + } else if (!globalThis.__NO_TRAILING_SLASH__) trackUrl.pathname += '/'; + let loadRoutePromise = loadRoute(qwikRouterConfig.routes, qwikRouterConfig.menus, qwikRouterConfig.cacheModules, trackUrl.pathname); + container2 = _getContextContainer(); + const pageData = clientPageData = await loadClientData(trackUrl, { + action, + clearCache: true + }); + if (!pageData) { + routeInternal.untrackedValue = { + type: navType, + dest: trackUrl + }; + return; + } + const newHref = pageData.href; + const newURL = new URL(newHref, trackUrl); + if (!isSamePath(newURL, trackUrl)) { + if (!pageData.isRewrite) trackUrl = newURL; + loadRoutePromise = loadRoute(qwikRouterConfig.routes, qwikRouterConfig.menus, qwikRouterConfig.cacheModules, newURL.pathname); + } + try { + loadedRoute = await loadRoutePromise; + } catch (e) { + console.error(e); + window.location.href = newHref; + return; + } + } + if (loadedRoute) { + const [routeName, params, mods, menu] = loadedRoute; + const contentModules = mods; + const pageModule = contentModules[contentModules.length - 1]; + if (navigation.dest.search && !!isSamePath(trackUrl, prevUrl)) trackUrl.search = navigation.dest.search; + let shouldForcePrevUrl = false; + let shouldForceUrl = false; + let shouldForceParams = false; + if (!isSamePath(trackUrl, prevUrl)) { + if (_hasStoreEffects(routeLocation, 'prevUrl')) shouldForcePrevUrl = true; + routeLocationTarget.prevUrl = prevUrl; + } + if (routeLocationTarget.url !== trackUrl) { + if (_hasStoreEffects(routeLocation, 'url')) shouldForceUrl = true; + routeLocationTarget.url = trackUrl; + } + if (routeLocationTarget.params !== params) { + if (_hasStoreEffects(routeLocation, 'params')) shouldForceParams = true; + routeLocationTarget.params = params; + } + routeInternal.untrackedValue = { + type: navType, + dest: trackUrl + }; + const resolvedHead = resolveHead(clientPageData, routeLocation, contentModules, locale, serverHead); + content.headings = pageModule.headings; + content.menu = menu; + contentInternal.untrackedValue = noSerialize(contentModules); + documentHead.links = resolvedHead.links; + documentHead.meta = resolvedHead.meta; + documentHead.styles = resolvedHead.styles; + documentHead.scripts = resolvedHead.scripts; + documentHead.title = resolvedHead.title; + documentHead.frontmatter = resolvedHead.frontmatter; + if (isBrowser) { + let scrollState; + if (navType === 'popstate') scrollState = getScrollHistory(); + const scroller = document.getElementById(QWIK_ROUTER_SCROLLER) ?? document.documentElement; + if (navigation.scroll && (!navigation.forceReload || !isSamePath(trackUrl, prevUrl)) && (navType === 'link' || navType === 'popstate') || navType === 'form' && !isSamePath(trackUrl, prevUrl)) document.__q_scroll_restore__ = ()=>restoreScroll(navType, trackUrl, prevUrl, scroller, scrollState); + const loaders = clientPageData?.loaders; + if (loaders) { + const container3 = _getContextContainer(); + for (const [key, value] of Object.entries(loaders)){ + const signal = loaderState[key]; + const awaitedValue = await value; + loadersObject[key] = awaitedValue; + if (!signal) loaderState[key] = createLoaderSignal(loadersObject, key, trackUrl, DEFAULT_LOADERS_SERIALIZATION_STRATEGY, container3); + else signal.invalidate(); + } + } + CLIENT_DATA_CACHE.clear(); + if (!window._qRouterSPA) { + window._qRouterSPA = true; + history.scrollRestoration = 'manual'; + window.addEventListener('popstate', ()=>{ + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + goto(location.href, { + type: 'popstate' + }); + }); + window.removeEventListener('popstate', window._qRouterInitPopstate); + window._qRouterInitPopstate = void 0; + if (!window._qRouterHistoryPatch) { + window._qRouterHistoryPatch = true; + const pushState = history.pushState; + const replaceState2 = history.replaceState; + const prepareState = (state)=>{ + if (state === null || typeof state === 'undefined') state = {}; + else if (state?.constructor !== Object) { + state = { + _data: state + }; + if (isDev) console.warn('In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`'); + } + state._qRouterScroll = state._qRouterScroll || currentScrollState(scroller); + return state; + }; + history.pushState = (state, title, url2)=>{ + state = prepareState(state); + return pushState.call(history, state, title, url2); + }; + history.replaceState = (state, title, url2)=>{ + state = prepareState(state); + return replaceState2.call(history, state, title, url2); + }; + } + document.addEventListener('click', (event)=>{ + if (event.defaultPrevented) return; + const target = event.target.closest('a[href]'); + if (target && !target.hasAttribute('preventdefault:click')) { + const href = target.getAttribute('href'); + const prev = new URL(location.href); + const dest = new URL(href, prev); + if (isSameOrigin(dest, prev) && isSamePath(dest, prev)) { + event.preventDefault(); + if (!dest.hash && !dest.href.endsWith('#')) { + if (dest.href !== prev.href) history.pushState(null, '', dest); + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + saveScrollHistory({ + ...currentScrollState(scroller), + x: 0, + y: 0 + }); + location.reload(); + return; + } + goto(target.getAttribute('href')); + } + } + }); + document.removeEventListener('click', window._qRouterInitAnchors); + window._qRouterInitAnchors = void 0; + if (!window.navigation) { + document.addEventListener('visibilitychange', ()=>{ + if ((window._qRouterScrollEnabled || window._qCityScrollEnabled) && document.visibilityState === 'hidden') { + if (window._qCityScrollEnabled) console.warn('"_qCityScrollEnabled" is deprecated. Use "_qRouterScrollEnabled" instead.'); + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + } + }, { + passive: true + }); + document.removeEventListener('visibilitychange', window._qRouterInitVisibility); + window._qRouterInitVisibility = void 0; + } + window.addEventListener('scroll', ()=>{ + if (!window._qRouterScrollEnabled && !window._qCityScrollEnabled) return; + clearTimeout(window._qRouterScrollDebounce); + window._qRouterScrollDebounce = setTimeout(()=>{ + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + window._qRouterScrollDebounce = void 0; + }, 200); + }, { + passive: true + }); + removeEventListener('scroll', window._qRouterInitScroll); + window._qRouterInitScroll = void 0; + spaInit.resolve(); + } + if (navType !== 'popstate') { + window._qRouterScrollEnabled = false; + clearTimeout(window._qRouterScrollDebounce); + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + } + const navigate = ()=>{ + clientNavigate(window, navType, prevUrl, trackUrl, replaceState); + contentInternal.trigger(); + return _waitUntilRendered(container2); + }; + const _waitNextPage = ()=>{ + if (isServer || props?.viewTransition === false) return navigate(); + else { + const viewTransition = startViewTransition({ + update: navigate, + types: [ + 'qwik-navigation' + ] + }); + if (!viewTransition) return Promise.resolve(); + return viewTransition.ready; + } + }; + _waitNextPage().catch((err)=>{ + navigate(); + throw err; + }).finally(()=>{ + container2.element.setAttribute?.(Q_ROUTE, routeName); + const scrollState2 = currentScrollState(scroller); + saveScrollHistory(scrollState2); + window._qRouterScrollEnabled = true; + if (isBrowser) callRestoreScrollOnDocument(); + if (shouldForcePrevUrl) forceStoreEffects(routeLocation, 'prevUrl'); + if (shouldForceUrl) forceStoreEffects(routeLocation, 'url'); + if (shouldForceParams) forceStoreEffects(routeLocation, 'params'); + routeLocation.isNavigating = false; + navResolver.r?.(); + }); + } + } + } + if (isServer) return run(); + else run(); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\"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\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "useQwikRouter_useTask_omhKiQfdzZU", + "entry": null, + "displayName": "index.qwik.mjs_useQwikRouter_useTask", + "hash": "omhKiQfdzZU", + "canonicalFilename": "index.qwik.mjs_useQwikRouter_useTask_omhKiQfdzZU", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "useTask$", + "captures": true, + "loc": [ + 23188, + 35596 + ], + "paramNames": [ + "{track}" + ], + "captureNames": [ + "actionState", + "content", + "contentInternal", + "documentHead", + "env", + "goto", + "loaderState", + "loadersObject", + "navResolver", + "props", + "routeInternal", + "routeLocation", + "routeLocationTarget", + "serverHead" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_usePreventNavigateQrl_useVisibleTask_no0bm2fybZo.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const usePreventNavigateQrl_useVisibleTask_no0bm2fybZo = ()=>{ + const fn = _captures[0], registerPreventNav = _captures[1]; + return registerPreventNav(fn); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;gEA0GkB;;WAAM,mBAAmB\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "usePreventNavigateQrl_useVisibleTask_no0bm2fybZo", + "entry": null, + "displayName": "index.qwik.mjs_usePreventNavigateQrl_useVisibleTask", + "hash": "no0bm2fybZo", + "canonicalFilename": "index.qwik.mjs_usePreventNavigateQrl_useVisibleTask_no0bm2fybZo", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "useVisibleTask$", + "captures": true, + "loc": [ + 3065, + 3093 + ], + "captureNames": [ + "fn", + "registerPreventNav" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_useQwikMockRouter_useTask_oml2hW1aK6I.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const useQwikMockRouter_useTask_oml2hW1aK6I = async ({ track })=>{ + const actionState = _captures[0], actionsMocks = _captures[1]; + const action = track(actionState); + if (!action?.resolve) return; + const mock = actionsMocks?.[action.id]; + if (mock) { + const actionResult = await mock(action.data); + action.resolve(actionResult); + } +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;qDAmjCW,OAAO,EAAE,KAAK,EAAE;;IACvB,MAAM,SAAS,MAAM;IACrB,IAAI,CAAC,QAAQ,SACX;IAEF,MAAM,OAAO,cAAc,CAAC,OAAO,EAAE,CAAC;IACtC,IAAI,MAAM;QACR,MAAM,eAAe,MAAM,KAAK,OAAO,IAAI;QAC3C,OAAO,OAAO,CAAC;IACjB\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "useQwikMockRouter_useTask_oml2hW1aK6I", + "entry": null, + "displayName": "index.qwik.mjs_useQwikMockRouter_useTask", + "hash": "oml2hW1aK6I", + "canonicalFilename": "index.qwik.mjs_useQwikMockRouter_useTask_oml2hW1aK6I", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "useTask$", + "captures": true, + "loc": [ + 37161, + 37428 + ], + "paramNames": [ + "{track}" + ], + "captureNames": [ + "actionState", + "actionsMocks" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_serverQrl_RA3PmZ4Oyak.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { _auto_useQwikRouterEnv as useQwikRouterEnv } from "./index.qwik.mjs"; +import { j as QDATA_KEY } from "./chunks/routing.qwik.mjs"; +import { f as QFN_KEY } from "./chunks/routing.qwik.mjs"; +import { _asyncRequestStore } from "@qwik.dev/router/middleware/request-handler"; +import { _deserialize } from "@qwik.dev/core/internal"; +import { _getContextEvent } from "@qwik.dev/core/internal"; +import { _serialize } from "@qwik.dev/core/internal"; +import { isServer } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const deserializeStream = async function*(stream, abortSignal) { + const reader = stream.getReader(); + try { + let buffer = ''; + const decoder = new TextDecoder(); + while(!abortSignal?.aborted){ + const result = await reader.read(); + if (result.done) break; + buffer += decoder.decode(result.value, { + stream: true + }); + const lines = buffer.split(/\n/); + buffer = lines.pop(); + for (const line of lines){ + const deserializedData = _deserialize(line); + yield deserializedData; + } + } + } finally{ + reader.releaseLock(); + } +}; +export const serverQrl_RA3PmZ4Oyak = async function(...args) { + const fetchOptions = _captures[0], headers = _captures[1], method = _captures[2], origin = _captures[3], qrl = _captures[4]; + const abortSignal = args.length > 0 && args[0] instanceof AbortSignal ? args.shift() : void 0; + if (isServer) { + let requestEvent = _asyncRequestStore?.getStore(); + if (!requestEvent) { + const contexts = [ + useQwikRouterEnv()?.ev, + this, + _getContextEvent() + ]; + requestEvent = contexts.find((v2)=>v2 && Object.prototype.hasOwnProperty.call(v2, 'sharedMap') && Object.prototype.hasOwnProperty.call(v2, 'cookie')); + } + return qrl.apply(requestEvent, args); + } else { + let filteredArgs = args.map((arg)=>{ + if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) return new FormData(arg.target); + else if (arg instanceof Event) return null; + else if (arg instanceof Node) return null; + return arg; + }); + if (!filteredArgs.length) filteredArgs = void 0; + const qrlHash = qrl.getHash(); + let query = ''; + const config = { + ...fetchOptions, + method, + headers: { + ...headers, + 'Content-Type': 'application/qwik-json', + Accept: 'application/json, application/qwik-json, text/qwik-json-stream, text/plain', + // Required so we don't call accidentally + 'X-QRL': qrlHash + }, + signal: abortSignal + }; + const captured = qrl.getCaptured(); + let toSend = [ + filteredArgs + ]; + if (captured?.length) toSend = [ + filteredArgs, + ...captured + ]; + else toSend = filteredArgs ? [ + filteredArgs + ] : []; + const body = await _serialize(toSend); + if (method === 'GET') query += `&${QDATA_KEY}=${encodeURIComponent(body)}`; + else config.body = body; + const res = await fetch(`${origin}?${QFN_KEY}=${qrlHash}${query}`, config); + const contentType = res.headers.get('Content-Type'); + if (res.ok && contentType === 'text/qwik-json-stream' && res.body) return async function*() { + try { + for await (const result of deserializeStream(res.body, abortSignal))yield result; + } finally{ + if (!abortSignal?.aborted) await res.body.cancel(); + } + }(); + else if (contentType === 'application/qwik-json') { + const str = await res.text(); + const obj = _deserialize(str); + if (res.status >= 400) throw obj; + return obj; + } else if (contentType === 'application/json') { + const obj = await res.json(); + if (res.status >= 400) throw obj; + return obj; + } else if (contentType === 'text/plain' || contentType === 'text/html') { + const str = await res.text(); + if (res.status >= 400) throw str; + return str; + } + } +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\"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\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "serverQrl_RA3PmZ4Oyak", + "entry": null, + "displayName": "index.qwik.mjs_serverQrl", + "hash": "RA3PmZ4Oyak", + "canonicalFilename": "index.qwik.mjs_serverQrl_RA3PmZ4Oyak", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 48020, + 51034 + ], + "paramNames": [ + "...args" + ], + "captureNames": [ + "fetchOptions", + "headers", + "method", + "origin", + "qrl" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_Link_component_handleClientSideNavigation_rMfmL7bFMLU.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const Link_component_handleClientSideNavigation_rMfmL7bFMLU = (event, elm)=>{ + const nav = _captures[0], reload = _captures[1], replaceState = _captures[2], scroll = _captures[3]; + if (event.defaultPrevented) { + if (elm.href) { + elm.setAttribute('aria-pressed', 'true'); + nav(elm.href, { + forceReload: reload, + replaceState, + scroll + }).then(()=>{ + elm.removeAttribute('aria-pressed'); + }); + } + } +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;qEA6JQ,CAAC,OAAO;;IACR,IAAI,MAAM,gBAAgB,EACxB;QAAA,IAAI,IAAI,IAAI,EAAE;YACZ,IAAI,YAAY,CAAC,gBAAgB;YACjC,IAAI,IAAI,IAAI,EAAE;gBAAE,aAAa;gBAAQ;gBAAc;YAAO,GAAG,IAAI,CAAC;gBAChE,IAAI,eAAe,CAAC;YACtB;QACF;IAAA\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "Link_component_handleClientSideNavigation_rMfmL7bFMLU", + "entry": null, + "displayName": "index.qwik.mjs_Link_component_handleClientSideNavigation", + "hash": "rMfmL7bFMLU", + "canonicalFilename": "index.qwik.mjs_Link_component_handleClientSideNavigation_rMfmL7bFMLU", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": "Link_component_nhj84CU1784", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 4725, + 5043 + ], + "paramNames": [ + "event", + "elm" + ], + "captureNames": [ + "nav", + "reload", + "replaceState", + "scroll" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_Link_component_nhj84CU1784.mjs (ENTRY POINT)== + +import { useLocation } from "./index.qwik.mjs"; +import { useNavigate } from "./index.qwik.mjs"; +import { Slot } from "@qwik.dev/core"; +import { _getConstProps } from "@qwik.dev/core"; +import { _getVarProps } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _jsxSplit } from "@qwik.dev/core"; +import { _qrlSync } from "@qwik.dev/core"; +import { g as getClientNavPath } from "./chunks/routing.qwik.mjs"; +import { qrl } from "@qwik.dev/core"; +import { s as shouldPreload } from "./chunks/routing.qwik.mjs"; +import { untrack } from "@qwik.dev/core"; +import { useSignal } from "@qwik.dev/core"; +import { useVisibleTaskQrl } from "@qwik.dev/core"; +// +const q_Link_component_handleClientSideNavigation_rMfmL7bFMLU = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_Link_component_handleClientSideNavigation_rMfmL7bFMLU.mjs"), "Link_component_handleClientSideNavigation_rMfmL7bFMLU"); +const q_Link_component_handlePrefetch_Evus9ZlzXpQ = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_Link_component_handlePrefetch_Evus9ZlzXpQ.mjs"), "Link_component_handlePrefetch_Evus9ZlzXpQ"); +const q_Link_component_handlePreload_MhXmSxzp4GE = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_Link_component_handlePreload_MhXmSxzp4GE.mjs"), "Link_component_handlePreload_MhXmSxzp4GE"); +const q_Link_component_useVisibleTask_6K6z063D0C4 = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_Link_component_useVisibleTask_6K6z063D0C4.mjs"), "Link_component_useVisibleTask_6K6z063D0C4"); +// +export const Link_component_nhj84CU1784 = (props)=>{ + const nav = useNavigate(); + const loc = useLocation(); + const originalHref = props.href; + const anchorRef = useSignal(); + const { onClick$, prefetch: prefetchProp, reload, replaceState, scroll, ...linkProps } = /* @__PURE__ */ (()=>props)(); + const clientNavPath = untrack(getClientNavPath, { + ...linkProps, + reload + }, loc); + linkProps.href = clientNavPath || originalHref; + const prefetchData = !!clientNavPath && prefetchProp !== false && prefetchProp !== 'js' || void 0; + const prefetch = prefetchData || !!clientNavPath && prefetchProp !== false && untrack(shouldPreload, clientNavPath, loc); + const handlePrefetch = prefetch ? q_Link_component_handlePrefetch_Evus9ZlzXpQ : void 0; + const preventDefault = clientNavPath ? _qrlSync((event)=>{ + if (!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) event.preventDefault(); + }, "event=>{if(!(event.metaKey||event.ctrlKey||event.shiftKey||event.altKey)){event.preventDefault();}}") : void 0; + const handleClientSideNavigation = clientNavPath ? q_Link_component_handleClientSideNavigation_rMfmL7bFMLU.w([ + nav, + reload, + replaceState, + scroll + ]) : void 0; + const handlePreload = q_Link_component_handlePreload_MhXmSxzp4GE; + useVisibleTaskQrl(q_Link_component_useVisibleTask_6K6z063D0C4.w([ + anchorRef, + handlePrefetch, + linkProps, + loc + ])); + return /* @__PURE__ */ _jsxSplit('a', { + ref: anchorRef, + 'q:link': !!clientNavPath, + ..._getVarProps(linkProps), + ..._getConstProps(linkProps), + "q-e:click": [ + preventDefault, + handlePreload, + // needs to be in between preventDefault and onClick$ to ensure it starts asap. + onClick$, + handleClientSideNavigation + ], + 'data-prefetch': prefetchData, + "q-e:mouseover": [ + linkProps.onMouseOver$, + handlePrefetch + ], + "q-e:focus": [ + linkProps.onFocus$, + handlePrefetch + ] + }, { + "q-e:qvisible": [] + }, /* @__PURE__ */ _jsxSorted(Slot, null, null, null, 3, "0K_2"), 0, "0K_3"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;;;;;;;;0CAgHwB,CAAC;IACvB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,MAAM,eAAe,MAAM,IAAI;IAC/B,MAAM,YAAY;IAClB,MAAM,EACJ,QAAQ,EACR,UAAU,YAAY,EACtB,MAAM,EACN,YAAY,EACZ,MAAM,EACN,GAAG,WACJ,GAAG,aAAa,GAAG,CAAC,IAAM,KAAK;IAChC,MAAM,gBAAgB,QAAQ,kBAAkB;QAAE,GAAG,SAAS;QAAE;IAAO,GAAG;IAC1E,UAAU,IAAI,GAAG,iBAAiB;IAClC,MAAM,eACJ,AAAC,CAAC,CAAC,iBAAiB,iBAAiB,SAAS,iBAAiB,QAAS,KAAK;IAC/E,MAAM,WACJ,gBACC,CAAC,CAAC,iBAAiB,iBAAiB,SAAS,QAAQ,eAAe,eAAe;IACtF,MAAM,iBAAiB,yDAgBnB,KAAK;IACT,MAAM,iBAAiB,yBACb,CAAC;QACL,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,MAAM,OAAO,IAAI,MAAM,QAAQ,IAAI,MAAM,MAAM,GACpE,MAAM,cAAc;IAExB,4GACA,KAAK;IACT,MAAM,6BAA6B;;;;;SAW/B,KAAK;IACT,MAAM;IAIN;;;;;;IAeA,OAAO,aAAa,GAAG,UAAI;QACzB,KAAK;QACA,UAAU,CAAC,CAAC;wBACd;0BAAA;QACH,aAAU;YACR;YACA;YACA,+EAA+E;YAC/E;YACA;SACD;QACD,iBAAiB;QACjB,iBAAc;YAAC,UAAU,YAAY;YAAE;SAAe;QACtD,aAAU;YAAC,UAAU,QAAQ;YAAE;SAAe;;QAC9C,gBAAa,EAAE;OACL,aAAa,GAAG,WAAI;AAElC\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "Link_component_nhj84CU1784", + "entry": null, + "displayName": "index.qwik.mjs_Link_component", + "hash": "nhj84CU1784", + "canonicalFilename": "index.qwik.mjs_Link_component_nhj84CU1784", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 3323, + 6187 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_GetForm_component_form_q_e_submit_D0PAP3eJ0Ng.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +// +export const GetForm_component_form_q_e_submit_D0PAP3eJ0Ng = async (_evt, form)=>{ + const nav = _captures[0]; + const formData = new FormData(form); + const params = new URLSearchParams(); + formData.forEach((value, key)=>{ + if (typeof value === 'string') params.append(key, value); + }); + await nav('?' + params.toString(), { + type: 'form', + forceReload: true + }); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;6DAwmDQ,OAAO,MAAM;;IACb,MAAM,WAAW,IAAI,SAAS;IAC9B,MAAM,SAAS,IAAI;IACnB,SAAS,OAAO,CAAC,CAAC,OAAO;QACvB,IAAI,OAAO,UAAU,UACnB,OAAO,MAAM,CAAC,KAAK;IAEvB;IACA,MAAM,IAAI,MAAM,OAAO,QAAQ,IAAI;QAAE,MAAM;QAAQ,aAAa;IAAK\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "GetForm_component_form_q_e_submit_D0PAP3eJ0Ng", + "entry": null, + "displayName": "index.qwik.mjs_GetForm_component_form_q_e_submit", + "hash": "D0PAP3eJ0Ng", + "canonicalFilename": "index.qwik.mjs_GetForm_component_form_q_e_submit_D0PAP3eJ0Ng", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": "GetForm_component_OIWHwJ5eKxg", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 54763, + 55115 + ], + "paramNames": [ + "_evt", + "form" + ], + "captureNames": [ + "nav" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_useQwikRouter_goto_OSnb99dm7Ow.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { QWIK_CITY_SCROLLER } from "./index.qwik.mjs"; +import { QWIK_ROUTER_SCROLLER } from "./index.qwik.mjs"; +import { _auto_getScrollHistory as getScrollHistory } from "./index.qwik.mjs"; +import { _auto_internalState as internalState } from "./index.qwik.mjs"; +import { _auto_preventNav as preventNav } from "./index.qwik.mjs"; +import { _auto_restoreScroll as restoreScroll } from "./index.qwik.mjs"; +import { isBrowser } from "@qwik.dev/core"; +import { isDev } from "@qwik.dev/core"; +import { b as isSameOrigin } from "./chunks/routing.qwik.mjs"; +import { a as isSamePath } from "./chunks/routing.qwik.mjs"; +import { l as loadClientData } from "./chunks/routing.qwik.mjs"; +import { d as loadRoute } from "./chunks/routing.qwik.mjs"; +import * as qwikRouterConfig from "@qwik-router-config"; +import { t as toUrl } from "./chunks/routing.qwik.mjs"; +// +export const useQwikRouter_goto_OSnb99dm7Ow = async (path, opt)=>{ + const actionState = _captures[0], navResolver = _captures[1], routeInternal = _captures[2], routeLocation = _captures[3]; + const { type = 'link', forceReload = path === void 0, // Hack for nav() because this API is already set. + replaceState = false, scroll = true } = typeof opt === 'object' ? opt : { + forceReload: opt + }; + internalState.navCount++; + if (isBrowser && type === 'link' && routeInternal.value.type === 'initial') { + const url2 = new URL(window.location.href); + routeInternal.value.dest = url2; + routeLocation.url = url2; + } + const lastDest = routeInternal.value.dest; + const dest = path === void 0 ? lastDest : typeof path === 'number' ? path : toUrl(path, routeLocation.url); + if (preventNav.$cbs$ && (forceReload || typeof dest === 'number' || !isSamePath(dest, lastDest) || !isSameOrigin(dest, lastDest))) { + const ourNavId = internalState.navCount; + const prevents = await Promise.all([ + ...preventNav.$cbs$.values() + ].map((cb)=>cb(dest))); + if (ourNavId !== internalState.navCount || prevents.some(Boolean)) { + if (ourNavId === internalState.navCount && type === 'popstate') history.pushState(null, '', lastDest); + return; + } + } + if (typeof dest === 'number') { + if (isBrowser) history.go(dest); + return; + } + if (!isSameOrigin(dest, lastDest)) { + if (isBrowser) location.href = dest.href; + return; + } + if (!forceReload && isSamePath(dest, lastDest)) { + if (isBrowser) { + if (type === 'link' && dest.href !== location.href) history.pushState(null, '', dest); + let scroller = document.getElementById(QWIK_ROUTER_SCROLLER); + if (!scroller) { + scroller = document.getElementById(QWIK_CITY_SCROLLER); + if (scroller && isDev) console.warn(`Please update your scroller ID to "${QWIK_ROUTER_SCROLLER}" as "${QWIK_CITY_SCROLLER}" is deprecated and will be removed in V3`); + } + if (!scroller) scroller = document.documentElement; + restoreScroll(type, dest, new URL(location.href), scroller, getScrollHistory()); + if (type === 'popstate') window._qRouterScrollEnabled = true; + } + return; + } + routeInternal.value = { + type, + dest, + forceReload, + replaceState, + scroll + }; + if (isBrowser) { + loadClientData(dest); + loadRoute(qwikRouterConfig.routes, qwikRouterConfig.menus, qwikRouterConfig.cacheModules, dest.pathname); + } + actionState.value = void 0; + routeLocation.isNavigating = true; + return new Promise((resolve)=>{ + navResolver.r = resolve; + }); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;;;;;8CAqmBiB,OAAO,MAAM;;IAC1B,MAAM,EACJ,OAAO,MAAM,EACb,cAAc,SAAS,KAAK,CAAC,EAC7B,kDAAkD;IAClD,eAAe,KAAK,EACpB,SAAS,IAAI,EACd,GAAG,OAAO,QAAQ,WAAW,MAAM;QAAE,aAAa;IAAI;IACvD,cAAc,QAAQ;IACtB,IAAI,aAAa,SAAS,UAAU,cAAc,KAAK,CAAC,IAAI,KAAK,WAAW;QAC1E,MAAM,OAAO,IAAI,IAAI,OAAO,QAAQ,CAAC,IAAI;QACzC,cAAc,KAAK,CAAC,IAAI,GAAG;QAC3B,cAAc,GAAG,GAAG;IACtB;IACA,MAAM,WAAW,cAAc,KAAK,CAAC,IAAI;IACzC,MAAM,OACJ,SAAS,KAAK,IAAI,WAAW,OAAO,SAAS,WAAW,OAAO,MAAM,MAAM,cAAc,GAAG;IAC9F,IACE,WAAW,KAAK,IAChB,CAAC,eACC,OAAO,SAAS,YAChB,CAAC,WAAW,MAAM,aAClB,CAAC,aAAa,MAAM,SAAS,GAC/B;QACA,MAAM,WAAW,cAAc,QAAQ;QACvC,MAAM,WAAW,MAAM,QAAQ,GAAG,CAAC;eAAI,WAAW,KAAK,CAAC,MAAM;SAAG,CAAC,GAAG,CAAC,CAAC,KAAO,GAAG;QACjF,IAAI,aAAa,cAAc,QAAQ,IAAI,SAAS,IAAI,CAAC,UAAU;YACjE,IAAI,aAAa,cAAc,QAAQ,IAAI,SAAS,YAClD,QAAQ,SAAS,CAAC,MAAM,IAAI;YAE9B;QACF;IACF;IACA,IAAI,OAAO,SAAS,UAAU;QAC5B,IAAI,WACF,QAAQ,EAAE,CAAC;QAEb;IACF;IACA,IAAI,CAAC,aAAa,MAAM,WAAW;QACjC,IAAI,WACF,SAAS,IAAI,GAAG,KAAK,IAAI;QAE3B;IACF;IACA,IAAI,CAAC,eAAe,WAAW,MAAM,WAAW;QAC9C,IAAI,WAAW;YACb,IAAI,SAAS,UAAU,KAAK,IAAI,KAAK,SAAS,IAAI,EAChD,QAAQ,SAAS,CAAC,MAAM,IAAI;YAE9B,IAAI,WAAW,SAAS,cAAc,CAAC;YACvC,IAAI,CAAC,UAAU;gBACb,WAAW,SAAS,cAAc,CAAC;gBACnC,IAAI,YAAY,OACd,QAAQ,IAAI,CACV,CAAC,mCAAmC,EAAE,qBAAqB,MAAM,EAAE,mBAAmB,yCAAyC,CAAC;YAGtI;YACA,IAAI,CAAC,UACH,WAAW,SAAS,eAAe;YAErC,cAAc,MAAM,MAAM,IAAI,IAAI,SAAS,IAAI,GAAG,UAAU;YAC5D,IAAI,SAAS,YACX,OAAO,qBAAqB,GAAG;QAEnC;QACA;IACF;IACA,cAAc,KAAK,GAAG;QACpB;QACA;QACA;QACA;QACA;IACF;IACA,IAAI,WAAW;QACb,eAAe;QACf,UACE,iBAAiB,MAAM,EACvB,iBAAiB,KAAK,EACtB,iBAAiB,YAAY,EAC7B,KAAK,QAAQ;IAEjB;IACA,YAAY,KAAK,GAAG,KAAK;IACzB,cAAc,YAAY,GAAG;IAC7B,OAAO,IAAI,QAAQ,CAAC;QAClB,YAAY,CAAC,GAAG;IAClB\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "useQwikRouter_goto_OSnb99dm7Ow", + "entry": null, + "displayName": "index.qwik.mjs_useQwikRouter_goto", + "hash": "OSnb99dm7Ow", + "canonicalFilename": "index.qwik.mjs_useQwikRouter_goto_OSnb99dm7Ow", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 19896, + 22718 + ], + "paramNames": [ + "path", + "opt" + ], + "captureNames": [ + "actionState", + "navResolver", + "routeInternal", + "routeLocation" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_ErrorBoundary_component_yTCHi5s1o00.mjs (ENTRY POINT)== + +import { Fragment } from "@qwik.dev/core/jsx-runtime"; +import { Slot } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +import { useErrorBoundary } from "@qwik.dev/core"; +import { useOnWindow } from "@qwik.dev/core"; +// +const q_ErrorBoundary_component_useOnWindow_GYhPAutMLGk = /*#__PURE__*/ qrl(()=>import("./index.qwik.mjs_ErrorBoundary_component_useOnWindow_GYhPAutMLGk.mjs"), "ErrorBoundary_component_useOnWindow_GYhPAutMLGk"); +// +export const ErrorBoundary_component_yTCHi5s1o00 = (props)=>{ + const store = useErrorBoundary(); + useOnWindow('qerror', q_ErrorBoundary_component_useOnWindow_GYhPAutMLGk.w([ + store + ])); + if (store.error && props.fallback$) return /* @__PURE__ */ _jsxSorted(Fragment, null, null, props.fallback$(store.error), 1, "0K_0"); + return /* @__PURE__ */ _jsxSorted(Slot, null, null, null, 3, "0K_1"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;;;;;;mDAwEiC,CAAC;IAChC,MAAM,QAAQ;IACd,YACE;;;IAKF,IAAI,MAAM,KAAK,IAAI,MAAM,SAAS,EAChC,OAAO,aAAa,GAAG,WAAI,sBAAsB,MAAM,SAAS,CAAC,MAAM,KAAK;IAE9E,OAAO,aAAa,GAAG,WAAI;AAC7B\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "ErrorBoundary_component_yTCHi5s1o00", + "entry": null, + "displayName": "index.qwik.mjs_ErrorBoundary_component", + "hash": "yTCHi5s1o00", + "canonicalFilename": "index.qwik.mjs_ErrorBoundary_component_yTCHi5s1o00", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 1620, + 1932 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= ../node_modules/@qwik.dev/router/index.qwik.mjs_routeActionQrl_action_submit_JY3C42B1B08.mjs (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { isServer } from "@qwik.dev/core"; +import { noSerialize } from "@qwik.dev/core"; +// +export const routeActionQrl_action_submit_JY3C42B1B08 = (input = {})=>{ + const currentAction = _captures[0], id = _captures[1], loc = _captures[2], state = _captures[3]; + if (isServer) throw new Error(`Actions can not be invoked within the server during SSR. +Action.run() can only be called on the browser, for example when a user clicks a button, or submits a form.`); + let data; + let form; + if (input instanceof SubmitEvent) { + form = input.target; + data = new FormData(form); + if ((input.submitter instanceof HTMLInputElement || input.submitter instanceof HTMLButtonElement) && input.submitter.name) { + if (input.submitter.name) data.append(input.submitter.name, input.submitter.value); + } + } else data = input; + return new Promise((resolve)=>{ + if (data instanceof FormData) state.formData = data; + state.submitted = true; + state.isRunning = true; + loc.isNavigating = true; + currentAction.value = { + data, + id, + resolve: noSerialize(resolve) + }; + }).then((_rawProps)=>{ + state.isRunning = false; + state.status = _rawProps.status; + state.value = _rawProps.result; + if (form) { + if (form.getAttribute('data-spa-reset') === 'true') form.reset(); + const detail = { + status: _rawProps.status, + value: _rawProps.result + }; + form.dispatchEvent(new CustomEvent('submitcompleted', { + bubbles: false, + cancelable: false, + composed: false, + detail + })); + } + return { + status: _rawProps.status, + value: _rawProps.result + }; + }); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/node_modules/@qwik.dev/router/index.qwik.mjs\"],\"names\":[],\"mappings\":\";;;;wDA2oCqB,CAAC,QAAQ,CAAC,CAAC;;IAC1B,IAAI,UACF,MAAM,IAAI,MAAM,CAAC;2GACkF,CAAC;IAEtG,IAAI;IACJ,IAAI;IACJ,IAAI,iBAAiB,aAAa;QAChC,OAAO,MAAM,MAAM;QACnB,OAAO,IAAI,SAAS;QACpB,IACE,CAAC,MAAM,SAAS,YAAY,oBAC1B,MAAM,SAAS,YAAY,iBAAiB,KAC9C,MAAM,SAAS,CAAC,IAAI,EAEpB;YAAA,IAAI,MAAM,SAAS,CAAC,IAAI,EACtB,KAAK,MAAM,CAAC,MAAM,SAAS,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,KAAK;QACzD;IAEJ,OACE,OAAO;IAET,OAAO,IAAI,QAAQ,CAAC;QAClB,IAAI,gBAAgB,UAClB,MAAM,QAAQ,GAAG;QAEnB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,IAAI,YAAY,GAAG;QACnB,cAAc,KAAK,GAAG;YACpB;YACA;YACA,SAAS,YAAY;QACvB;IACF,GAAG,IAAI,CAAC;QACN,MAAM,SAAS,GAAG;QAClB,MAAM,MAAM,aAFK;QAGjB,MAAM,KAAK,aAHF;QAIT,IAAI,MAAM;YACR,IAAI,KAAK,YAAY,CAAC,sBAAsB,QAC1C,KAAK,KAAK;YAEZ,MAAM,SAAS;gBAAE,MAAM,YARR;gBAQU,KAAK,YARvB;YAQgC;YACvC,KAAK,aAAa,CAChB,IAAI,YAAY,mBAAmB;gBACjC,SAAS;gBACT,YAAY;gBACZ,UAAU;gBACV;YACF;QAEJ;QACA,OAAO;YACL,MAAM,YAnBS;YAoBf,KAAK,YApBE;QAqBT;IACF\"}") +/* +{ + "origin": "../node_modules/@qwik.dev/router/index.qwik.mjs", + "name": "routeActionQrl_action_submit_JY3C42B1B08", + "entry": null, + "displayName": "index.qwik.mjs_routeActionQrl_action_submit", + "hash": "JY3C42B1B08", + "canonicalFilename": "index.qwik.mjs_routeActionQrl_action_submit_JY3C42B1B08", + "path": "../node_modules/@qwik.dev/router", + "extension": "mjs", + "parent": null, + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 39777, + 41467 + ], + "captureNames": [ + "currentAction", + "id", + "loc", + "state" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments.snap new file mode 100644 index 00000000000..e212b8a8236 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments.snap @@ -0,0 +1,78 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 866 +expression: output +--- +==INPUT== + + +import { $, component$, server$ } from '@qwik.dev/core'; +import { foo } from './foo'; +export const Works = component$((props) => { + const text = 'hola'; + return ( + <> +
console.log('in server', text))}>
+
foo()}>
+ + ); +}); + +============================= test.tsx_Works_component_Fragment_div_q_e_click_0UiSo8yqgZw.js (ENTRY POINT)== + +export const Works_component_Fragment_div_q_e_click_0UiSo8yqgZw = null; + + +Some("{\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\"}") +/* +{ + "origin": "test.tsx", + "name": "Works_component_Fragment_div_q_e_click_0UiSo8yqgZw", + "entry": null, + "displayName": "test.tsx_Works_component_Fragment_div_q_e_click", + "hash": "0UiSo8yqgZw", + "canonicalFilename": "test.tsx_Works_component_Fragment_div_q_e_click_0UiSo8yqgZw", + "path": "", + "extension": "js", + "parent": "Works_component_t45qL4vNGv0", + "ctxKind": "eventHandler", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 0, + 0 + ] +} +*/ +============================= test.js == + +import "./foo"; +import { componentQrl } from "@qwik.dev/core"; +import { serverQrl } from "@qwik.dev/core"; +import { _regSymbol } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { Fragment as _Fragment } from "@qwik.dev/core/jsx-runtime"; +// +const q_Works_component_Fragment_div_q_e_click_server_YY85RDCwwvA = /*#__PURE__*/ _noopQrl("Works_component_Fragment_div_q_e_click_server_YY85RDCwwvA"); +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +const q_qrl_4294901763 = /*#__PURE__*/ _noopQrl("Works_component_Fragment_div_q_e_click_0UiSo8yqgZw"); +// +q_Works_component_Fragment_div_q_e_click_server_YY85RDCwwvA.s(/*#__PURE__*/ _regSymbol(()=>console.log('in server', 'hola'), "YY85RDCwwvA")); +q_Works_component_t45qL4vNGv0.s((props)=>{ + return /*#__PURE__*/ _jsxSorted(_Fragment, null, null, [ + /*#__PURE__*/ _jsxSorted("div", { + "q-e:click": serverQrl(q_Works_component_Fragment_div_q_e_click_server_YY85RDCwwvA) + }, null, null, 2, null), + /*#__PURE__*/ _jsxSorted("div", null, { + "q-e:click": q_qrl_4294901763 + }, null, 3, null) + ], 1, "u6_0"); +}); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;;uFAOyB,IAAM,QAAQ,GAAG,CAAC,aAH7B;gCADkB,CAAC;IAEhC,qBACC;sBACA,WAAC;YAAI,aAAU;;sBACf,WAAC;YAAI,WAAQ;;;AAGf;AARA,OAAO,MAAM,sBAAQ,4CAQlB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments_hoisted.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments_hoisted.snap new file mode 100644 index 00000000000..0801ecfbd51 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments_hoisted.snap @@ -0,0 +1,52 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 913 +expression: output +--- +==INPUT== + + +import { $, component$, server$, useStyle$ } from '@qwik.dev/core'; + +export const Works = component$((props) => { + useStyle$(STYLES); + const text = 'hola'; + return ( +
console.log('in server', text))}>
+ ); +}); + +const STYLES = '.class {}'; + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { useStyleQrl } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { serverQrl } from "@qwik.dev/core"; +import { _regSymbol } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const q_Works_component_div_q_e_click_server_q39lOt7xGrI = /*#__PURE__*/ _noopQrl("Works_component_div_q_e_click_server_q39lOt7xGrI"); +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +const q_Works_component_useStyle_i40UL9JyQpg = /*#__PURE__*/ _noopQrl("Works_component_useStyle_i40UL9JyQpg"); +// +const Works_component_div_q_e_click_server_q39lOt7xGrI = /*#__PURE__*/ _regSymbol(()=>console.log('in server', 'hola'), "q39lOt7xGrI"); +q_Works_component_div_q_e_click_server_q39lOt7xGrI.s(Works_component_div_q_e_click_server_q39lOt7xGrI); +const Works_component_t45qL4vNGv0 = (props)=>{ + useStyleQrl(q_Works_component_useStyle_i40UL9JyQpg); + return /*#__PURE__*/ _jsxSorted("div", { + "q-e:click": serverQrl(q_Works_component_div_q_e_click_server_q39lOt7xGrI) + }, null, null, 2, "u6_0"); +}; +q_Works_component_t45qL4vNGv0.s(Works_component_t45qL4vNGv0); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); +const STYLES = '.class {}'; +q_Works_component_useStyle_i40UL9JyQpg.s(STYLES); +export { STYLES as _auto_STYLES }; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;kFAOyB,IAAM,QAAQ,GAAG,CAAC,aAF7B;;oCAFkB,CAAC;IAChC;IAEA,qBACC,WAAC;QAAI,aAAU;;AAEjB;;AANA,OAAO,MAAM,sBAAQ,4CAMlB;AAEH,MAAM,SAAS;yCAPJ\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments_inlined.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments_inlined.snap new file mode 100644 index 00000000000..161e78cb123 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_reg_ctx_name_segments_inlined.snap @@ -0,0 +1,40 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 892 +expression: output +--- +==INPUT== + + +import { $, component$, server$ } from '@qwik.dev/core'; +export const Works = component$((props) => { + const text = 'hola'; + return ( +
console.log('in server', text))}>
+ ); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { serverQrl } from "@qwik.dev/core"; +import { _regSymbol } from "@qwik.dev/core"; +import { _noopQrl } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +// +const q_Works_component_div_q_e_click_server_q39lOt7xGrI = /*#__PURE__*/ _noopQrl("Works_component_div_q_e_click_server_q39lOt7xGrI"); +const q_Works_component_t45qL4vNGv0 = /*#__PURE__*/ _noopQrl("Works_component_t45qL4vNGv0"); +// +q_Works_component_div_q_e_click_server_q39lOt7xGrI.s(/*#__PURE__*/ _regSymbol(()=>console.log('in server', 'hola'), "q39lOt7xGrI")); +q_Works_component_t45qL4vNGv0.s((props)=>{ + return /*#__PURE__*/ _jsxSorted("div", { + "q-e:click": serverQrl(q_Works_component_div_q_e_click_server_q39lOt7xGrI) + }, null, null, 2, "u6_0"); +}); +export const Works = /*#__PURE__*/ componentQrl(q_Works_component_t45qL4vNGv0); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;8EAKyB,IAAM,QAAQ,GAAG,CAAC,aAF7B;gCADkB,CAAC;IAEhC,qBACC,WAAC;QAAI,aAAU;;AAEjB;AALA,OAAO,MAAM,sBAAQ,4CAKlB\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_renamed_exports.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_renamed_exports.snap new file mode 100644 index 00000000000..0b4fe7dd922 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_renamed_exports.snap @@ -0,0 +1,109 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1075 +expression: output +--- +==INPUT== + + +import { component$ as Component, $ as onRender, useStore } from '@qwik.dev/core'; + +export const App = Component((props) => { + const state = useStore({thing: 0}); + + return onRender(() => ( +
{state.thing}
+ )); +}); + +============================= test.js == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_Component_NuXFTHRjvXE = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_Component_NuXFTHRjvXE"), "App_Component_NuXFTHRjvXE"); +// +export const App = /*#__PURE__*/ componentQrl(q_App_Component_NuXFTHRjvXE); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AAGA,OAAO,MAAM,oBAAM,0CAMhB\"}") +============================= test.tsx_App_Component_1_A08tXHb9pEk.js (ENTRY POINT)== + +import { _captures } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +// +export const App_Component_1_A08tXHb9pEk = ()=>{ + const state = _captures[0]; + return /*#__PURE__*/ _jsxSorted("div", null, null, _wrapProp(state, "thing"), 3, "u6_0"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;2CAMiB;;yBACf,WAAC,6BAAK\"}") +/* +{ + "origin": "test.tsx", + "name": "App_Component_1_A08tXHb9pEk", + "entry": null, + "displayName": "test.tsx_App_Component_1", + "hash": "A08tXHb9pEk", + "canonicalFilename": "test.tsx_App_Component_1_A08tXHb9pEk", + "path": "", + "extension": "js", + "parent": "App_Component_NuXFTHRjvXE", + "ctxKind": "function", + "ctxName": "$", + "captures": true, + "loc": [ + 183, + 220 + ], + "captureNames": [ + "state" + ] +} +*/ +============================= test.tsx_App_Component_NuXFTHRjvXE.js (ENTRY POINT)== + +import { qrl } from "@qwik.dev/core"; +import { useStore } from "@qwik.dev/core"; +// +const q_App_Component_1_A08tXHb9pEk = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_Component_1_A08tXHb9pEk"), "App_Component_1_A08tXHb9pEk"); +// +export const App_Component_NuXFTHRjvXE = (props)=>{ + const state = useStore({ + thing: 0 + }); + return q_App_Component_1_A08tXHb9pEk.w([ + state + ]); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;yCAG6B,CAAC;IAC7B,MAAM,QAAQ,SAAS;QAAC,OAAO;IAAC;IAEhC;;;AAGD\"}") +/* +{ + "origin": "test.tsx", + "name": "App_Component_NuXFTHRjvXE", + "entry": null, + "displayName": "test.tsx_App_Component", + "hash": "NuXFTHRjvXE", + "canonicalFilename": "test.tsx_App_Component_NuXFTHRjvXE", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 115, + 224 + ], + "paramNames": [ + "props" + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_segment_variable_migration.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_segment_variable_migration.snap new file mode 100644 index 00000000000..6cdf906b599 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_segment_variable_migration.snap @@ -0,0 +1,119 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 5770 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +// This helper is only used by App component, so it should be migrated to its segment +const helperFn = (msg) => { + console.log('Helper: ' + msg); + return msg.toUpperCase(); +}; + +// This shared variable is used by multiple segments, so it should stay at root +const SHARED_CONFIG = { value: 42 }; + +// This is an export, so it must stay at root +export const publicHelper = () => console.log('public'); + +export const App = component$(() => { + const result = helperFn('hello'); + return
{result} {SHARED_CONFIG.value}
; +}); + +export const Other = component$(() => { + return
{SHARED_CONFIG.value}
; +}); + +============================= test.tsx_Other_component_C1my3EIdP1k.tsx (ENTRY POINT)== + +import { _auto_SHARED_CONFIG as SHARED_CONFIG } from "./test"; +// +export const Other_component_C1my3EIdP1k = ()=>{ + return
{SHARED_CONFIG.value}
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;2CAoBgC;IAC/B,QAAQ,KAAK,cAAc,KAAK,GAAG;AACpC\"}") +/* +{ + "origin": "test.tsx", + "name": "Other_component_C1my3EIdP1k", + "entry": null, + "displayName": "test.tsx_Other_component", + "hash": "C1my3EIdP1k", + "canonicalFilename": "test.tsx_Other_component_C1my3EIdP1k", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 608, + 659 + ] +} +*/ +============================= test.tsx == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_App_component_ckEPmXZlub0 = /*#__PURE__*/ qrl(()=>import("./test.tsx_App_component_ckEPmXZlub0"), "App_component_ckEPmXZlub0"); +const q_Other_component_C1my3EIdP1k = /*#__PURE__*/ qrl(()=>import("./test.tsx_Other_component_C1my3EIdP1k"), "Other_component_C1my3EIdP1k"); +// This shared variable is used by multiple segments, so it should stay at root +// +const SHARED_CONFIG = { + value: 42 +}; +// This is an export, so it must stay at root +export const publicHelper = ()=>console.log('public'); +export const App = /*#__PURE__*/ componentQrl(q_App_component_ckEPmXZlub0); +export const Other = /*#__PURE__*/ componentQrl(q_Other_component_C1my3EIdP1k); +export { SHARED_CONFIG as _auto_SHARED_CONFIG }; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;AASA,+EAA+E;;AAC/E,MAAM,gBAAgB;IAAE,OAAO;AAAG;AAElC,6CAA6C;AAC7C,OAAO,MAAM,eAAe,IAAM,QAAQ,GAAG,CAAC,UAAU;AAExD,OAAO,MAAM,oBAAM,0CAGhB;AAEH,OAAO,MAAM,sBAAQ,4CAElB\"}") +============================= test.tsx_App_component_ckEPmXZlub0.tsx (ENTRY POINT)== + +import { _auto_SHARED_CONFIG as SHARED_CONFIG } from "./test"; +// +const helperFn = (msg)=>{ + console.log('Helper: ' + msg); + return msg.toUpperCase(); +}; +export const App_component_ckEPmXZlub0 = ()=>{ + const result = helperFn('hello'); + return
{result} {SHARED_CONFIG.value}
; +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;MAIM,WAAW,CAAC;IACjB,QAAQ,GAAG,CAAC,aAAa;IACzB,OAAO,IAAI,WAAW;AACvB;yCAQ8B;IAC7B,MAAM,SAAS,SAAS;IACxB,QAAQ,KAAK,OAAO,CAAC,CAAC,cAAc,KAAK,GAAG;AAC7C\"}") +/* +{ + "origin": "test.tsx", + "name": "App_component_ckEPmXZlub0", + "entry": null, + "displayName": "test.tsx_App_component", + "hash": "ckEPmXZlub0", + "canonicalFilename": "test.tsx_App_component_ckEPmXZlub0", + "path": "", + "extension": "tsx", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 477, + 572 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_self_referential_component_migration.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_self_referential_component_migration.snap new file mode 100644 index 00000000000..63db05e71ca --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_self_referential_component_migration.snap @@ -0,0 +1,265 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 5888 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; + +// Self-referential component: the Nested component references itself in its JSX +// This should be migrated to its segment using two-phase emission (let + assign) +// to avoid Temporal Dead Zone errors +export const Nested = component$(() => { + return ( +
+ +
+ ); +}); + +// Another self-referential component with conditional rendering +export const RecursiveList = component$((props) => { + if (props.depth === 0) return
End
; + return ( +
+ Level {props.depth} + +
+ ); +}); + +// Mutually recursive components: A references B, B references A +const ComponentA = component$(() => { + return ( +
+ A + +
+ ); +}); + +const ComponentB = component$(() => { + return ( +
+ B + +
+ ); +}); + +export const MutualExample = component$(() => { + return ; +}); + +============================= test.tsx_Nested_component_8cqIQQSPqhE.ts (ENTRY POINT)== + +import { Nested } from "./test"; +import { _jsxSorted } from "@qwik.dev/core"; +// +export const Nested_component_8cqIQQSPqhE = ()=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, /*#__PURE__*/ _jsxSorted(Nested, null, null, null, 3, "u6_0"), 1, "u6_1"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;4CAMiC;IAChC,qBACC,WAAC,iCACA,WAAC;AAGJ\"}") +/* +{ + "origin": "test.tsx", + "name": "Nested_component_8cqIQQSPqhE", + "entry": null, + "displayName": "test.tsx_Nested_component", + "hash": "8cqIQQSPqhE", + "canonicalFilename": "test.tsx_Nested_component_8cqIQQSPqhE", + "path": "", + "extension": "ts", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 282, + 336 + ] +} +*/ +============================= test.tsx_RecursiveList_component_ignTe6QguYQ.ts (ENTRY POINT)== + +import { RecursiveList } from "./test"; +import { _fnSignal } from "@qwik.dev/core"; +import { _jsxSorted } from "@qwik.dev/core"; +import { _wrapProp } from "@qwik.dev/core"; +// +const _hf0 = (p0)=>p0.depth - 1; +const _hf0_str = "p0.depth-1"; +export const RecursiveList_component_ignTe6QguYQ = (props)=>{ + if (props.depth === 0) return /*#__PURE__*/ _jsxSorted("div", null, null, "End", 3, "u6_2"); + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + "Level ", + _wrapProp(props, "depth"), + /*#__PURE__*/ _jsxSorted(RecursiveList, null, { + depth: _fnSignal(_hf0, [ + props + ], _hf0_str) + }, null, 3, "u6_3") + ], 1, "u6_4"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;mBAoByB,GAAM,KAAK,GAAG;;mDALC,CAAC;IACxC,IAAI,MAAM,KAAK,KAAK,GAAG,qBAAO,WAAC,mBAAI;IACnC,qBACC,WAAC;QAAI;kBACG;sBACP,WAAC;YAAc,KAAK;;;;;AAGvB\"}") +/* +{ + "origin": "test.tsx", + "name": "RecursiveList_component_ignTe6QguYQ", + "entry": null, + "displayName": "test.tsx_RecursiveList_component", + "hash": "ignTe6QguYQ", + "canonicalFilename": "test.tsx_RecursiveList_component_ignTe6QguYQ", + "path": "", + "extension": "ts", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 445, + 605 + ], + "paramNames": [ + "props" + ] +} +*/ +============================= test.tsx_MutualExample_component_LXt10RL0k44.ts (ENTRY POINT)== + +import { _auto_ComponentA as ComponentA } from "./test"; +import { _jsxSorted } from "@qwik.dev/core"; +// +export const MutualExample_component_LXt10RL0k44 = ()=>{ + return /*#__PURE__*/ _jsxSorted(ComponentA, null, null, null, 3, "u6_9"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;mDA4CwC;IACvC,qBAAO,WAAC;AACT\"}") +/* +{ + "origin": "test.tsx", + "name": "MutualExample_component_LXt10RL0k44", + "entry": null, + "displayName": "test.tsx_MutualExample_component", + "hash": "LXt10RL0k44", + "canonicalFilename": "test.tsx_MutualExample_component_LXt10RL0k44", + "path": "", + "extension": "ts", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 908, + 941 + ] +} +*/ +============================= test.tsx_ComponentB_component_WfCOFVxlmq4.ts (ENTRY POINT)== + +import { _auto_ComponentA as ComponentA } from "./test"; +import { _jsxSorted } from "@qwik.dev/core"; +// +export const ComponentB_component_WfCOFVxlmq4 = ()=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + "B", + /*#__PURE__*/ _jsxSorted(ComponentA, null, null, null, 3, "u6_7") + ], 1, "u6_8"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;gDAmC8B;IAC7B,qBACC,WAAC;QAAI;sBAEJ,WAAC;;AAGJ\"}") +/* +{ + "origin": "test.tsx", + "name": "ComponentB_component_WfCOFVxlmq4", + "entry": null, + "displayName": "test.tsx_ComponentB_component", + "hash": "WfCOFVxlmq4", + "canonicalFilename": "test.tsx_ComponentB_component_WfCOFVxlmq4", + "path": "", + "extension": "ts", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 801, + 864 + ] +} +*/ +============================= test.tsx_ComponentA_component_100sEyGkGuA.ts (ENTRY POINT)== + +import { _jsxSorted } from "@qwik.dev/core"; +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_ComponentB_component_WfCOFVxlmq4 = /*#__PURE__*/ qrl(()=>import("./test.tsx_ComponentB_component_WfCOFVxlmq4"), "ComponentB_component_WfCOFVxlmq4"); +// +const ComponentB = /*#__PURE__*/ componentQrl(q_ComponentB_component_WfCOFVxlmq4); +export const ComponentA_component_100sEyGkGuA = ()=>{ + return /*#__PURE__*/ _jsxSorted("div", null, null, [ + "A", + /*#__PURE__*/ _jsxSorted(ComponentB, null, null, null, 3, "u6_5") + ], 1, "u6_6"); +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;MAmCM,2BAAa;gDATW;IAC7B,qBACC,WAAC;QAAI;sBAEJ,WAAC;;AAGJ\"}") +/* +{ + "origin": "test.tsx", + "name": "ComponentA_component_100sEyGkGuA", + "entry": null, + "displayName": "test.tsx_ComponentA_component", + "hash": "100sEyGkGuA", + "canonicalFilename": "test.tsx_ComponentA_component_100sEyGkGuA", + "path": "", + "extension": "ts", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 704, + 767 + ] +} +*/ +============================= test.ts == + +import { componentQrl } from "@qwik.dev/core"; +import { qrl } from "@qwik.dev/core"; +// +const q_ComponentA_component_100sEyGkGuA = /*#__PURE__*/ qrl(()=>import("./test.tsx_ComponentA_component_100sEyGkGuA"), "ComponentA_component_100sEyGkGuA"); +// +qrl(()=>import("./test.tsx_ComponentB_component_WfCOFVxlmq4"), "ComponentB_component_WfCOFVxlmq4"); +// +const q_MutualExample_component_LXt10RL0k44 = /*#__PURE__*/ qrl(()=>import("./test.tsx_MutualExample_component_LXt10RL0k44"), "MutualExample_component_LXt10RL0k44"); +const q_Nested_component_8cqIQQSPqhE = /*#__PURE__*/ qrl(()=>import("./test.tsx_Nested_component_8cqIQQSPqhE"), "Nested_component_8cqIQQSPqhE"); +const q_RecursiveList_component_ignTe6QguYQ = /*#__PURE__*/ qrl(()=>import("./test.tsx_RecursiveList_component_ignTe6QguYQ"), "RecursiveList_component_ignTe6QguYQ"); +// Self-referential component: the Nested component references itself in its JSX +// This should be migrated to its segment using two-phase emission (let + assign) +// to avoid Temporal Dead Zone errors +// +export const Nested = /*#__PURE__*/ componentQrl(q_Nested_component_8cqIQQSPqhE); +// Another self-referential component with conditional rendering +export const RecursiveList = /*#__PURE__*/ componentQrl(q_RecursiveList_component_ignTe6QguYQ); +// Mutually recursive components: A references B, B references A +const ComponentA = /*#__PURE__*/ componentQrl(q_ComponentA_component_100sEyGkGuA); +export const MutualExample = /*#__PURE__*/ componentQrl(q_MutualExample_component_LXt10RL0k44); +export { ComponentA as _auto_ComponentA }; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;AAGA,gFAAgF;AAChF,iFAAiF;AACjF,qCAAqC;;AACrC,OAAO,MAAM,uBAAS,6CAMnB;AAEH,gEAAgE;AAChE,OAAO,MAAM,8BAAgB,oDAQ1B;AAEH,gEAAgE;AAChE,MAAM,2BAAa;AAkBnB,OAAO,MAAM,8BAAgB,oDAE1B\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_server_auth.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_server_auth.snap new file mode 100644 index 00000000000..079378a5860 --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_server_auth.snap @@ -0,0 +1,153 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1879 +expression: output +--- +==INPUT== + + +import GitHub from '@auth/core/providers/github' +import Facebook from 'next-auth/providers/facebook' +import Google from 'next-auth/providers/google' +import {serverAuth$, auth$} from '@auth/qwik'; + +export const { onRequest, logout, getSession, signup } = serverAuth$({ + providers: [ + GitHub({ + clientId: process.env.GITHUB_ID, + clientSecret: process.env.GITHUB_SECRET + }), + Facebook({ + clientId: import.meta.env.FACEBOOK_ID, + clientSecret: import.meta.env.FACEBOOK_SECRET + }), + Google({ + clientId: process.env.GOOGLE_ID, + clientSecret: process.env.GOOGLE_SECRET + }) + ] +}); + +export const { onRequest, logout, getSession, signup } = auth$({ + providers: [ + GitHub({ + clientId: process.env.GITHUB_ID, + clientSecret: process.env.GITHUB_SECRET + }), + Facebook({ + clientId: process.env.FACEBOOK_ID, + clientSecret: process.env.FACEBOOK_SECRET + }), + Google({ + clientId: process.env.GOOGLE_ID, + clientSecret: process.env.GOOGLE_SECRET + }) + ] +}); + +============================= test.js == + +import { serverAuthQrl } from "@auth/qwik"; +import { qrl } from "@qwik.dev/core"; +// +/*#__PURE__*/ qrl(()=>import("./test.tsx_auth_GU0aY5QCETY"), "auth_GU0aY5QCETY"); +// +const q_serverAuth_qVqpX2a0p9Y = /*#__PURE__*/ qrl(()=>import("./test.tsx_serverAuth_qVqpX2a0p9Y"), "serverAuth_qVqpX2a0p9Y"); +// +export const { onRequest, logout, getSession, signup } = serverAuthQrl(q_serverAuth_qVqpX2a0p9Y); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;AAMA,OAAO,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,wCAetD\"}") +============================= test.tsx_auth_GU0aY5QCETY.js (ENTRY POINT)== + +import Facebook from "next-auth/providers/facebook"; +import GitHub from "@auth/core/providers/github"; +import Google from "next-auth/providers/google"; +// +export const auth_GU0aY5QCETY = { + providers: [ + GitHub({ + clientId: process.env.GITHUB_ID, + clientSecret: process.env.GITHUB_SECRET + }), + Facebook({ + clientId: process.env.FACEBOOK_ID, + clientSecret: process.env.FACEBOOK_SECRET + }), + Google({ + clientId: process.env.GOOGLE_ID, + clientSecret: process.env.GOOGLE_SECRET + }) + ] +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;gCAuB+D;IAC9D,WAAW;QACX,OAAO;YACN,UAAU,QAAQ,GAAG,CAAC,SAAS;YAC/B,cAAc,QAAQ,GAAG,CAAC,aAAa;QACxC;QACA,SAAS;YACR,UAAU,QAAQ,GAAG,CAAC,WAAW;YACjC,cAAc,QAAQ,GAAG,CAAC,eAAe;QAC1C;QACA,OAAO;YACN,UAAU,QAAQ,GAAG,CAAC,SAAS;YAC/B,cAAc,QAAQ,GAAG,CAAC,aAAa;QACxC;KACC;AACF\"}") +/* +{ + "origin": "test.tsx", + "name": "auth_GU0aY5QCETY", + "entry": null, + "displayName": "test.tsx_auth", + "hash": "GU0aY5QCETY", + "canonicalFilename": "test.tsx_auth_GU0aY5QCETY", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "auth$", + "captures": false, + "loc": [ + 644, + 945 + ] +} +*/ +============================= test.tsx_serverAuth_qVqpX2a0p9Y.js (ENTRY POINT)== + +import Facebook from "next-auth/providers/facebook"; +import GitHub from "@auth/core/providers/github"; +import Google from "next-auth/providers/google"; +// +export const serverAuth_qVqpX2a0p9Y = { + providers: [ + GitHub({ + clientId: process.env.GITHUB_ID, + clientSecret: process.env.GITHUB_SECRET + }), + Facebook({ + clientId: import.meta.env.FACEBOOK_ID, + clientSecret: import.meta.env.FACEBOOK_SECRET + }), + Google({ + clientId: process.env.GOOGLE_ID, + clientSecret: process.env.GOOGLE_SECRET + }) + ] +}; + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;sCAMqE;IACpE,WAAW;QACX,OAAO;YACN,UAAU,QAAQ,GAAG,CAAC,SAAS;YAC/B,cAAc,QAAQ,GAAG,CAAC,aAAa;QACxC;QACA,SAAS;YACR,UAAU,YAAY,GAAG,CAAC,WAAW;YACrC,cAAc,YAAY,GAAG,CAAC,eAAe;QAC9C;QACA,OAAO;YACN,UAAU,QAAQ,GAAG,CAAC,SAAS;YAC/B,cAAc,QAAQ,GAAG,CAAC,aAAa;QACxC;KACC;AACF\"}") +/* +{ + "origin": "test.tsx", + "name": "serverAuth_qVqpX2a0p9Y", + "entry": null, + "displayName": "test.tsx_serverAuth", + "hash": "qVqpX2a0p9Y", + "canonicalFilename": "test.tsx_serverAuth_qVqpX2a0p9Y", + "path": "", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "serverAuth$", + "captures": false, + "loc": [ + 268, + 577 + ] +} +*/ +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_skip_transform.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_skip_transform.snap new file mode 100644 index 00000000000..c4945a1607d --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_skip_transform.snap @@ -0,0 +1,34 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 1371 +expression: output +--- +==INPUT== + + +import { component$ as Component, $ as onRender } from '@qwik.dev/core'; + +export const handler = $(()=>console.log('hola')); + +export const App = component$((props) => { + useStyles$('hola'); + return $(() => ( +
{state.thing}
+ )); +}); + +============================= test.js == + +import { _jsxSorted } from "@qwik.dev/core"; +// +export const handler = $(()=>console.log('hola')); +export const App = component$((props)=>{ + useStyles$('hola'); + return $(()=>/*#__PURE__*/ _jsxSorted("div", null, null, state.thing, 1, "u6_0")); +}); + + +Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;AAGA,OAAO,MAAM,UAAU,EAAE,IAAI,QAAQ,GAAG,CAAC,SAAS;AAElD,OAAO,MAAM,MAAM,WAAW,CAAC;IAC9B,WAAW;IACX,OAAO,EAAE,kBACR,WAAC,mBAAK,MAAM,KAAK;AAEnB,GAAG\"}") +== DIAGNOSTICS == + +[] diff --git a/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_spread_jsx.snap b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_spread_jsx.snap new file mode 100644 index 00000000000..a134efed51d --- /dev/null +++ b/packages/ts-optimizer/match-these-snaps/qwik_core__test__example_spread_jsx.snap @@ -0,0 +1,123 @@ +--- +source: packages/optimizer/core/src/test.rs +assertion_line: 2367 +expression: output +--- +==INPUT== + + +import { component$ } from '@qwik.dev/core'; +import { useDocumentHead, useLocation } from '@qwik.dev/router'; + +/** + * The RouterHead component is placed inside of the document `` element. + */ +export const RouterHead = component$(() => { + const head = useDocumentHead(); + const loc = useLocation(); + + return ( + <> + {head.title} + + + + + + {head.meta.map((m) => ( + + ))} + + {head.links.map((l) => ( + + ))} + + {head.styles.map((s) => ( +