From 63b18fbddcfa9c61845d17cd8bc9d43dae825421 Mon Sep 17 00:00:00 2001 From: LuLaValva Date: Mon, 22 Jan 2024 13:38:57 -0800 Subject: [PATCH] feat: remove context tags --- .sizes.json | 24 +-- packages/runtime-tags/src/html/writer.ts | 2 + .../__snapshots__/csr-sanitized.expected.md | 6 - .../__snapshots__/csr.expected.md | 11 -- .../dom.expected/components/child.js | 8 - .../__snapshots__/dom.expected/template.js | 15 -- .../html.expected/components/child.js | 9 - .../__snapshots__/html.expected/template.js | 10 - .../__snapshots__/ssr-sanitized.expected.md | 6 - .../__snapshots__/ssr.expected.md | 26 --- .../components/child.marko | 5 - .../context-tag-derivation/template.marko | 3 - .../fixtures/context-tag-derivation/test.ts | 1 - .../__snapshots__/dom.expected/template.js | 7 - .../__snapshots__/html.expected/template.js | 10 - .../__snapshots__/ssr-sanitized.expected.md | 8 - .../__snapshots__/ssr.expected.md | 29 --- .../context-tag-from-global/template.marko | 6 - .../fixtures/context-tag-from-global/test.ts | 3 - .../__snapshots__/html.expected/other.js | 12 -- .../__snapshots__/html.expected/template.js | 14 -- .../other.marko | 3 - .../template.marko | 8 - .../context-tag-from-relative-path/test.ts | 3 - .../__snapshots__/csr-sanitized.expected.md | 8 - .../__snapshots__/csr.expected.md | 13 -- .../__snapshots__/dom.expected/template.js | 12 -- .../__snapshots__/html.expected/template.js | 13 -- .../__snapshots__/ssr-sanitized.expected.md | 8 - .../__snapshots__/ssr.expected.md | 29 --- .../context-tag-from-self/template.marko | 8 - .../fixtures/context-tag-from-self/test.ts | 1 - .../__snapshots__/csr-sanitized.expected.md | 6 - .../__snapshots__/csr.expected.md | 11 -- .../dom.expected/components/other.js | 16 -- .../__snapshots__/dom.expected/template.js | 14 -- .../html.expected/components/other.js | 14 -- .../__snapshots__/html.expected/template.js | 14 -- .../__snapshots__/ssr-sanitized.expected.md | 6 - .../__snapshots__/ssr.expected.md | 35 ---- .../components/other.marko | 3 - .../context-tag-from-tag-name/template.marko | 6 - .../context-tag-from-tag-name/test.ts | 1 - .../__snapshots__/csr-sanitized.expected.md | 44 ----- .../__snapshots__/csr.expected.md | 62 ------ .../__snapshots__/dom.expected/template.js | 23 --- .../__snapshots__/html.expected/template.js | 32 ---- .../__snapshots__/ssr-sanitized.expected.md | 13 -- .../__snapshots__/ssr.expected.md | 45 ----- .../fixtures/context-tag-in-if/template.marko | 12 -- .../fixtures/context-tag-in-if/test.ts | 7 - .../__snapshots__/csr-sanitized.expected.md | 26 --- .../__snapshots__/csr.expected.md | 37 ---- .../dom.expected/components/child.js | 7 - .../__snapshots__/dom.expected/template.js | 26 --- .../html.expected/components/child.js | 7 - .../__snapshots__/html.expected/template.js | 16 -- .../__snapshots__/ssr-sanitized.expected.md | 11 -- .../__snapshots__/ssr.expected.md | 42 ---- .../components/child.marko | 6 - .../context-tag-reactive/template.marko | 5 - .../fixtures/context-tag-reactive/test.ts | 7 - .../__snapshots__/csr-sanitized.expected.md | 6 - .../__snapshots__/csr.expected.md | 11 -- .../dom.expected/components/child.js | 7 - .../__snapshots__/dom.expected/template.js | 15 -- .../html.expected/components/child.js | 8 - .../__snapshots__/html.expected/template.js | 10 - .../__snapshots__/ssr-sanitized.expected.md | 6 - .../__snapshots__/ssr.expected.md | 26 --- .../context-tag-static/components/child.marko | 4 - .../context-tag-static/template.marko | 3 - .../fixtures/context-tag-static/test.ts | 1 - .../__snapshots__/dom.expected/template.js | 11 +- .../__snapshots__/html.expected/template.js | 5 +- .../src/__tests__/main.test.ts | 3 +- packages/translator-tags/src/core/get.ts | 180 ------------------ packages/translator-tags/src/core/index.ts | 4 - packages/translator-tags/src/core/put.ts | 112 ----------- .../src/visitors/placeholder.ts | 106 ++++++----- .../src/visitors/referenced-identifier.ts | 48 +++-- 81 files changed, 107 insertions(+), 1334 deletions(-) delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/components/child.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/components/child.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/test.ts delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/dom.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/test.ts delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/other.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/test.ts delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/dom.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/test.ts delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/components/other.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/components/other.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/test.ts delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/dom.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/test.ts delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/components/child.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/components/child.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/test.ts delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/components/child.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/components/child.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/template.js delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr-sanitized.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko delete mode 100644 packages/translator-tags/src/__tests__/fixtures/context-tag-static/test.ts delete mode 100644 packages/translator-tags/src/core/get.ts delete mode 100644 packages/translator-tags/src/core/put.ts diff --git a/.sizes.json b/.sizes.json index d2d330a9c5..b5fae0cc8c 100644 --- a/.sizes.json +++ b/.sizes.json @@ -8,7 +8,7 @@ "name": "*", "total": { "min": 13308, - "gzip": 5723, + "gzip": 5718, "brotli": 5187 } }, @@ -21,12 +21,12 @@ }, "runtime": { "min": 4050, - "gzip": 1885, + "gzip": 1879, "brotli": 1682 }, "total": { "min": 4401, - "gzip": 2161, + "gzip": 2155, "brotli": 1915 } }, @@ -34,17 +34,17 @@ "name": "counter 💧", "user": { "min": 204, - "gzip": 179, + "gzip": 177, "brotli": 151 }, "runtime": { "min": 2612, - "gzip": 1350, + "gzip": 1354, "brotli": 1210 }, "total": { "min": 2816, - "gzip": 1529, + "gzip": 1531, "brotli": 1361 } }, @@ -52,17 +52,17 @@ "name": "comments", "user": { "min": 1216, - "gzip": 704, + "gzip": 709, "brotli": 636 }, "runtime": { "min": 7478, - "gzip": 3447, + "gzip": 3469, "brotli": 3121 }, "total": { "min": 8694, - "gzip": 4151, + "gzip": 4178, "brotli": 3757 } }, @@ -70,17 +70,17 @@ "name": "comments 💧", "user": { "min": 988, - "gzip": 587, + "gzip": 591, "brotli": 544 }, "runtime": { "min": 7999, - "gzip": 3683, + "gzip": 3699, "brotli": 3342 }, "total": { "min": 8987, - "gzip": 4270, + "gzip": 4290, "brotli": 3886 } } diff --git a/packages/runtime-tags/src/html/writer.ts b/packages/runtime-tags/src/html/writer.ts index 488aff3842..890a18cff5 100644 --- a/packages/runtime-tags/src/html/writer.ts +++ b/packages/runtime-tags/src/html/writer.ts @@ -43,6 +43,7 @@ interface StreamData { placeholderId: number; scopeLookup: Map; runtimeFlushed: boolean; + global: Record; serializer?: Serializer; } @@ -72,6 +73,7 @@ export function createRenderFn(renderer: Renderer) { }; $_buffer = createInitialBuffer(stream); + streamState.global = context; $_streamData = createStreamState(streamState); pushContext("$", context); diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr-sanitized.expected.md deleted file mode 100644 index 50de2124ac..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr-sanitized.expected.md +++ /dev/null @@ -1,6 +0,0 @@ -# Render undefined -```html -
- 123 -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md deleted file mode 100644 index 627ec78fea..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md +++ /dev/null @@ -1,11 +0,0 @@ -# Render undefined -```html -
- 123 -
-``` - -# Mutations -``` -inserted #text0, div1 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/components/child.js deleted file mode 100644 index aec9f43be6..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/components/child.js +++ /dev/null @@ -1,8 +0,0 @@ -import { data as _data, value as _value, contextClosure as _contextClosure, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _y = /* @__PURE__ */_value("y", (_scope, y) => _data(_scope["#text/0"], y)); -const _x = /* @__PURE__ */_contextClosure("x", "packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko", (_scope, x) => _y(_scope, x)); -export const template = "
"; -export const walks = /* next(1), get, out(1) */"D l"; -export const setup = function () {}; -export const closures = [_x]; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup, closures), "packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/template.js deleted file mode 100644 index 0029a8a787..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/template.js +++ /dev/null @@ -1,15 +0,0 @@ -import { initContextProvider as _initContextProvider, childClosures as _childClosures, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -import { setup as _child, template as _child_template, walks as _child_walks, closures as _child_closures } from "./components/child.marko"; -const _setup$putBody = _scope => { - _child(_scope["#childScope/0"]); -}; -const _putBody = /* @__PURE__ */_createRenderer(`${_child_template}`, /* beginChild, _child_walks, endChild */`/${_child_walks}&`, _setup$putBody, [_childClosures(_child_closures, "#childScope/0")]); -const _put = /* @__PURE__ */_value("0:", null, _dynamicSubscribers("0:")); -const _setup = _scope => { - _initContextProvider(_scope, "#text/0", "0:", "packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko", _putBody); - _put(_scope, 123); -}; -export const template = ""; -export const walks = /* replace, over(1) */"%b"; -export const setup = _setup; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/components/child.js deleted file mode 100644 index 1dad18435e..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/components/child.js +++ /dev/null @@ -1,9 +0,0 @@ -import { write as _write, getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _write("
"); - const x = _getInContext("packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko"); - const y = x; - _write(`${_escapeXML(y)}${_markResumeNode(_scope0_id, "#text/0")}
`); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/template.js deleted file mode 100644 index 2e43cf5cd7..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,10 +0,0 @@ -import { pushContext as _pushContext, nextScopeId as _nextScopeId, popContext as _popContext, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -import _child from "./components/child.marko"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _pushContext("packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko", 123); - const _scope1_id = _nextScopeId(); - _child._({}); - _popContext(); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr-sanitized.expected.md deleted file mode 100644 index 1db568537f..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr-sanitized.expected.md +++ /dev/null @@ -1,6 +0,0 @@ -# Render "End" -```html -
- 123 -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md deleted file mode 100644 index 64aec10948..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md +++ /dev/null @@ -1,26 +0,0 @@ -# Write -
123
- - -# Render "End" -```html - - - -
- 123 - -
- - -``` - -# Mutations -``` -inserted #document/html0 -inserted #document/html0/head0 -inserted #document/html0/body1 -inserted #document/html0/body1/div0 -inserted #document/html0/body1/div0/#text0 -inserted #document/html0/body1/div0/#comment1 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko deleted file mode 100644 index 318462d5f1..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko +++ /dev/null @@ -1,5 +0,0 @@ -
- - - ${y} -
diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko deleted file mode 100644 index 2361170772..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/test.ts deleted file mode 100644 index e5e0f90255..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/test.ts +++ /dev/null @@ -1 +0,0 @@ -export const skip_resume = true; diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/dom.expected/template.js deleted file mode 100644 index 1e8a9679bc..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/dom.expected/template.js +++ /dev/null @@ -1,7 +0,0 @@ -import { data as _data, contextClosure as _contextClosure, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _x = /* @__PURE__ */_contextClosure("x", "$", (_scope, x) => _data(_scope["#text/0"], x)); -export const template = "
"; -export const walks = /* next(2), get, out(2) */"E m"; -export const setup = function () {}; -export const closures = [_x]; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup, closures), "packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/html.expected/template.js deleted file mode 100644 index 096d9b5731..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,10 +0,0 @@ -import { write as _write, getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _write("
"); - const { - x - } = _getInContext("$"); - _write(`${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}
`); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr-sanitized.expected.md deleted file mode 100644 index 5027b2bac8..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr-sanitized.expected.md +++ /dev/null @@ -1,8 +0,0 @@ -# Render "End" -```html -
- - 1 - -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr.expected.md deleted file mode 100644 index 27f434d3ad..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr.expected.md +++ /dev/null @@ -1,29 +0,0 @@ -# Write -
1
- - -# Render "End" -```html - - - -
- - 1 - - -
- - -``` - -# Mutations -``` -inserted #document/html0 -inserted #document/html0/head0 -inserted #document/html0/body1 -inserted #document/html0/body1/div0 -inserted #document/html0/body1/div0/span0 -inserted #document/html0/body1/div0/span0/#text0 -inserted #document/html0/body1/div0/span0/#comment1 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko deleted file mode 100644 index 9f2a41713e..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko +++ /dev/null @@ -1,6 +0,0 @@ -
- - - ${x} - -
diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/test.ts deleted file mode 100644 index 4f5e8be1a6..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/test.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const skip_csr = true; -export const skip_resume = true; -export const context = { x: 1 }; diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/other.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/other.js deleted file mode 100644 index 4eae0fb1ea..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/other.js +++ /dev/null @@ -1,12 +0,0 @@ -import { write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _write(""); - const _dynamicScope = _dynamicTag(input.renderBody, null); - _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}`); - _writeScope(_scope0_id, { - "#text/0!": _dynamicScope, - "#text/0(": input.renderBody - }); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/template.js deleted file mode 100644 index 201e6d323e..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,14 +0,0 @@ -import Other from "./other.marko"; -import { write as _write, getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - Other({ - renderBody() { - const _scope1_id = _nextScopeId(); - _write(""); - const message = _getInContext("packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko"); - _write(`${_escapeXML(message)}${_markResumeNode(_scope1_id, "#text/0")}`); - } - }); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko deleted file mode 100644 index 37742e87a1..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko +++ /dev/null @@ -1,3 +0,0 @@ - - <${input.renderBody}/> - diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/template.marko deleted file mode 100644 index e0fc001dcd..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/template.marko +++ /dev/null @@ -1,8 +0,0 @@ -import Other from "./other.marko"; - -<${Other}> - - - ${message} - - diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/test.ts deleted file mode 100644 index 5acaa22338..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/test.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const skip_csr = true; -export const skip_ssr = true; -export const skip_dom = true; diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr-sanitized.expected.md deleted file mode 100644 index bedc2e3ae5..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr-sanitized.expected.md +++ /dev/null @@ -1,8 +0,0 @@ -# Render undefined -```html -
- - 1 - -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr.expected.md deleted file mode 100644 index c8e364e2b9..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr.expected.md +++ /dev/null @@ -1,13 +0,0 @@ -# Render undefined -```html -
- - 1 - -
-``` - -# Mutations -``` -inserted div0 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/dom.expected/template.js deleted file mode 100644 index 299f177cb3..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/dom.expected/template.js +++ /dev/null @@ -1,12 +0,0 @@ -import { initContextProvider as _initContextProvider, data as _data, contextClosure as _contextClosure, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _x$putBody = /* @__PURE__ */_contextClosure("x", "packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko", (_scope, x) => _data(_scope["#text/0"], x)); -const _putBody = /* @__PURE__ */_createRenderer(" ", /* next(1), get */"D ", void 0, [_x$putBody]); -const _put = /* @__PURE__ */_value("0:", null, _dynamicSubscribers("0:")); -const _setup = _scope => { - _initContextProvider(_scope, "#text/0", "0:", "packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko", _putBody); - _put(_scope, 1); -}; -export const template = "
"; -export const walks = /* next(1), replace, out(1) */"D%l"; -export const setup = _setup; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/html.expected/template.js deleted file mode 100644 index fe2fb836ff..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,13 +0,0 @@ -import { write as _write, pushContext as _pushContext, getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, nextScopeId as _nextScopeId, popContext as _popContext, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _write("
"); - _pushContext("packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko", 1); - const _scope1_id = _nextScopeId(); - _write(""); - const x = _getInContext("packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko"); - _write(`${_escapeXML(x)}${_markResumeNode(_scope1_id, "#text/0")}`); - _popContext(); - _write("
"); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr-sanitized.expected.md deleted file mode 100644 index 5027b2bac8..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr-sanitized.expected.md +++ /dev/null @@ -1,8 +0,0 @@ -# Render "End" -```html -
- - 1 - -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr.expected.md deleted file mode 100644 index e937b50187..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr.expected.md +++ /dev/null @@ -1,29 +0,0 @@ -# Write -
1
- - -# Render "End" -```html - - - -
- - 1 - - -
- - -``` - -# Mutations -``` -inserted #document/html0 -inserted #document/html0/head0 -inserted #document/html0/body1 -inserted #document/html0/body1/div0 -inserted #document/html0/body1/div0/span0 -inserted #document/html0/body1/div0/span0/#text0 -inserted #document/html0/body1/div0/span0/#comment1 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko deleted file mode 100644 index 23fe7fcb90..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko +++ /dev/null @@ -1,8 +0,0 @@ -
- - - - ${x} - - -
diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/test.ts deleted file mode 100644 index e5e0f90255..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/test.ts +++ /dev/null @@ -1 +0,0 @@ -export const skip_resume = true; diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr-sanitized.expected.md deleted file mode 100644 index f9e67783ad..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr-sanitized.expected.md +++ /dev/null @@ -1,6 +0,0 @@ -# Render undefined -```html - - Hello - -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr.expected.md deleted file mode 100644 index 363f7f3d56..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr.expected.md +++ /dev/null @@ -1,11 +0,0 @@ -# Render undefined -```html - - Hello - -``` - -# Mutations -``` -inserted #text0, span1 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/components/other.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/components/other.js deleted file mode 100644 index e6d23c725b..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/components/other.js +++ /dev/null @@ -1,16 +0,0 @@ -import { initContextProvider as _initContextProvider, conditional as _conditional, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _dynamicTagName$putBody = /* @__PURE__ */_conditional("#text/0"); -const _input$putBody = _registerSubscriber("packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko_1_input/subscriber", /* @__PURE__ */_dynamicClosure("input", (_scope, input) => _dynamicTagName$putBody(_scope, input.renderBody), void 0, void 0, _dynamicTagName$putBody)); -const _putBody = /* @__PURE__ */_createRenderer("", /* replace */"%", void 0, [_input$putBody]); -const _put = /* @__PURE__ */_value("0:", null, _dynamicSubscribers("0:")); -const _input = /* @__PURE__ */_value("input", null, _dynamicSubscribers("input")); -const _setup = _scope => { - _initContextProvider(_scope, "#text/0", "0:", "packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko", _putBody); - _put(_scope, "Hello"); -}; -export const attrs = _input; -export { _input }; -export const template = ""; -export const walks = /* replace, over(1) */"%b"; -export const setup = _setup; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup, void 0, void 0, void 0, void 0, void 0, attrs), "packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/template.js deleted file mode 100644 index db3fa31eb7..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/template.js +++ /dev/null @@ -1,14 +0,0 @@ -import { data as _data, bindRenderer as _bindRenderer, inChild as _inChild, contextClosure as _contextClosure, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -import { setup as _other, attrs as _other_attrs, template as _other_template, walks as _other_walks } from "./components/other.marko"; -const _message$otherBody = /* @__PURE__ */_contextClosure("message", "packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko", (_scope, message) => _data(_scope["#text/0"], message)); -const _otherBody = /* @__PURE__ */_createRenderer(" ", /* next(1), get */"D ", void 0, [_message$otherBody]); -const _setup = _scope => { - _other(_scope["#childScope/0"]); - _other_attrs(_scope["#childScope/0"], { - renderBody: /* @__PURE__ */_bindRenderer(_scope, _otherBody) - }); -}; -export const template = `${_other_template}`; -export const walks = /* beginChild, _other_walks, endChild */`/${_other_walks}&`; -export const setup = _setup; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/components/other.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/components/other.js deleted file mode 100644 index 2d636103ac..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/components/other.js +++ /dev/null @@ -1,14 +0,0 @@ -import { pushContext as _pushContext, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, popContext as _popContext, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _pushContext("packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko", "Hello"); - const _scope1_id = _nextScopeId(); - const _dynamicScope = _dynamicTag(input.renderBody, null); - _write(`${_markResumeControlEnd(_scope1_id, "#text/0")}`); - _writeScope(_scope1_id, { - "#text/0!": _dynamicScope, - "#text/0(": input.renderBody - }); - _popContext(); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/template.js deleted file mode 100644 index 1e743a2fb6..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,14 +0,0 @@ -import { write as _write, getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -import _other from "./components/other.marko"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _other._({ - renderBody() { - const _scope1_id = _nextScopeId(); - _write(""); - const message = _getInContext("packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko"); - _write(`${_escapeXML(message)}${_markResumeNode(_scope1_id, "#text/0")}`); - } - }); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr-sanitized.expected.md deleted file mode 100644 index a13f5bb7ef..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr-sanitized.expected.md +++ /dev/null @@ -1,6 +0,0 @@ -# Render "End" -```html - - Hello - -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr.expected.md deleted file mode 100644 index 7ad258f322..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr.expected.md +++ /dev/null @@ -1,35 +0,0 @@ -# Write - Hello - - -# Render "End" -```html - - - - - - Hello - - - - - - -``` - -# Mutations -``` -inserted #document/#comment0 -inserted #document/html1 -inserted #document/html1/head0 -inserted #document/html1/body1 -inserted #document/html1/body1/span0 -inserted #document/html1/body1/span0/#text0 -inserted #document/html1/body1/span0/#comment1 -inserted #document/html1/body1/#comment1 -inserted #document/html1/body1/script2 -inserted #document/html1/body1/script2/#text0 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko deleted file mode 100644 index 0b29968016..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko +++ /dev/null @@ -1,3 +0,0 @@ - - <${input.renderBody}/> - diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko deleted file mode 100644 index b8e2f562eb..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko +++ /dev/null @@ -1,6 +0,0 @@ - - - - ${message} - - diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/test.ts deleted file mode 100644 index e5e0f90255..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/test.ts +++ /dev/null @@ -1 +0,0 @@ -export const skip_resume = true; diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr-sanitized.expected.md deleted file mode 100644 index 98f1e74687..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr-sanitized.expected.md +++ /dev/null @@ -1,44 +0,0 @@ -# Render {} -```html -
- - 123 - - -
-``` - - -# Render -container.querySelector("#toggle")?.click() - -```html -
- -
-``` - - -# Render -container.querySelector("#toggle")?.click() - -```html -
- - 123 - - -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr.expected.md deleted file mode 100644 index 9b10ab3abd..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr.expected.md +++ /dev/null @@ -1,62 +0,0 @@ -# Render {} -```html -
- - 123 - - -
-``` - -# Mutations -``` -inserted div0 -``` - - -# Render -container.querySelector("#toggle")?.click() - -```html -
- -
-``` - -# Mutations -``` -inserted div0/#text1 -removed span after div0/#text1 -``` - - -# Render -container.querySelector("#toggle")?.click() - -```html -
- - 123 - - -
-``` - -# Mutations -``` -inserted div0/span1 -removed #text after div0/span1 -div0/span1/#text0: " " => "123" -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/dom.expected/template.js deleted file mode 100644 index 587f74842f..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/dom.expected/template.js +++ /dev/null @@ -1,23 +0,0 @@ -import { initContextProvider as _initContextProvider, data as _data, on as _on, queueSource as _queueSource, contextClosure as _contextClosure, createRenderer as _createRenderer, register as _register, conditional as _conditional, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, dynamicSubscribers as _dynamicSubscribers, value as _value, queueEffect as _queueEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _x$ifBody = /* @__PURE__ */_contextClosure("x", "packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko", (_scope, x) => _data(_scope["#text/0"], x)); -const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko_2_renderer", /* @__PURE__ */_createRenderer(" ", /* next(1), get */"D ", void 0, [_x$ifBody])); -const _if$putBody = /* @__PURE__ */_conditional("#text/0"); -const _show$putBody = _registerSubscriber("packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko_1_show/subscriber", /* @__PURE__ */_dynamicClosure("show", (_scope, show) => _if$putBody(_scope, show ? _ifBody : null), void 0, void 0, _if$putBody)); -const _putBody = /* @__PURE__ */_createRenderer("", /* replace */"%", void 0, [_show$putBody]); -const _put = /* @__PURE__ */_value("0:", null, _dynamicSubscribers("0:")); -const _show_effect = _register("packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko_0_show", _scope => _on(_scope["#button/1"], "click", function () { - const { - show - } = _scope; - _queueSource(_scope, _show, !show); -})); -const _show = /* @__PURE__ */_value("show", (_scope, show) => _queueEffect(_scope, _show_effect), _dynamicSubscribers("show")); -const _setup = _scope => { - _initContextProvider(_scope, "#text/0", "0:", "packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko", _putBody); - _show(_scope, true); - _put(_scope, 123); -}; -export const template = "
"; -export const walks = /* next(1), replace, over(1), get, out(1) */"D%b l"; -export const setup = _setup; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/html.expected/template.js deleted file mode 100644 index 30efae4cd0..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,32 +0,0 @@ -import { write as _write, pushContext as _pushContext, getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, popContext as _popContext, writeEffect as _writeEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - const show = true; - _write("
"); - _pushContext("packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko", 123); - const _scope1_id = _nextScopeId(); - let _ifScopeId, _scope2_, _ifRenderer; - if (show) { - const _scope2_id = _nextScopeId(); - _write(""); - const x = _getInContext("packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko"); - _write(`${_escapeXML(x)}${_markResumeNode(_scope2_id, "#text/0")}`); - _writeScope(_scope2_id, _scope2_ = { - "_": _serializedScope(_scope1_id) - }); - _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko_2_renderer"); - _ifScopeId = _scope2_id; - } - _write(`${_markResumeControlSingleNodeEnd(_scope1_id, "#text/0", _ifScopeId)}`); - _writeScope(_scope1_id, { - "#text/0!": _scope2_, - "#text/0(": _ifRenderer - }); - _popContext(); - _write(`${_markResumeNode(_scope0_id, "#button/1")}
`); - _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko_0_show"); - _writeScope(_scope0_id, { - "show": show - }); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr-sanitized.expected.md deleted file mode 100644 index c3501b679f..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr-sanitized.expected.md +++ /dev/null @@ -1,13 +0,0 @@ -# Render "End" -```html -
- - 123 - - -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr.expected.md deleted file mode 100644 index e1355bf4a0..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr.expected.md +++ /dev/null @@ -1,45 +0,0 @@ -# Write -
123
- - -# Render "End" -```html - - - -
- - 123 - - - - - -
- - - -``` - -# Mutations -``` -inserted #document/html0 -inserted #document/html0/head0 -inserted #document/html0/body1 -inserted #document/html0/body1/div0 -inserted #document/html0/body1/div0/span0 -inserted #document/html0/body1/div0/span0/#text0 -inserted #document/html0/body1/div0/span0/#comment1 -inserted #document/html0/body1/div0/#comment1 -inserted #document/html0/body1/div0/button2 -inserted #document/html0/body1/div0/button2/#text0 -inserted #document/html0/body1/div0/#comment3 -inserted #document/html0/body1/script1 -inserted #document/html0/body1/script1/#text0 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko deleted file mode 100644 index 5cc57184bf..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko +++ /dev/null @@ -1,12 +0,0 @@ -
- - - - - - ${x} - - - - -
diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/test.ts deleted file mode 100644 index 27c3580245..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/test.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const skip_resume = true; - -export const steps = [{}, toggle, toggle]; - -function toggle(container: Element) { - container.querySelector("#toggle")?.click(); -} diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr-sanitized.expected.md deleted file mode 100644 index 735db3f32f..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr-sanitized.expected.md +++ /dev/null @@ -1,26 +0,0 @@ -# Render {} -```html -
- 123 -
- -``` - - -# Render -container.querySelector("#increment")?.click() - -```html -
- 124 -
- -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md deleted file mode 100644 index 046d23bd39..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md +++ /dev/null @@ -1,37 +0,0 @@ -# Render {} -```html -
- 123 -
- -``` - -# Mutations -``` -inserted #text0, div1, button2 -``` - - -# Render -container.querySelector("#increment")?.click() - -```html -
- 124 -
- -``` - -# Mutations -``` -button2/#text0: "123" => "124" -div1/#text0: "123" => "124" -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/components/child.js deleted file mode 100644 index e1b8e7f5e4..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/components/child.js +++ /dev/null @@ -1,7 +0,0 @@ -import { data as _data, contextClosure as _contextClosure, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _x = /* @__PURE__ */_contextClosure("x", "packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko", (_scope, x) => _data(_scope["#text/0"], x)); -export const template = "
"; -export const walks = /* next(1), get, out(1) */"D l"; -export const setup = function () {}; -export const closures = [_x]; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup, closures), "packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/template.js deleted file mode 100644 index c58aee0b92..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/template.js +++ /dev/null @@ -1,26 +0,0 @@ -import { initContextProvider as _initContextProvider, childClosures as _childClosures, on as _on, queueSource as _queueSource, data as _data, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, register as _register, queueEffect as _queueEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -import { setup as _child, template as _child_template, walks as _child_walks, closures as _child_closures } from "./components/child.marko"; -const _setup$putBody = _scope => { - _child(_scope["#childScope/0"]); -}; -const _putBody = /* @__PURE__ */_createRenderer(`${_child_template}`, /* beginChild, _child_walks, endChild */`/${_child_walks}&`, _setup$putBody, [_childClosures(_child_closures, "#childScope/0")]); -const _put = /* @__PURE__ */_value("0:", null, _dynamicSubscribers("0:")); -const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko_0_x", _scope => _on(_scope["#button/1"], "click", function () { - const { - x - } = _scope; - _queueSource(_scope, _x, x + 1); -})); -const _x = /* @__PURE__ */_value("x", (_scope, x) => { - _data(_scope["#text/2"], x); - _queueEffect(_scope, _x_effect); - _put(_scope, x); -}, void 0, _put); -const _setup = _scope => { - _initContextProvider(_scope, "#text/0", "0:", "packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko", _putBody); - _x(_scope, 123); -}; -export const template = ""; -export const walks = /* replace, over(1), get, next(1), get, out(1) */"%b D l"; -export const setup = _setup; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/components/child.js deleted file mode 100644 index 81712b255a..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/components/child.js +++ /dev/null @@ -1,7 +0,0 @@ -import { getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - const x = _getInContext("packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko"); - _write(`
${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}
`); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/template.js deleted file mode 100644 index 426442f6b8..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,16 +0,0 @@ -import { pushContext as _pushContext, nextScopeId as _nextScopeId, popContext as _popContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, writeScope as _writeScope, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -import _child from "./components/child.marko"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - const x = 123; - _pushContext("packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko", x); - const _scope1_id = _nextScopeId(); - _child._({}); - _popContext(); - _write(`${_markResumeNode(_scope0_id, "#button/1")}`); - _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko_0_x"); - _writeScope(_scope0_id, { - "x": x - }); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr-sanitized.expected.md deleted file mode 100644 index 2ae32842cf..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr-sanitized.expected.md +++ /dev/null @@ -1,11 +0,0 @@ -# Render "End" -```html -
- 123 -
- -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr.expected.md deleted file mode 100644 index 91c74a300e..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr.expected.md +++ /dev/null @@ -1,42 +0,0 @@ -# Write -
123
- - -# Render "End" -```html - - - -
- 123 - -
- - - - - -``` - -# Mutations -``` -inserted #document/html0 -inserted #document/html0/head0 -inserted #document/html0/body1 -inserted #document/html0/body1/div0 -inserted #document/html0/body1/div0/#text0 -inserted #document/html0/body1/div0/#comment1 -inserted #document/html0/body1/button1 -inserted #document/html0/body1/button1/#text0 -inserted #document/html0/body1/button1/#comment1 -inserted #document/html0/body1/#comment2 -inserted #document/html0/body1/script3 -inserted #document/html0/body1/script3/#text0 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko deleted file mode 100644 index acff92d7a1..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko +++ /dev/null @@ -1,6 +0,0 @@ - - - -
- ${x} -
\ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko deleted file mode 100644 index 64c06e641d..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko +++ /dev/null @@ -1,5 +0,0 @@ - - - - -${x} \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/test.ts deleted file mode 100644 index 3d1a771280..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/test.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const skip_resume = true; - -export const steps = [{}, increment]; - -function increment(container: Element) { - container.querySelector("#increment")?.click(); -} diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr-sanitized.expected.md deleted file mode 100644 index 50de2124ac..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr-sanitized.expected.md +++ /dev/null @@ -1,6 +0,0 @@ -# Render undefined -```html -
- 123 -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md deleted file mode 100644 index 627ec78fea..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md +++ /dev/null @@ -1,11 +0,0 @@ -# Render undefined -```html -
- 123 -
-``` - -# Mutations -``` -inserted #text0, div1 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/components/child.js deleted file mode 100644 index 0d71fa1fe9..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/components/child.js +++ /dev/null @@ -1,7 +0,0 @@ -import { data as _data, contextClosure as _contextClosure, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _x = /* @__PURE__ */_contextClosure("x", "packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko", (_scope, x) => _data(_scope["#text/0"], x)); -export const template = "
"; -export const walks = /* next(1), get, out(1) */"D l"; -export const setup = function () {}; -export const closures = [_x]; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup, closures), "packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/template.js deleted file mode 100644 index a3d4122a30..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/template.js +++ /dev/null @@ -1,15 +0,0 @@ -import { initContextProvider as _initContextProvider, childClosures as _childClosures, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -import { setup as _child, template as _child_template, walks as _child_walks, closures as _child_closures } from "./components/child.marko"; -const _setup$putBody = _scope => { - _child(_scope["#childScope/0"]); -}; -const _putBody = /* @__PURE__ */_createRenderer(`${_child_template}`, /* beginChild, _child_walks, endChild */`/${_child_walks}&`, _setup$putBody, [_childClosures(_child_closures, "#childScope/0")]); -const _put = /* @__PURE__ */_value("0:", null, _dynamicSubscribers("0:")); -const _setup = _scope => { - _initContextProvider(_scope, "#text/0", "0:", "packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko", _putBody); - _put(_scope, 123); -}; -export const template = ""; -export const walks = /* replace, over(1) */"%b"; -export const setup = _setup; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/components/child.js deleted file mode 100644 index 0b6f831daa..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/components/child.js +++ /dev/null @@ -1,8 +0,0 @@ -import { write as _write, getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _write("
"); - const x = _getInContext("packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko"); - _write(`${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}
`); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/template.js deleted file mode 100644 index de8507f917..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/template.js +++ /dev/null @@ -1,10 +0,0 @@ -import { pushContext as _pushContext, nextScopeId as _nextScopeId, popContext as _popContext, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; -import _child from "./components/child.marko"; -const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { - const _scope0_id = _nextScopeId(); - _pushContext("packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko", 123); - const _scope1_id = _nextScopeId(); - _child._({}); - _popContext(); -}); -export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr-sanitized.expected.md deleted file mode 100644 index 1db568537f..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr-sanitized.expected.md +++ /dev/null @@ -1,6 +0,0 @@ -# Render "End" -```html -
- 123 -
-``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md deleted file mode 100644 index 64aec10948..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md +++ /dev/null @@ -1,26 +0,0 @@ -# Write -
123
- - -# Render "End" -```html - - - -
- 123 - -
- - -``` - -# Mutations -``` -inserted #document/html0 -inserted #document/html0/head0 -inserted #document/html0/body1 -inserted #document/html0/body1/div0 -inserted #document/html0/body1/div0/#text0 -inserted #document/html0/body1/div0/#comment1 -``` \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko deleted file mode 100644 index 37fead58ef..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko +++ /dev/null @@ -1,4 +0,0 @@ -
- - ${x} -
diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko deleted file mode 100644 index 2361170772..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/test.ts deleted file mode 100644 index e5e0f90255..0000000000 --- a/packages/translator-tags/src/__tests__/fixtures/context-tag-static/test.ts +++ /dev/null @@ -1 +0,0 @@ -export const skip_resume = true; diff --git a/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/dom.expected/template.js index 3cf37c8a4b..c17e821a0c 100644 --- a/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/dom.expected/template.js +++ b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/dom.expected/template.js @@ -1,7 +1,8 @@ -import { data as _data, contextClosure as _contextClosure, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; -const _$global2 = /* @__PURE__ */_contextClosure("_$global", "$", (_scope, _$global) => _data(_scope["#text/0"], _$global.x)); +import { $_streamData as _$_streamData, data as _data, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup = _scope => { + _data(_scope["#text/0"], _$_streamData.global.x); +}; export const template = "
"; export const walks = /* next(2), get, out(2) */"E m"; -export const setup = function () {}; -export const closures = [_$global2]; -export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup, closures), "packages/translator-tags/src/__tests__/fixtures/migrate-out-global/template.marko"); \ No newline at end of file +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/migrate-out-global/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/html.expected/template.js index 81aae8b3a6..d9453edc59 100644 --- a/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/html.expected/template.js +++ b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/html.expected/template.js @@ -1,7 +1,6 @@ -import { getInContext as _getInContext, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import { $_streamData as _$_streamData, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { const _scope0_id = _nextScopeId(); - const _$global = _getInContext("$"); - _write(`
${_escapeXML(_$global.x)}${_markResumeNode(_scope0_id, "#text/0")}
`); + _write(`
${_escapeXML(_$_streamData.global.x)}${_markResumeNode(_scope0_id, "#text/0")}
`); }); export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/migrate-out-global/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/main.test.ts b/packages/translator-tags/src/__tests__/main.test.ts index 41e123c11a..91e59fe699 100644 --- a/packages/translator-tags/src/__tests__/main.test.ts +++ b/packages/translator-tags/src/__tests__/main.test.ts @@ -8,6 +8,7 @@ import reorderRuntime from "@marko/runtime-tags/src/html/reorder-runtime"; import type { DOMWindow } from "jsdom"; import snap from "mocha-snap"; import glob from "tiny-glob"; +import * as translator from ".."; import createBrowser from "./utils/create-browser"; import { isWait } from "./utils/resolve"; import createMutationTracker from "./utils/track-mutations"; @@ -39,7 +40,7 @@ type Result = { }; const baseConfig: compiler.Config = { - translator: require.resolve(".."), + translator, babelConfig: { babelrc: false, configFile: false, diff --git a/packages/translator-tags/src/core/get.ts b/packages/translator-tags/src/core/get.ts deleted file mode 100644 index c13d6b46aa..0000000000 --- a/packages/translator-tags/src/core/get.ts +++ /dev/null @@ -1,180 +0,0 @@ -import path from "path"; -import { - type Tag, - assertNoParams, - getTemplateId, - resolveTagImport, -} from "@marko/babel-utils"; -import { types as t } from "@marko/compiler"; -import { assertNoBodyContent } from "../util/assert"; -import { isOutputHTML } from "../util/marko-config"; -import { callRuntime } from "../util/runtime"; -import { getOrCreateSection } from "../util/sections"; -import { initContextConsumer } from "../util/signals"; -import * as writer from "../util/writer"; -import { currentProgramPath } from "../visitors/program"; -import customTag from "../visitors/tag/custom-tag"; - -declare module "@marko/compiler/dist/types" { - export interface ProgramExtra { - closures?: boolean; - contextProviders?: string[]; - } -} - -export default { - analyze: { - enter(tag) { - const section = getOrCreateSection(tag); - if (section.id === 0) { - (currentProgramPath.node.extra ??= {}).closures = true; - } - - // TODO: resolve default parameter and push to (currentProgramPath.node.extra ??= {}).contextProviders - - customTag.analyze.enter(tag); - - // const { - // node, - // hub: { file }, - // } = tag; - // if (file.markoOpts.output !== 'html') { - // const [defaultAttr] = node.attributes; - - // if (defaultAttr === undefined) { - // const scriptlet = t.markoScriptlet([ - // t.variableDeclaration("const", [ - // t.variableDeclarator( - // node.var!, - // callRuntime("getInContext", t.stringLiteral('$')) - // ), - // ]) - // ],false); - - // tag.replaceWith(scriptlet); - // } - // } - }, - exit: customTag.analyze.exit, - }, - translate(tag) { - assertNoParams(tag); - assertNoBodyContent(tag); - - if (isOutputHTML()) { - writer.flushBefore(tag); - } - - const { - node, - hub: { file }, - } = tag; - const [defaultAttr] = node.attributes; - let refId: string; - - if (!node.var) { - throw tag - .get("name") - .buildCodeFrameError( - " requires a variable to be defined, eg .", - ); - } - - if (defaultAttr === undefined) { - refId = "$"; - } else { - if ( - !t.isMarkoAttribute(defaultAttr) || - !defaultAttr.default || - !t.isStringLiteral(defaultAttr.value) - ) { - throw tag - .get("name") - .buildCodeFrameError( - `The '' tag requires default attribute that is a string that resolves to a Marko file like '' or ''.`, - ); - } - - if (node.attributes.length > 1) { - const start = node.attributes[1].loc?.start; - const end = node.attributes[node.attributes.length - 1].loc?.end; - const msg = `The '' tag only supports a default attribute.`; - - if (start == null || end == null) { - throw tag.get("name").buildCodeFrameError(msg); - } else { - throw tag.hub.buildError( - { loc: { start, end } } as unknown as t.Node, - msg, - Error, - ); - } - } - - const defaultAttrValue = tag - .get("attributes")[0] - .get("value") as t.NodePath; - - if (defaultAttr.value.value === ".") { - // Self referencing ``. - refId = file.metadata.marko.id; - } else { - const relativeReferencePath = resolveTagImport( - defaultAttrValue, - defaultAttrValue.node.value, - ); - - if (!relativeReferencePath) { - throw defaultAttrValue.buildCodeFrameError( - "Unable to resolve template provided to '' tag.", - ); - } - - refId = getTemplateId( - file.markoOpts.optimize, - path.resolve( - file.opts.filename as string, - "..", - relativeReferencePath, - ), - ); - } - } - - if (isOutputHTML()) { - tag.replaceWith( - t.variableDeclaration("const", [ - t.variableDeclarator( - node.var, - callRuntime("getInContext", t.stringLiteral(refId)), - ), - ]), - ); - } else { - const identifiers = Object.values( - tag.get("var").getBindingIdentifiers(), - ) as t.Identifier[]; - - // if (refId === '$') { - // const scriptlet = tag as unknown as t.NodePath; - // addStatement( - // "render", - // getSection(scriptlet), - // scriptlet.node.extra?.bodyReferences as ReferenceGroup, - // scriptlet.node.body - // ); - // } else { - initContextConsumer(refId, identifiers[0].extra!.reserve!); - // } - tag.remove(); - } - }, - autocomplete: [ - { - displayText: 'get/=""', - description: "Gets a value provided from another template.", - snippet: 'get/${1:name}="${2:from}"', - descriptionMoreURL: "https://markojs.com/docs/core-tags/#get", - }, - ], -} as Tag; diff --git a/packages/translator-tags/src/core/index.ts b/packages/translator-tags/src/core/index.ts index 150d733f75..d3ae0e4925 100644 --- a/packages/translator-tags/src/core/index.ts +++ b/packages/translator-tags/src/core/index.ts @@ -8,14 +8,12 @@ import ConstTag from "./const"; import EffectTag from "./effect"; import ExportTag from "./export"; import ForTag from "./for"; -import GetTag from "./get"; import HTMLCommentTag from "./html-comment"; import IdTag from "./id"; import ImportTag from "./import"; import LetTag from "./let"; import LifecycleTag from "./lifecycle"; import NoopTag from "./noop"; -import PutTag from "./put"; import ReturnTag from "./return"; import StaticTag from "./static"; import StyleTag from "./style"; @@ -37,8 +35,6 @@ export default { "": IdTag, "": HTMLCommentTag, "": TagTag, - "": PutTag, - "": GetTag, "": ReturnTag, "