diff --git a/.c8rc.json b/.c8rc.json index 314ffe67b7..fdd2689930 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -10,7 +10,7 @@ ], "exclude": [ "**/__tests__", - "packages/runtime/src/html/reorder-runtime.ts", + "packages/runtime-tags/src/html/reorder-runtime.ts", "**/*.d.ts" ] } diff --git a/.sizes.json b/.sizes.json index 6bddf859b1..065817a2d1 100644 --- a/.sizes.json +++ b/.sizes.json @@ -1,7 +1,7 @@ { "examples": { - "counter": "./packages/translator/src/__tests__/fixtures/basic-counter/template.marko", - "comments": "./packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/template.marko" + "counter": "./packages/translator-tags/src/__tests__/fixtures/basic-counter/template.marko", + "comments": "./packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/template.marko" }, "results": [ { @@ -16,8 +16,8 @@ "name": "counter", "user": { "min": 351, - "gzip": 279, - "brotli": 242 + "gzip": 277, + "brotli": 239 }, "runtime": { "min": 3965, @@ -26,8 +26,8 @@ }, "total": { "min": 4316, - "gzip": 2141, - "brotli": 1909 + "gzip": 2139, + "brotli": 1906 } }, { @@ -53,7 +53,7 @@ "user": { "min": 1216, "gzip": 704, - "brotli": 636 + "brotli": 640 }, "runtime": { "min": 7393, @@ -63,15 +63,15 @@ "total": { "min": 8609, "gzip": 4127, - "brotli": 3739 + "brotli": 3743 } }, { "name": "comments 💧", "user": { "min": 988, - "gzip": 589, - "brotli": 572 + "gzip": 585, + "brotli": 542 }, "runtime": { "min": 7914, @@ -80,8 +80,8 @@ }, "total": { "min": 8902, - "gzip": 4249, - "brotli": 3902 + "gzip": 4245, + "brotli": 3872 } } ] diff --git a/package-lock.json b/package-lock.json index 0190f3329b..cbcb418ed8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -83,9 +83,9 @@ } }, "node_modules/@asamuzakjp/dom-selector": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-2.0.1.tgz", - "integrity": "sha512-QJAJffmCiymkv6YyQ7voyQb5caCth6jzZsQncYCpHXrJ7RqdYG5y43+is8mnFcYubdOkr7cn1+na9BdFMxqw7w==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-2.0.2.tgz", + "integrity": "sha512-x1KXOatwofR6ZAYzXRBL5wrdV0vwNxlTCK9NCuLqAzQYARqGcvFwiJA6A1ERuh+dgeA4Dxm3JBYictIes+SqUQ==", "dev": true, "dependencies": { "bidi-js": "^1.0.3", @@ -2764,13 +2764,13 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -2813,9 +2813,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@istanbuljs/schema": { @@ -2884,9 +2884,9 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "version": "0.3.21", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", + "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -2974,22 +2974,22 @@ "resolved": "packages/compiler", "link": true }, - "node_modules/@marko/runtime-fluurt": { - "resolved": "packages/runtime", + "node_modules/@marko/runtime-tags": { + "resolved": "packages/runtime-tags", "link": true }, "node_modules/@marko/translator-default": { "resolved": "packages/translator-default", "link": true }, - "node_modules/@marko/translator-fluurt": { - "resolved": "packages/translator", - "link": true - }, "node_modules/@marko/translator-interop-class-tags": { "resolved": "packages/translator-interop", "link": true }, + "node_modules/@marko/translator-tags": { + "resolved": "packages/translator-tags", + "link": true + }, "node_modules/@nicolo-ribaudo/chokidar-2": { "version": "2.1.8-no-fsevents.3", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", @@ -3072,9 +3072,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.4.tgz", - "integrity": "sha512-ub/SN3yWqIv5CWiAZPHVS1DloyZsJbtXmX4HxUTIpS0BHm9pW5iYBo2mIZi+hE3AeiTzHz33blwSnhdUo+9NpA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.5.tgz", + "integrity": "sha512-idWaG8xeSRCfRq9KpRysDHJ/rEHBEXcHuJ82XY0yYFIWnLMjZv9vF/7DOq8djQ2n3Lk6+3qfSH8AqlmHlmi1MA==", "cpu": [ "arm" ], @@ -3085,9 +3085,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.4.tgz", - "integrity": "sha512-ehcBrOR5XTl0W0t2WxfTyHCR/3Cq2jfb+I4W+Ch8Y9b5G+vbAecVv0Fx/J1QKktOrgUYsIKxWAKgIpvw56IFNA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.5.tgz", + "integrity": "sha512-f14d7uhAMtsCGjAYwZGv6TwuS3IFaM4ZnGMUn3aCBgkcHAYErhV1Ad97WzBvS2o0aaDv4mVz+syiN0ElMyfBPg==", "cpu": [ "arm64" ], @@ -3098,9 +3098,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.4.tgz", - "integrity": "sha512-1fzh1lWExwSTWy8vJPnNbNM02WZDS8AW3McEOb7wW+nPChLKf3WG2aG7fhaUmfX5FKw9zhsF5+MBwArGyNM7NA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.5.tgz", + "integrity": "sha512-ndoXeLx455FffL68OIUrVr89Xu1WLzAG4n65R8roDlCoYiQcGGg6MALvs2Ap9zs7AHg8mpHtMpwC8jBBjZrT/w==", "cpu": [ "arm64" ], @@ -3111,9 +3111,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.4.tgz", - "integrity": "sha512-Gc6cukkF38RcYQ6uPdiXi70JB0f29CwcQ7+r4QpfNpQFVHXRd0DfWFidoGxjSx1DwOETM97JPz1RXL5ISSB0pA==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.5.tgz", + "integrity": "sha512-UmElV1OY2m/1KEEqTlIjieKfVwRg0Zwg4PLgNf0s3glAHXBN99KLpw5A5lrSYCa1Kp63czTpVll2MAqbZYIHoA==", "cpu": [ "x64" ], @@ -3124,9 +3124,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.4.tgz", - "integrity": "sha512-g21RTeFzoTl8GxosHbnQZ0/JkuFIB13C3T7Y0HtKzOXmoHhewLbVTFBQZu+z5m9STH6FZ7L/oPgU4Nm5ErN2fw==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.5.tgz", + "integrity": "sha512-Q0LcU61v92tQB6ae+udZvOyZ0wfpGojtAKrrpAaIqmJ7+psq4cMIhT/9lfV6UQIpeItnq/2QDROhNLo00lOD1g==", "cpu": [ "arm" ], @@ -3137,9 +3137,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.4.tgz", - "integrity": "sha512-TVYVWD/SYwWzGGnbfTkrNpdE4HON46orgMNHCivlXmlsSGQOx/OHHYiQcMIOx38/GWgwr/po2LBn7wypkWw/Mg==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.5.tgz", + "integrity": "sha512-dkRscpM+RrR2Ee3eOQmRWFjmV/payHEOrjyq1VZegRUa5OrZJ2MAxBNs05bZuY0YCtpqETDy1Ix4i/hRqX98cA==", "cpu": [ "arm64" ], @@ -3150,9 +3150,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.4.tgz", - "integrity": "sha512-XcKvuendwizYYhFxpvQ3xVpzje2HHImzg33wL9zvxtj77HvPStbSGI9czrdbfrf8DGMcNNReH9pVZv8qejAQ5A==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.5.tgz", + "integrity": "sha512-QaKFVOzzST2xzY4MAmiDmURagWLFh+zZtttuEnuNn19AiZ0T3fhPyjPPGwLNdiDT82ZE91hnfJsUiDwF9DClIQ==", "cpu": [ "arm64" ], @@ -3163,9 +3163,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.4.tgz", - "integrity": "sha512-LFHS/8Q+I9YA0yVETyjonMJ3UA+DczeBd/MqNEzsGSTdNvSJa1OJZcSH8GiXLvcizgp9AlHs2walqRcqzjOi3A==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.5.tgz", + "integrity": "sha512-HeGqmRJuyVg6/X6MpE2ur7GbymBPS8Np0S/vQFHDmocfORT+Zt76qu+69NUoxXzGqVP1pzaY6QIi0FJWLC3OPA==", "cpu": [ "riscv64" ], @@ -3176,9 +3176,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.4.tgz", - "integrity": "sha512-dIYgo+j1+yfy81i0YVU5KnQrIJZE8ERomx17ReU4GREjGtDW4X+nvkBak2xAUpyqLs4eleDSj3RrV72fQos7zw==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.5.tgz", + "integrity": "sha512-Dq1bqBdLaZ1Gb/l2e5/+o3B18+8TI9ANlA1SkejZqDgdU/jK/ThYaMPMJpVMMXy2uRHvGKbkz9vheVGdq3cJfA==", "cpu": [ "x64" ], @@ -3189,9 +3189,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.4.tgz", - "integrity": "sha512-RoaYxjdHQ5TPjaPrLsfKqR3pakMr3JGqZ+jZM0zP2IkDtsGa4CqYaWSfQmZVgFUCgLrTnzX+cnHS3nfl+kB6ZQ==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.5.tgz", + "integrity": "sha512-ezyFUOwldYpj7AbkwyW9AJ203peub81CaAIVvckdkyH8EvhEIoKzaMFJj0G4qYJ5sw3BpqhFrsCc30t54HV8vg==", "cpu": [ "x64" ], @@ -3202,9 +3202,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.4.tgz", - "integrity": "sha512-T8Q3XHV+Jjf5e49B4EAaLKV74BbX7/qYBRQ8Wop/+TyyU0k+vSjiLVSHNWdVd1goMjZcbhDmYZUYW5RFqkBNHQ==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.5.tgz", + "integrity": "sha512-aHSsMnUw+0UETB0Hlv7B/ZHOGY5bQdwMKJSzGfDfvyhnpmVxLMGnQPGNE9wgqkLUs3+gbG1Qx02S2LLfJ5GaRQ==", "cpu": [ "arm64" ], @@ -3215,9 +3215,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.4.tgz", - "integrity": "sha512-z+JQ7JirDUHAsMecVydnBPWLwJjbppU+7LZjffGf+Jvrxq+dVjIE7By163Sc9DKc3ADSU50qPVw0KonBS+a+HQ==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.5.tgz", + "integrity": "sha512-AiqiLkb9KSf7Lj/o1U3SEP9Zn+5NuVKgFdRIZkvd4N0+bYrTOovVd0+LmYCPQGbocT4kvFyK+LXCDiXPBF3fyA==", "cpu": [ "ia32" ], @@ -3228,9 +3228,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.4.tgz", - "integrity": "sha512-LfdGXCV9rdEify1oxlN9eamvDSjv9md9ZVMAbNHA87xqIfFCxImxan9qZ8+Un54iK2nnqPlbnSi4R54ONtbWBw==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.5.tgz", + "integrity": "sha512-1q+mykKE3Vot1kaFJIDoUFv5TuW+QQVaf2FmTT9krg86pQrGStOSJJ0Zil7CFagyxDuouTepzt5Y5TVzyajOdQ==", "cpu": [ "x64" ], @@ -3310,9 +3310,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.10.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz", - "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==", + "version": "20.11.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.4.tgz", + "integrity": "sha512-6I0fMH8Aoy2lOejL3s4LhyIYX34DPwY8bl5xlNjBvUEk8OHrcuzsFt+Ied4LvJihbtXPM+8zUqdydfIti86v9g==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3337,16 +3337,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.1.tgz", - "integrity": "sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.0.tgz", + "integrity": "sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.18.1", - "@typescript-eslint/type-utils": "6.18.1", - "@typescript-eslint/utils": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/type-utils": "6.19.0", + "@typescript-eslint/utils": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -3405,15 +3405,15 @@ "dev": true }, "node_modules/@typescript-eslint/parser": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.18.1.tgz", - "integrity": "sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.0.tgz", + "integrity": "sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.18.1", - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/typescript-estree": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/typescript-estree": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", "debug": "^4.3.4" }, "engines": { @@ -3433,13 +3433,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.1.tgz", - "integrity": "sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz", + "integrity": "sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1" + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3450,13 +3450,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.1.tgz", - "integrity": "sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.0.tgz", + "integrity": "sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.18.1", - "@typescript-eslint/utils": "6.18.1", + "@typescript-eslint/typescript-estree": "6.19.0", + "@typescript-eslint/utils": "6.19.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -3477,9 +3477,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.1.tgz", - "integrity": "sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.0.tgz", + "integrity": "sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3490,13 +3490,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.1.tgz", - "integrity": "sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz", + "integrity": "sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/visitor-keys": "6.18.1", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3551,17 +3551,17 @@ "dev": true }, "node_modules/@typescript-eslint/utils": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", - "integrity": "sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.0.tgz", + "integrity": "sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.18.1", - "@typescript-eslint/types": "6.18.1", - "@typescript-eslint/typescript-estree": "6.18.1", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/typescript-estree": "6.19.0", "semver": "^7.5.4" }, "engines": { @@ -3609,12 +3609,12 @@ "dev": true }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.1.tgz", - "integrity": "sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz", + "integrity": "sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.1", + "@typescript-eslint/types": "6.19.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -4167,9 +4167,9 @@ } }, "node_modules/c8": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-9.0.0.tgz", - "integrity": "sha512-nFJhU2Cz6Frh2awk3IW7wwk3wx27/U2v8ojQCHGc1GWTCHS6aMu4lal327/ZnnYj7oSThGF1X3qUP1yzAJBcOQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/c8/-/c8-9.1.0.tgz", + "integrity": "sha512-mBWcT5iqNir1zIkzSPyI3NCR9EZCVI3WUD+AVO17MVWTSFNyUueXE82qTeampNtTr+ilN/5Ua3j24LgbCKjDVg==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", @@ -4302,9 +4302,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001576", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", - "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", + "version": "1.0.30001577", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001577.tgz", + "integrity": "sha512-rs2ZygrG1PNXMfmncM0B5H1hndY5ZCC9b5TkFaVNfZ+AUlyqcMyVIQtc3fsezi0NUCk5XZfDf9WS6WxMxnfdrg==", "funding": [ { "type": "opencollective", @@ -4321,9 +4321,9 @@ ] }, "node_modules/chai": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.0.tgz", - "integrity": "sha512-x9cHNq1uvkCdU+5xTkNh5WtgD4e4yDFCsp9jVc7N7qVeKeftv3gO/ZrviX5d+3ZfxdYnZXZYujjRInu1RogU6A==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", @@ -5107,9 +5107,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.625", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.625.tgz", - "integrity": "sha512-DENMhh3MFgaPDoXWrVIqSPInQoLImywfCwrSmVl3cf9QHzoZSiutHwGaB/Ql3VkqcQV30rzgdM+BjKqBAJxo5Q==" + "version": "1.4.633", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.633.tgz", + "integrity": "sha512-7BvxzXrHFliyQ1oZc6NRMjyEaKOO1Ma1NY98sFZofogWlm+klLWSgrDw7EhatiMgi4R4NV+iWxDdxuIKXtPbOw==" }, "node_modules/emoji-regex": { "version": "10.3.0", @@ -9263,9 +9263,9 @@ } }, "node_modules/prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.2.tgz", + "integrity": "sha512-HTByuKZzw7utPiDO523Tt2pLtEyK7OibUD9suEJQrPUCYQqrHr74GGX6VidMrovbf/I50mPqr8j/II6oBAuc5A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -9780,9 +9780,9 @@ } }, "node_modules/rollup": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.4.tgz", - "integrity": "sha512-2ztU7pY/lrQyXSCnnoU4ICjT/tCG9cdH3/G25ERqE3Lst6vl2BCM5hL2Nw+sslAvAf+ccKsAq1SkKQALyqhR7g==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.5.tgz", + "integrity": "sha512-E4vQW0H/mbNMw2yLSqJyjtkHY9dslf/p0zuT1xehNRqUTBOFMqEjguDvqhXr7N7r/4ttb2jr4T41d3dncmIgbQ==", "dev": true, "dependencies": { "@types/estree": "1.0.5" @@ -9795,19 +9795,19 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.9.4", - "@rollup/rollup-android-arm64": "4.9.4", - "@rollup/rollup-darwin-arm64": "4.9.4", - "@rollup/rollup-darwin-x64": "4.9.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.9.4", - "@rollup/rollup-linux-arm64-gnu": "4.9.4", - "@rollup/rollup-linux-arm64-musl": "4.9.4", - "@rollup/rollup-linux-riscv64-gnu": "4.9.4", - "@rollup/rollup-linux-x64-gnu": "4.9.4", - "@rollup/rollup-linux-x64-musl": "4.9.4", - "@rollup/rollup-win32-arm64-msvc": "4.9.4", - "@rollup/rollup-win32-ia32-msvc": "4.9.4", - "@rollup/rollup-win32-x64-msvc": "4.9.4", + "@rollup/rollup-android-arm-eabi": "4.9.5", + "@rollup/rollup-android-arm64": "4.9.5", + "@rollup/rollup-darwin-arm64": "4.9.5", + "@rollup/rollup-darwin-x64": "4.9.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.9.5", + "@rollup/rollup-linux-arm64-gnu": "4.9.5", + "@rollup/rollup-linux-arm64-musl": "4.9.5", + "@rollup/rollup-linux-riscv64-gnu": "4.9.5", + "@rollup/rollup-linux-x64-gnu": "4.9.5", + "@rollup/rollup-linux-x64-musl": "4.9.5", + "@rollup/rollup-win32-arm64-msvc": "4.9.5", + "@rollup/rollup-win32-ia32-msvc": "4.9.5", + "@rollup/rollup-win32-x64-msvc": "4.9.5", "fsevents": "~2.3.2" } }, @@ -9841,13 +9841,13 @@ } }, "node_modules/safe-array-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", - "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", + "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, @@ -9879,9 +9879,9 @@ ] }, "node_modules/safe-regex-test": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.1.tgz", - "integrity": "sha512-Y5NejJTTliTyY4H7sipGqY+RX5P87i3F7c4Rcepy72nq+mNLhIsD0W4c7kEmduMDQCSqtPsXPlSTsFhh2LQv+g==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", + "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", "dev": true, "dependencies": { "call-bind": "^1.0.5", @@ -10005,15 +10005,16 @@ "dev": true }, "node_modules/set-function-length": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", - "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", + "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", "dev": true, "dependencies": { "define-data-property": "^1.1.1", - "get-intrinsic": "^1.2.1", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.2", "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" + "has-property-descriptors": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -11983,23 +11984,11 @@ "version": "3.2.0", "license": "Apache-2.0" }, - "packages/runtime": { - "name": "@marko/runtime-fluurt", + "packages/runtime-tags": { + "name": "@marko/runtime-tags", "version": "0.0.1", "license": "MIT" }, - "packages/translator": { - "name": "@marko/translator-fluurt", - "version": "0.0.1", - "license": "MIT", - "dependencies": { - "@marko/babel-utils": "^6.2.1", - "@marko/runtime-fluurt": "^0.0.1" - }, - "peerDependencies": { - "@marko/compiler": "^5.23.0" - } - }, "packages/translator-default": { "name": "@marko/translator-default", "version": "5.31.11", @@ -12027,7 +12016,7 @@ "@babel/code-frame": "7.22.5", "@marko/babel-utils": "^5.21.3", "@marko/translator-default": "^5.26.4", - "@marko/translator-fluurt": "^0.0.1", + "@marko/translator-tags": "^0.0.1", "tslib": "^2.3.1" }, "peerDependencies": { @@ -12063,6 +12052,18 @@ "node": ">=6" } }, + "packages/translator-tags": { + "name": "@marko/translator-tags", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "@marko/babel-utils": "^6.2.1", + "@marko/runtime-tags": "^0.0.1" + }, + "peerDependencies": { + "@marko/compiler": "^5.23.0" + } + }, "scripts/babel-register.js": { "dev": true } diff --git a/packages/marko/src/runtime/helpers/tags-compat-dom.js b/packages/marko/src/runtime/helpers/tags-compat-dom.js index 3c76e4f576..fd5f48c6dc 100644 --- a/packages/marko/src/runtime/helpers/tags-compat-dom.js +++ b/packages/marko/src/runtime/helpers/tags-compat-dom.js @@ -9,7 +9,7 @@ const { queueEffect, scopeLookup, register, -} = require("@marko/runtime-fluurt/dist/debug/dom"); // TODO: use the non-debug version when built for production +} = require("@marko/runtime-tags/dist/debug/dom"); // TODO: use the non-debug version when built for production const { ___componentLookup } = require("@internal/components-util"); const defineComponent = require("../components/defineComponent"); const { r: registerComponent } = require("../components/registry"); diff --git a/packages/marko/src/runtime/helpers/tags-compat-html.js b/packages/marko/src/runtime/helpers/tags-compat-html.js index b10d1cc379..4c93bbd439 100644 --- a/packages/marko/src/runtime/helpers/tags-compat-html.js +++ b/packages/marko/src/runtime/helpers/tags-compat-html.js @@ -1,7 +1,7 @@ import initComponentsTag from "../../core-tags/components/init-components-tag"; import { ___getComponentsContext } from "../components/ComponentsContext"; -const tagsAPI = require("@marko/runtime-fluurt/dist/debug/html"); // TODO: use the non-debug version when built for production +const tagsAPI = require("@marko/runtime-tags/dist/debug/html"); // TODO: use the non-debug version when built for production const w10NOOP = require("warp10/constants").NOOP; const createRenderer = require("../components/renderer"); const defaultCreateOut = require("../createOut"); diff --git a/packages/runtime-tags/package.json b/packages/runtime-tags/package.json new file mode 100644 index 0000000000..fd75eecb4e --- /dev/null +++ b/packages/runtime-tags/package.json @@ -0,0 +1,26 @@ +{ + "name": "@marko/runtime-tags", + "version": "0.0.1", + "private": true, + "description": "Optimized runtime for Marko templates.", + "keywords": [ + "tags", + "marko", + "runtime" + ], + "homepage": "https://github.com/marko-js/marko/blob/master/packages/runtime-tags/README.md", + "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md", + "repository": { + "type": "git", + "url": "https://github.com/marko-js/marko/tree/master/packages/runtime-tags" + }, + "license": "MIT", + "files": [ + "dist", + "!**/meta.*.json", + "!**/*.tsbuildinfo" + ], + "scripts": { + "build": "node -r ~ts ./scripts/bundle.ts" + } +} diff --git a/packages/runtime/scripts/bundle.ts b/packages/runtime-tags/scripts/bundle.ts similarity index 100% rename from packages/runtime/scripts/bundle.ts rename to packages/runtime-tags/scripts/bundle.ts diff --git a/packages/runtime/src/__tests__/serializer.test.ts b/packages/runtime-tags/src/__tests__/serializer.test.ts similarity index 100% rename from packages/runtime/src/__tests__/serializer.test.ts rename to packages/runtime-tags/src/__tests__/serializer.test.ts diff --git a/packages/runtime/src/common/context.ts b/packages/runtime-tags/src/common/context.ts similarity index 100% rename from packages/runtime/src/common/context.ts rename to packages/runtime-tags/src/common/context.ts diff --git a/packages/runtime/src/common/helpers.ts b/packages/runtime-tags/src/common/helpers.ts similarity index 100% rename from packages/runtime/src/common/helpers.ts rename to packages/runtime-tags/src/common/helpers.ts diff --git a/packages/runtime/src/common/types.ts b/packages/runtime-tags/src/common/types.ts similarity index 100% rename from packages/runtime/src/common/types.ts rename to packages/runtime-tags/src/common/types.ts diff --git a/packages/runtime/src/dom/control-flow.ts b/packages/runtime-tags/src/dom/control-flow.ts similarity index 100% rename from packages/runtime/src/dom/control-flow.ts rename to packages/runtime-tags/src/dom/control-flow.ts diff --git a/packages/runtime/src/dom/dom.ts b/packages/runtime-tags/src/dom/dom.ts similarity index 100% rename from packages/runtime/src/dom/dom.ts rename to packages/runtime-tags/src/dom/dom.ts diff --git a/packages/runtime/src/dom/event.ts b/packages/runtime-tags/src/dom/event.ts similarity index 100% rename from packages/runtime/src/dom/event.ts rename to packages/runtime-tags/src/dom/event.ts diff --git a/packages/runtime/src/dom/fragment.ts b/packages/runtime-tags/src/dom/fragment.ts similarity index 100% rename from packages/runtime/src/dom/fragment.ts rename to packages/runtime-tags/src/dom/fragment.ts diff --git a/packages/runtime/src/dom/index.ts b/packages/runtime-tags/src/dom/index.ts similarity index 100% rename from packages/runtime/src/dom/index.ts rename to packages/runtime-tags/src/dom/index.ts diff --git a/packages/runtime/src/dom/queue.ts b/packages/runtime-tags/src/dom/queue.ts similarity index 100% rename from packages/runtime/src/dom/queue.ts rename to packages/runtime-tags/src/dom/queue.ts diff --git a/packages/runtime/src/dom/reconcile-domdiff.ts b/packages/runtime-tags/src/dom/reconcile-domdiff.ts similarity index 100% rename from packages/runtime/src/dom/reconcile-domdiff.ts rename to packages/runtime-tags/src/dom/reconcile-domdiff.ts diff --git a/packages/runtime/src/dom/reconcile-listdiff.ts b/packages/runtime-tags/src/dom/reconcile-listdiff.ts similarity index 100% rename from packages/runtime/src/dom/reconcile-listdiff.ts rename to packages/runtime-tags/src/dom/reconcile-listdiff.ts diff --git a/packages/runtime/src/dom/reconcile-longest-increasing-subsequence.ts b/packages/runtime-tags/src/dom/reconcile-longest-increasing-subsequence.ts similarity index 100% rename from packages/runtime/src/dom/reconcile-longest-increasing-subsequence.ts rename to packages/runtime-tags/src/dom/reconcile-longest-increasing-subsequence.ts diff --git a/packages/runtime/src/dom/reconcile.ts b/packages/runtime-tags/src/dom/reconcile.ts similarity index 100% rename from packages/runtime/src/dom/reconcile.ts rename to packages/runtime-tags/src/dom/reconcile.ts diff --git a/packages/runtime/src/dom/renderer.ts b/packages/runtime-tags/src/dom/renderer.ts similarity index 100% rename from packages/runtime/src/dom/renderer.ts rename to packages/runtime-tags/src/dom/renderer.ts diff --git a/packages/runtime/src/dom/resume.ts b/packages/runtime-tags/src/dom/resume.ts similarity index 100% rename from packages/runtime/src/dom/resume.ts rename to packages/runtime-tags/src/dom/resume.ts diff --git a/packages/runtime/src/dom/schedule.ts b/packages/runtime-tags/src/dom/schedule.ts similarity index 100% rename from packages/runtime/src/dom/schedule.ts rename to packages/runtime-tags/src/dom/schedule.ts diff --git a/packages/runtime/src/dom/scope.ts b/packages/runtime-tags/src/dom/scope.ts similarity index 100% rename from packages/runtime/src/dom/scope.ts rename to packages/runtime-tags/src/dom/scope.ts diff --git a/packages/runtime/src/dom/signals.ts b/packages/runtime-tags/src/dom/signals.ts similarity index 100% rename from packages/runtime/src/dom/signals.ts rename to packages/runtime-tags/src/dom/signals.ts diff --git a/packages/runtime/src/dom/template.ts b/packages/runtime-tags/src/dom/template.ts similarity index 100% rename from packages/runtime/src/dom/template.ts rename to packages/runtime-tags/src/dom/template.ts diff --git a/packages/runtime/src/dom/walker.ts b/packages/runtime-tags/src/dom/walker.ts similarity index 100% rename from packages/runtime/src/dom/walker.ts rename to packages/runtime-tags/src/dom/walker.ts diff --git a/packages/runtime/src/html/attrs.ts b/packages/runtime-tags/src/html/attrs.ts similarity index 100% rename from packages/runtime/src/html/attrs.ts rename to packages/runtime-tags/src/html/attrs.ts diff --git a/packages/runtime/src/html/content.ts b/packages/runtime-tags/src/html/content.ts similarity index 100% rename from packages/runtime/src/html/content.ts rename to packages/runtime-tags/src/html/content.ts diff --git a/packages/runtime/src/html/dynamic-tag.ts b/packages/runtime-tags/src/html/dynamic-tag.ts similarity index 100% rename from packages/runtime/src/html/dynamic-tag.ts rename to packages/runtime-tags/src/html/dynamic-tag.ts diff --git a/packages/runtime/src/html/index.ts b/packages/runtime-tags/src/html/index.ts similarity index 100% rename from packages/runtime/src/html/index.ts rename to packages/runtime-tags/src/html/index.ts diff --git a/packages/runtime/src/html/reorder-runtime.ts b/packages/runtime-tags/src/html/reorder-runtime.ts similarity index 100% rename from packages/runtime/src/html/reorder-runtime.ts rename to packages/runtime-tags/src/html/reorder-runtime.ts diff --git a/packages/runtime/src/html/serializer.ts b/packages/runtime-tags/src/html/serializer.ts similarity index 100% rename from packages/runtime/src/html/serializer.ts rename to packages/runtime-tags/src/html/serializer.ts diff --git a/packages/runtime/src/html/template.ts b/packages/runtime-tags/src/html/template.ts similarity index 100% rename from packages/runtime/src/html/template.ts rename to packages/runtime-tags/src/html/template.ts diff --git a/packages/runtime/src/html/writer.ts b/packages/runtime-tags/src/html/writer.ts similarity index 100% rename from packages/runtime/src/html/writer.ts rename to packages/runtime-tags/src/html/writer.ts diff --git a/packages/runtime/src/types.d.ts b/packages/runtime-tags/src/types.d.ts similarity index 100% rename from packages/runtime/src/types.d.ts rename to packages/runtime-tags/src/types.d.ts diff --git a/packages/runtime/tsconfig.json b/packages/runtime-tags/tsconfig.json similarity index 100% rename from packages/runtime/tsconfig.json rename to packages/runtime-tags/tsconfig.json diff --git a/packages/runtime/package.json b/packages/runtime/package.json deleted file mode 100644 index a0ed3b45cd..0000000000 --- a/packages/runtime/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "@marko/runtime-fluurt", - "version": "0.0.1", - "private": true, - "description": "Optimized runtime for Marko templates.", - "keywords": [ - "fluurt", - "marko", - "runtime" - ], - "homepage": "https://github.com/marko-js/x", - "bugs": "https://github.com/marko-js/x/issues", - "repository": { - "type": "git", - "url": "https://github.com/marko-js/x" - }, - "license": "MIT", - "files": [ - "dist", - "!**/meta.*.json", - "!**/*.tsbuildinfo" - ], - "scripts": { - "build": "node -r ~ts ./scripts/bundle.ts" - } -} diff --git a/packages/translator-interop/package.json b/packages/translator-interop/package.json index 37217ac0f3..b8a1b413ba 100644 --- a/packages/translator-interop/package.json +++ b/packages/translator-interop/package.json @@ -2,21 +2,21 @@ "name": "@marko/translator-interop-class-tags", "version": "0.0.1", "private": true, - "description": "Combines the ClassComponent translator from Marko 5 and the TagsAPI translator from Marko 6", + "description": "Combines the Class API translator from Marko 5 and the Tags API translator from Marko 6", "keywords": [ "babel", - "fluurt", + "tags", "htmljs", "marko", "parse", "parser", "plugin" ], - "homepage": "https://github.com/marko-js/x/blob/master/packages/translator-interop/README.md", - "bugs": "https://github.com/marko-js/x/issues/new?template=Bug_report.md", + "homepage": "https://github.com/marko-js/marko/blob/master/packages/translator-interop/README.md", + "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md", "repository": { "type": "git", - "url": "https://github.com/marko-js/x/tree/master/packages/translator-interop" + "url": "https://github.com/marko-js/marko/tree/master/packages/translator-interop" }, "license": "MIT", "main": "dist/index.cjs.js", @@ -34,7 +34,7 @@ "@babel/code-frame": "7.22.5", "@marko/babel-utils": "^5.21.3", "@marko/translator-default": "^5.26.4", - "@marko/translator-fluurt": "^0.0.1", + "@marko/translator-tags": "^0.0.1", "tslib": "^2.3.1" }, "peerDependencies": { diff --git a/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/dom.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/dom.expected/template.js index 0f1b369fcb..f80bcd3baf 100644 --- a/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/dom.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/dom.expected/template.js @@ -1,5 +1,5 @@ export const template = "

Hello world

"; export const walks = /* over(1) */"b"; export const setup = function () {}; -import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-interop/src/__tests__/fixtures/explicit/template.marko"); \ No newline at end of file diff --git a/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/html.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/html.expected/template.js index 39d581f48f..941f523fd5 100644 --- a/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/html.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/explicit/__snapshots__/html.expected/template.js @@ -1,4 +1,4 @@ -import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { const _scope0_id = _nextScopeId(); _write("

Hello world

"); diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/dom.expected/components/tags-counter.js b/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/dom.expected/components/tags-counter.js index fd961cda45..31f3fb35fe 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/dom.expected/components/tags-counter.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/dom.expected/components/tags-counter.js @@ -1,4 +1,4 @@ -import { attr as _attr, on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { attr as _attr, on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; const _count_effect = _register("packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/components/tags-counter.marko_0_count", _scope => _on(_scope["#button/0"], "click", function () { const { count diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/html.expected/components/tags-counter.js b/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/html.expected/components/tags-counter.js index 6245aeaa36..724c4c87e5 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/html.expected/components/tags-counter.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-basic-class-to-tags/__snapshots__/html.expected/components/tags-counter.js @@ -1,4 +1,4 @@ -import { attr as _attr, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { attr as _attr, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { const _scope0_id = _nextScopeId(); const count = 0; diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/dom.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/dom.expected/template.js index 06b5f74a58..bb0ff315aa 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/dom.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/dom.expected/template.js @@ -1,4 +1,4 @@ -import { on as _on, queueSource as _queueSource, data as _data, register as _register, dynamicTagAttrs as _dynamicTagAttrs, intersection as _intersection, conditional as _conditional, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { on as _on, queueSource as _queueSource, data as _data, register as _register, dynamicTagAttrs as _dynamicTagAttrs, intersection as _intersection, conditional as _conditional, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; import _classCounter from "./components/class-counter.marko"; import _marko_tags_compat from "marko/src/runtime/helpers/tags-compat-dom.js"; _register("packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/components/class-counter.marko", _classCounter); diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/html.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/html.expected/template.js index aed7039415..aee80b414d 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/html.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-basic-tags-to-class/__snapshots__/html.expected/template.js @@ -1,4 +1,4 @@ -import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; import _classCounter from "./components/class-counter.marko"; import _marko_tags_compat, { serialized5to6 as _serialized5to } from "marko/src/runtime/helpers/tags-compat-html.js"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js b/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js index f0e1e1818b..bd61812f3d 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js @@ -1,4 +1,4 @@ -import { on as _on, queueSource as _queueSource, data as _data, conditional as _conditional, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { on as _on, queueSource as _queueSource, data as _data, conditional as _conditional, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; const _dynamicTagName = /* @__PURE__ */_conditional("#text/2"); const _count_effect = _register("packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/components/tags-layout.marko_0_count", _scope => _on(_scope["#button/0"], "click", function () { const { diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/html.expected/components/tags-layout.js b/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/html.expected/components/tags-layout.js index aff5c98b03..5e64343db8 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/html.expected/components/tags-layout.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-nested-class-to-tags/__snapshots__/html.expected/components/tags-layout.js @@ -1,4 +1,4 @@ -import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { const _scope0_id = _nextScopeId(); const count = 0; diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/dom.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/dom.expected/template.js index f7a36098ea..fca2a8f47c 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/dom.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/dom.expected/template.js @@ -1,4 +1,4 @@ -import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; import _classLayout from "./components/class-layout.marko"; import _marko_tags_compat from "marko/src/runtime/helpers/tags-compat-dom.js"; _register("packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/components/class-layout.marko", _classLayout); diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/html.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/html.expected/template.js index fc9e9954d2..84474f1d58 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/html.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-nested-tags-to-class/__snapshots__/html.expected/template.js @@ -1,4 +1,4 @@ -import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; import _classLayout from "./components/class-layout.marko"; import _marko_tags_compat, { serialized5to6 as _serialized5to } from "marko/src/runtime/helpers/tags-compat-html.js"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js index 2642e000c0..b8ef5600e2 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/dom.expected/components/tags-layout.js @@ -1,4 +1,4 @@ -import { on as _on, queueSource as _queueSource, data as _data, dynamicTagAttrs as _dynamicTagAttrs, intersection as _intersection, conditional as _conditional, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { on as _on, queueSource as _queueSource, data as _data, dynamicTagAttrs as _dynamicTagAttrs, intersection as _intersection, conditional as _conditional, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; const _inputRenderBody_input = _dynamicTagAttrs("#text/2"); const _expr_dynamicTagName_count = /* @__PURE__ */_intersection(2, _scope => { const { diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/html.expected/components/tags-layout.js b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/html.expected/components/tags-layout.js index 14d64771f4..c80aa63e53 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/html.expected/components/tags-layout.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-class-to-tags/__snapshots__/html.expected/components/tags-layout.js @@ -1,4 +1,4 @@ -import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { const _scope0_id = _nextScopeId(); const count = 0; diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/dom.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/dom.expected/template.js index 1dfdd5cfb0..7b5bfe2bcb 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/dom.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/dom.expected/template.js @@ -1,4 +1,4 @@ -import { data as _data, on as _on, queueSource as _queueSource, register as _register, intersection as _intersection, value as _value, queueEffect as _queueEffect, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, dynamicSubscribers as _dynamicSubscribers, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { data as _data, on as _on, queueSource as _queueSource, register as _register, intersection as _intersection, value as _value, queueEffect as _queueEffect, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, dynamicSubscribers as _dynamicSubscribers, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; import _classLayout from "./components/class-layout.marko"; import _marko_tags_compat from "marko/src/runtime/helpers/tags-compat-dom.js"; _register("packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/components/class-layout.marko", _classLayout); diff --git a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/html.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/html.expected/template.js index f1b459e405..102c0cb6ae 100644 --- a/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/html.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/interop-tag-params-tags-to-class/__snapshots__/html.expected/template.js @@ -1,4 +1,4 @@ -import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; import _classLayout from "./components/class-layout.marko"; import _marko_tags_compat, { serialized5to6 as _serialized5to } from "marko/src/runtime/helpers/tags-compat-html.js"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { diff --git a/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/dom.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/dom.expected/template.js index 3f46c0d75b..2922a1af05 100644 --- a/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/dom.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/dom.expected/template.js @@ -1,4 +1,4 @@ -import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/dom"; +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/dom"; const _count_effect = _register("packages/translator-interop/src/__tests__/fixtures/let/template.marko_0_count", _scope => _on(_scope["#button/0"], "click", function () { const { count diff --git a/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/html.expected/template.js b/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/html.expected/template.js index b029fa755a..4d5d56f039 100644 --- a/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/html.expected/template.js +++ b/packages/translator-interop/src/__tests__/fixtures/let/__snapshots__/html.expected/template.js @@ -1,4 +1,4 @@ -import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-fluurt/dist/debug/html"; +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/dist/debug/html"; const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { const _scope0_id = _nextScopeId(); const count = 0; diff --git a/packages/translator-interop/src/__tests__/main.test.ts b/packages/translator-interop/src/__tests__/main.test.ts index 1b33995eaf..d765c6ceec 100644 --- a/packages/translator-interop/src/__tests__/main.test.ts +++ b/packages/translator-interop/src/__tests__/main.test.ts @@ -2,13 +2,13 @@ import fs from "fs"; import path from "path"; import * as compiler from "@marko/compiler"; import register from "@marko/compiler/register"; -import reorderRuntime from "@marko/runtime-fluurt/src/html/reorder-runtime"; +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 createBrowser from "../../../translator/src/__tests__/utils/create-browser"; -import { isWait } from "../../../translator/src/__tests__/utils/resolve"; -import createMutationTracker from "../../../translator/src/__tests__/utils/track-mutations"; +import createBrowser from "../../../translator-tags/src/__tests__/utils/create-browser"; +import { isWait } from "../../../translator-tags/src/__tests__/utils/resolve"; +import createMutationTracker from "../../../translator-tags/src/__tests__/utils/track-mutations"; const runtimeId = "X"; const reorderRuntimeString = String(reorderRuntime).replace( @@ -51,7 +51,7 @@ type TestConfig = { describe("translator-interop", () => { before(() => { uncachePackage("@marko/translator-default"); - uncachePackage("@marko/translator-fluurt"); + uncachePackage("@marko/translator-tags"); register({ ...htmlConfig, modules: "cjs" }); }); @@ -229,8 +229,8 @@ describe("translator-interop", () => { } const { run } = browser.require( - "@marko/runtime-fluurt/dist/debug/dom", - ) as typeof import("../../../runtime/src/dom"); + "@marko/runtime-tags/dist/debug/dom", + ) as typeof import("../../../runtime-tags/src/dom"); const { ___componentLookup } = browser.require( "marko/src/node_modules/@internal/components-util/index-browser", ); @@ -276,8 +276,8 @@ describe("translator-interop", () => { : config.steps || []; const { run, init } = browser.require( - "@marko/runtime-fluurt/dist/debug/dom", - ) as typeof import("@marko/runtime-fluurt/src/dom"); + "@marko/runtime-tags/dist/debug/dom", + ) as typeof import("@marko/runtime-tags/src/dom"); browser.require(templateFile); browser.require("marko/src/runtime/components"); diff --git a/packages/translator-interop/src/feature-detection.ts b/packages/translator-interop/src/feature-detection.ts index 0d772b7261..09f12d4f78 100644 --- a/packages/translator-interop/src/feature-detection.ts +++ b/packages/translator-interop/src/feature-detection.ts @@ -1,7 +1,7 @@ import { getTagDef, isDynamicTag } from "@marko/babel-utils"; import type { types as t } from "@marko/compiler"; import { taglibs as taglibs5 } from "@marko/translator-default"; -import { taglibs as taglibs6 } from "@marko/translator-fluurt"; +import { taglibs as taglibs6 } from "@marko/translator-tags"; import { buildAggregateError } from "./build-aggregate-error"; const enum FEATURE_TYPE { diff --git a/packages/translator-interop/src/index.ts b/packages/translator-interop/src/index.ts index 868cc84c3c..67be59f696 100644 --- a/packages/translator-interop/src/index.ts +++ b/packages/translator-interop/src/index.ts @@ -9,7 +9,7 @@ import { analyze as analyze6, taglibs as taglibs6, translate as translate6, -} from "@marko/translator-fluurt"; +} from "@marko/translator-tags"; import { isTagsAPI } from "./feature-detection"; type TagDef = Record; diff --git a/packages/translator-tags/package.json b/packages/translator-tags/package.json new file mode 100644 index 0000000000..ec64e2452e --- /dev/null +++ b/packages/translator-tags/package.json @@ -0,0 +1,45 @@ +{ + "name": "@marko/translator-tags", + "version": "0.0.1", + "private": true, + "description": "Translates Marko templates to the experimental fast, lean, unified, update & render target.", + "keywords": [ + "babel", + "htmljs", + "marko", + "parse", + "parser", + "plugin", + "tags" + ], + "homepage": "https://github.com/marko-js/marko/blob/master/packages/translator-tags/README.md", + "bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md", + "repository": { + "type": "git", + "url": "https://github.com/marko-js/marko/tree/master/packages/translator-tags" + }, + "license": "MIT", + "exports": { + ".": { + "import": "./dist/index.mjs", + "default": "./dist/index.js" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "files": [ + "dist", + "!**/*.tsbuildinfo" + ], + "scripts": { + "build": "node -r ~ts ./scripts/bundle.ts" + }, + "dependencies": { + "@marko/babel-utils": "^6.2.1", + "@marko/runtime-tags": "^0.0.1" + }, + "peerDependencies": { + "@marko/compiler": "^5.23.0" + } +} diff --git a/packages/translator/scripts/bundle.ts b/packages/translator-tags/scripts/bundle.ts similarity index 94% rename from packages/translator/scripts/bundle.ts rename to packages/translator-tags/scripts/bundle.ts index 17cdba477e..7c70ff754d 100644 --- a/packages/translator/scripts/bundle.ts +++ b/packages/translator-tags/scripts/bundle.ts @@ -11,7 +11,7 @@ const external = new Set([ ...Object.keys(pkg.peerDependencies || {}), ]); -external.delete("@marko/runtime-fluurt"); +external.delete("@marko/runtime-tags"); Promise.all( (["esm", "cjs"] as const).map((format) => diff --git a/packages/translator/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/server.ts b/packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/server.ts new file mode 100644 index 0000000000..599435df2f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/server.ts @@ -0,0 +1,27 @@ +import { createTemplate, fork, write } from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + fork(resolveAfter("b", 1), (result1) => { + write(result1); + fork(resolveAfter("c", 1), (result2) => { + write(result2); + fork(resolveAfter("d", 1), write); + write("e"); + }); + write("f"); + }); + write("g"); + fork(resolveAfter("h", 1), (result7) => { + write(result7); + fork(resolveAfter("i", 1), (result8) => { + write(result8); + fork(resolveAfter("j", 1), write); + write("k"); + }); + write("l"); + }); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/async-nested-resolve-in-order/test.ts b/packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-nested-resolve-in-order/test.ts rename to packages/translator-tags/src/__tests__/fixtures/async-nested-resolve-in-order/test.ts diff --git a/packages/translator/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/server.ts b/packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/server.ts new file mode 100644 index 0000000000..6ca302bd65 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/server.ts @@ -0,0 +1,12 @@ +import { createTemplate, fork, write } from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + fork(resolveAfter("b", 1), write); + write("c"); + fork(resolveAfter("d", 2), write); + write("e"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/async-resolve-in-order/test.ts b/packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-resolve-in-order/test.ts rename to packages/translator-tags/src/__tests__/fixtures/async-resolve-in-order/test.ts diff --git a/packages/translator/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/server.ts b/packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/server.ts new file mode 100644 index 0000000000..c93523912c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/server.ts @@ -0,0 +1,12 @@ +import { createTemplate, fork, write } from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + fork(resolveAfter("b", 2), write); + write("c"); + fork(resolveAfter("d", 1), write); + write("e"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/async-resolve-out-of-order/test.ts b/packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/async-resolve-out-of-order/test.ts rename to packages/translator-tags/src/__tests__/fixtures/async-resolve-out-of-order/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/__snapshots__/html.expected/components/custom-tag/index.js b/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/__snapshots__/html.expected/components/custom-tag/index.js new file mode 100644 index 0000000000..d553082efb --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/__snapshots__/html.expected/components/custom-tag/index.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/components/custom-tag/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..63532241d5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,33 @@ +import { write as _write, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _customTag from "./components/custom-tag/index.marko"; +const _renderer = /* @__PURE__ */_createRenderer(({ + x +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + let _thing; + const _scope1_id = _nextScopeId(); + let _ifScopeId, _scope2_, _ifRenderer; + if (x) { + const _scope2_id = _nextScopeId(); + _thing = { + x: 1, + renderBody() { + _write("Hello"); + } + }; + _writeScope(_scope2_id, _scope2_ = { + "_": _serializedScope(_scope1_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/template.marko_2_renderer"); + _ifScopeId = _scope2_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope1_id, "#text/0", _ifScopeId)}`); + _writeScope(_scope1_id, { + "#text/0!": _scope2_, + "#text/0(": _ifRenderer + }); + _customTag._({ + thing: _thing + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/at-tag-inside-if-tag/components/custom-tag/index.marko b/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/components/custom-tag/index.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tag-inside-if-tag/components/custom-tag/index.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/components/custom-tag/index.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tag-inside-if-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tag-inside-if-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tag-inside-if-tag/test.ts b/packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tag-inside-if-tag/test.ts rename to packages/translator-tags/src/__tests__/fixtures/at-tag-inside-if-tag/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/__snapshots__/html.expected/components/hello/index.js b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/__snapshots__/html.expected/components/hello/index.js new file mode 100644 index 0000000000..82a473febb --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/__snapshots__/html.expected/components/hello/index.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..b49b8e22e3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/__snapshots__/html.expected/template.js @@ -0,0 +1,20 @@ +import { nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _hello from "./components/hello/index.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const _item = []; + const _scope1_id = _nextScopeId(); + for (const a in { + a: 1, + b: 2 + }) { + const _scope2_id = _nextScopeId(); + _item.push({}); + _maybeFlush(); + } + _hello._({ + item: _item, + other: {} + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/index.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/index.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/index.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/index.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/marko-tag.json b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/marko-tag.json similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/marko-tag.json rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/components/hello/marko-tag.json diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/template.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/template.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/template.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/test.ts b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-and-static/test.ts rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-and-static/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..e1f6d68cd9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/__snapshots__/html.expected/template.js @@ -0,0 +1,29 @@ +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeScope as _writeScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + x +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + const _dynamicScope = _dynamicTag(x, { + header: { + class: "my-header", + renderBody() { + _write("Header content"); + } + }, + footer: { + class: "my-footer", + renderBody() { + _write("Footer content"); + } + } + }, /* @__PURE__ */_createRenderer(() => { + const _scope1_id = _nextScopeId(); + _write("Body content"); + })); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}`); + _writeScope(_scope0_id, { + "#text/0!": _dynamicScope, + "#text/0(": x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-tag-parent/template.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-tag-parent/template.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/template.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-tag-parent/test.ts b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-tag-parent/test.ts rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-tag-parent/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/__snapshots__/html.expected/components/hello/index.js b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/__snapshots__/html.expected/components/hello/index.js new file mode 100644 index 0000000000..0e5825ec3f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/__snapshots__/html.expected/components/hello/index.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..54a5ac46d8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/__snapshots__/html.expected/template.js @@ -0,0 +1,34 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _hello from "./components/hello/index.marko"; +const _renderer = /* @__PURE__ */_createRenderer(({ + x +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + let _item; + const _scope1_id = _nextScopeId(); + let _ifScopeId, _scope2_, _ifRenderer; + if (x) { + const _scope2_id = _nextScopeId(); + _item = { + renderBody({ + value: [y] + }) { + _write(`${_escapeXML(y)}${_markResumeNode(_scope3_id, "#text/0")}`); + } + }; + _writeScope(_scope2_id, _scope2_ = { + "_": _serializedScope(_scope1_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/template.marko_2_renderer"); + _ifScopeId = _scope2_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope1_id, "#text/0", _ifScopeId)}`); + _writeScope(_scope1_id, { + "#text/0!": _scope2_, + "#text/0(": _ifRenderer + }); + _hello._({ + item: _item + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/index.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/index.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/index.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/index.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/marko-tag.json b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/marko-tag.json similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/marko-tag.json rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/components/hello/marko-tag.json diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/template.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/template.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/template.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/test.ts b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic-with-params/test.ts rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic-with-params/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/__snapshots__/html.expected/components/hello/index.js b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/__snapshots__/html.expected/components/hello/index.js new file mode 100644 index 0000000000..f91eb3d790 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/__snapshots__/html.expected/components/hello/index.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/components/hello/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..94a0514d6c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/__snapshots__/html.expected/template.js @@ -0,0 +1,86 @@ +import { write as _write, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, maybeFlush as _maybeFlush, escapeXML as _escapeXML, markResumeNode as _markResumeNode, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _hello from "./components/hello/index.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const _col = []; + const _scope1_id = _nextScopeId(); + const _item = []; + for (const color of ["red", "blue", "green"]) { + const _scope3_id = _nextScopeId(); + let _ifScopeId, _scope4_, _ifRenderer; + if (color === "red") { + const _scope4_id = _nextScopeId(); + _item.push({ + style: { + color + }, + renderBody() { + _write("foo"); + } + }); + _writeScope(_scope4_id, _scope4_ = { + "_": _serializedScope(_scope3_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/template.marko_4_renderer"); + _ifScopeId = _scope4_id; + } else { + const _scope5_id = _nextScopeId(); + _item.push({ + style: { + color + }, + renderBody() { + _write("bar"); + } + }); + _writeScope(_scope5_id, _scope4_ = { + "_": _serializedScope(_scope3_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/template.marko_5_renderer"); + _ifScopeId = _scope5_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope3_id, "#text/0", _ifScopeId)}`); + _writeScope(_scope3_id, { + "#text/0!": _scope4_, + "#text/0(": _ifRenderer + }); + _maybeFlush(); + } + let _i = 0; + for (const col of [["a", "b"], ["c", "d"]]) { + const _scope8_id = _nextScopeId(); + let i = _i++; + const _row = []; + for (const row of col) { + const _scope10_id = _nextScopeId(); + _row.push({ + row: row, + renderBody() { + _write(`${_escapeXML(row)}${_markResumeNode(_scope11_id, "#text/0")}`); + } + }); + _maybeFlush(); + } + _col.push({ + x: i, + row: _row + }); + _maybeFlush(); + } + _col.push({ + outside: true, + row: { + row: -1, + renderBody() { + _write("Outside"); + } + } + }); + _hello._({ + list: { + item: _item + }, + col: _col + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic/components/hello/index.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/components/hello/index.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic/components/hello/index.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/components/hello/index.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic/components/hello/marko-tag.json b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/components/hello/marko-tag.json similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic/components/hello/marko-tag.json rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/components/hello/marko-tag.json diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic/template.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic/template.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/template.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags-dynamic/test.ts b/packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags-dynamic/test.ts rename to packages/translator-tags/src/__tests__/fixtures/at-tags-dynamic/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags/__snapshots__/html.expected/components/hello/index.js b/packages/translator-tags/src/__tests__/fixtures/at-tags/__snapshots__/html.expected/components/hello/index.js new file mode 100644 index 0000000000..2fbf0586fc --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags/__snapshots__/html.expected/components/hello/index.js @@ -0,0 +1,3 @@ +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => {}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags/components/hello/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/at-tags/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/at-tags/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..9ce4f80ef5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/at-tags/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _hello from "./components/hello/index.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + _hello._({ + foo: { + renderBody() { + _write("Foo!"); + } + } + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/at-tags/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/at-tags/components/hello/index.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags/components/hello/index.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags/components/hello/index.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags/components/hello/index.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags/template.marko b/packages/translator-tags/src/__tests__/fixtures/at-tags/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags/template.marko rename to packages/translator-tags/src/__tests__/fixtures/at-tags/template.marko diff --git a/packages/translator/src/__tests__/fixtures/at-tags/test.ts b/packages/translator-tags/src/__tests__/fixtures/at-tags/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/at-tags/test.ts rename to packages/translator-tags/src/__tests__/fixtures/at-tags/test.ts diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..c6f66a0ce0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/dom.expected/template.js @@ -0,0 +1,19 @@ +import { attr as _attr, on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _disabled_effect = _register("packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/template.marko_0_disabled", _scope => _on(_scope["#button/1"], "click", function () { + const { + disabled + } = _scope; + _queueSource(_scope, _disabled, !disabled); +})); +const _disabled = /* @__PURE__ */_value("disabled", (_scope, disabled) => { + _attr(_scope["#input/0"], "disabled", disabled); + _data(_scope["#text/2"], disabled ? "enable" : "disable"); + _queueEffect(_scope, _disabled_effect); +}); +const _setup = _scope => { + _disabled(_scope, true); +}; +export const template = ""; +export const walks = /* get, 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/attr-boolean-dynamic/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..d3df9d6a4d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { attr as _attr, markResumeNode as _markResumeNode, escapeXML as _escapeXML, write as _write, writeEffect as _writeEffect, 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(); + const disabled = true; + _write(`${_markResumeNode(_scope0_id, "#input/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/template.marko_0_disabled"); + _writeScope(_scope0_id, { + "disabled": disabled + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..92eba6c846 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/resume.expected.md @@ -0,0 +1,111 @@ +# Render {} +```html + + + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/input0: attr(disabled) "" => null +#document/html0/body1/button2/#text0: "enable" => "disable" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/input0: attr(disabled) null => "" +#document/html0/body1/button2/#text0: "disable" => "enable" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/input0: attr(disabled) "" => null +#document/html0/body1/button2/#text0: "enable" => "disable" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..f7f14158ce --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/__snapshots__/ssr.expected.md @@ -0,0 +1,39 @@ +# Write + + + +# Render "End" +```html + + + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/input0 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/button2 +inserted #document/html0/body1/button2/#text0 +inserted #document/html0/body1/button2/#comment1 +inserted #document/html0/body1/#comment3 +inserted #document/html0/body1/script4 +inserted #document/html0/body1/script4/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/template.marko b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/template.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/template.marko diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/test.ts b/packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean-dynamic/test.ts rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean-dynamic/test.ts diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..227b0e6aa4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = ""; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/attr-boolean/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..c79e2af56d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write(""); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-boolean/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-boolean/template.marko b/packages/translator-tags/src/__tests__/fixtures/attr-boolean/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-boolean/template.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-boolean/template.marko diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/dom.expected/components/custom-tag.js b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/dom.expected/components/custom-tag.js new file mode 100644 index 0000000000..fcc96c39ee --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/dom.expected/components/custom-tag.js @@ -0,0 +1,5 @@ +export const template = "
"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/attr-class/components/custom-tag.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..350072b9fe --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/dom.expected/template.js @@ -0,0 +1,72 @@ +import { classAttr as _classAttr, write as _write, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, intersection as _intersection, conditional as _conditional, intersections as _intersections, value as _value, values as _values, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _customTag, template as _customTag_template, walks as _customTag_walks } from "./components/custom-tag.marko"; +const _testBody = /* @__PURE__ */_createRenderer("", ""); +const _inputTestBody = /* @__PURE__ */_createRenderer("", ""); +const _inputTest_input = _dynamicTagAttrs("#text/3", _inputTestBody); +const _expr_dynamicTagName_c_d = /* @__PURE__ */_intersection(3, _scope => { + const { + "#text/3": dynamicTagName, + c, + d + } = _scope; + _inputTest_input(_scope, () => ({ + class: ["a", { + b: c, + d + }], + test: { + class: ["a", { + b: c, + d + }], + renderBody() { + _write("Hello"); + } + } + })); +}); +const _expr_c_d = /* @__PURE__ */_intersection(2, _scope => { + const { + c, + d + } = _scope; + _classAttr(_scope["#div/0"], ["a", { + b: c, + d + }]); +}); +const _dynamicTagName = /* @__PURE__ */_conditional("#text/3", null, _expr_dynamicTagName_c_d); +const _d = /* @__PURE__ */_value("d", null, _intersections([_expr_c_d, _expr_dynamicTagName_c_d])); +const _c = /* @__PURE__ */_value("c", null, _intersections([_expr_c_d, _expr_dynamicTagName_c_d])); +const _destructure2 = (_scope, _destructure, _clean) => { + let c, d; + if (!_clean) ({ + c, + d + } = _destructure); + _c(_scope, c, _clean); + _d(_scope, d, _clean); +}; +const _destructure3 = (_scope, _destructure, _clean) => { + let c, d; + if (!_clean) ({ + c, + d + } = _destructure); + _c(_scope, c, _clean); + _d(_scope, d, _clean); +}; +const _input = /* @__PURE__ */_value("input", (_scope, input) => { + _destructure2(_scope, input); + _dynamicTagName(_scope, input.test || _inputTestBody); +}, void 0, _values([_destructure3, _dynamicTagName])); +const _setup = _scope => { + _customTag(_scope["#childScope/1"]); + _customTag(_scope["#childScope/2"]); +}; +export const attrs = _input; +export { _input }; +export const template = `
${_customTag_template}${_customTag_template}`; +export const walks = /* get, over(3), beginChild, _customTag_walks, endChild, beginChild, _customTag_walks, endChild, replace, over(1) */` d/${_customTag_walks}&/${_customTag_walks}&%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/attr-class/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/html.expected/components/custom-tag.js b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/html.expected/components/custom-tag.js new file mode 100644 index 0000000000..6019dfb562 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/html.expected/components/custom-tag.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-class/components/custom-tag.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..529f39437a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-class/__snapshots__/html.expected/template.js @@ -0,0 +1,52 @@ +import { classAttr as _classAttr, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _customTag from "./components/custom-tag.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const { + c, + d + } = input; + _write(`${_markResumeNode(_scope0_id, "#div/0")}
`); + _customTag._({ + class: ["a", { + b: c, + d + }] + }); + _customTag._({ + class: ["a", false, "b"] + }); + const _dynamicScope = _dynamicTag(input.test, { + class: ["a", { + b: c, + d + }], + test: { + class: ["a", { + b: c, + d + }], + renderBody() { + _write("Hello"); + } + } + }, /* @__PURE__ */_createRenderer(() => { + const _scope1_id = _nextScopeId(); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/attr-class/template.marko_1_c/subscriber"); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/attr-class/template.marko_1_d/subscriber"); + _writeScope(_scope1_id, { + "_": _serializedScope(_scope0_id) + }); + })); + _write(`${_markResumeControlEnd(_scope0_id, "#text/3")}`); + _writeScope(_scope0_id, { + "c": c, + "d": d, + "#text/3!": _dynamicScope, + "#text/3(": input.test + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-class/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-class/components/custom-tag.marko b/packages/translator-tags/src/__tests__/fixtures/attr-class/components/custom-tag.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-class/components/custom-tag.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-class/components/custom-tag.marko diff --git a/packages/translator/src/__tests__/fixtures/attr-class/template.marko b/packages/translator-tags/src/__tests__/fixtures/attr-class/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-class/template.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-class/template.marko diff --git a/packages/translator/src/__tests__/fixtures/attr-class/test.ts b/packages/translator-tags/src/__tests__/fixtures/attr-class/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-class/test.ts rename to packages/translator-tags/src/__tests__/fixtures/attr-class/test.ts diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..c6fd8e1907 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/dom.expected/template.js @@ -0,0 +1,13 @@ +import { classAttr as _classAttr, attr as _attr, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _input = /* @__PURE__ */_value("input", (_scope, input) => { + _classAttr(_scope["#div/0"], input.foo); + _attr(_scope["#div/0"], "foo", 'a' + input.foo + 'b'); + _attr(_scope["#div/0"], "bar", `a ${input.bar} b`); + _attr(_scope["#div/0"], "nested", `a ${input.foo + ` nested ${input.bar}`} b`); +}); +export const attrs = _input; +export { _input }; +export const template = "
"; +export const walks = /* get, over(1) */" b"; +export const setup = function () {}; +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/attr-escape/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..2264b494d4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { classAttr as _classAttr, attr as _attr, 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(); + _write(`${_markResumeNode(_scope0_id, "#div/0")}`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-escape/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/template.marko b/packages/translator-tags/src/__tests__/fixtures/attr-escape/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/template.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/template.marko diff --git a/packages/translator/src/__tests__/fixtures/attr-escape/test.ts b/packages/translator-tags/src/__tests__/fixtures/attr-escape/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-escape/test.ts rename to packages/translator-tags/src/__tests__/fixtures/attr-escape/test.ts diff --git a/packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..7856e58f06 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "
"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/attr-falsey/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..735a4e6996 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-falsey/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-falsey/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-falsey/template.marko b/packages/translator-tags/src/__tests__/fixtures/attr-falsey/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-falsey/template.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-falsey/template.marko diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/dom.expected/components/custom-tag.js b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/dom.expected/components/custom-tag.js new file mode 100644 index 0000000000..ccab8b1c82 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/dom.expected/components/custom-tag.js @@ -0,0 +1,5 @@ +export const template = "
"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/attr-style/components/custom-tag.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..5fd6dd309a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/dom.expected/template.js @@ -0,0 +1,41 @@ +import { styleAttr as _styleAttr, write as _write, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _customTag, template as _customTag_template, walks as _customTag_walks } from "./components/custom-tag.marko"; +const _testBody2 = /* @__PURE__ */_createRenderer("", ""); +const _testBody = /* @__PURE__ */_createRenderer("", ""); +const _test_input = _dynamicTagAttrs("#text/4", _testBody); +const _dynamicTagName = /* @__PURE__ */_conditional("#text/4", _scope => _test_input(_scope, () => ({ + style: { + color: "green" + }, + test: { + style: { + color: "green" + }, + renderBody() { + _write("Hello"); + } + } +})), void 0, _test_input); +const _test = /* @__PURE__ */_value("test", (_scope, test) => _dynamicTagName(_scope, test || _testBody), void 0, _dynamicTagName); +const _color = /* @__PURE__ */_value("color", (_scope, color) => _styleAttr(_scope["#div/0"], { + color: color +})); +const _setup = _scope => { + _customTag(_scope["#childScope/1"]); + _customTag(_scope["#childScope/2"]); + _customTag(_scope["#childScope/3"]); +}; +export const attrs = (_scope, _destructure, _clean) => { + let color, test; + if (!_clean) ({ + color, + test + } = _destructure); + _color(_scope, color, _clean); + _test(_scope, test, _clean); +}; +export { _color, _test }; +export const template = `
${_customTag_template}${_customTag_template}${_customTag_template}`; +export const walks = /* get, over(3), beginChild, _customTag_walks, endChild, beginChild, _customTag_walks, endChild, beginChild, _customTag_walks, endChild, replace, over(1) */` d/${_customTag_walks}&/${_customTag_walks}&/${_customTag_walks}&%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/attr-style/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/html.expected/components/custom-tag.js b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/html.expected/components/custom-tag.js new file mode 100644 index 0000000000..249830d296 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/html.expected/components/custom-tag.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-style/components/custom-tag.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..d9355ca5b4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-style/__snapshots__/html.expected/template.js @@ -0,0 +1,43 @@ +import { styleAttr as _styleAttr, markResumeNode as _markResumeNode, 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"; +import _customTag from "./components/custom-tag.marko"; +const _renderer = /* @__PURE__ */_createRenderer(({ + color, + test +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write(`${_markResumeNode(_scope0_id, "#div/0")}
`); + _customTag._({ + style: { + color: color + } + }); + _customTag._({ + style: { + width: 100 + } + }); + _customTag._({ + style: "color: green" + }); + const _dynamicScope = _dynamicTag(test, { + style: { + color: "green" + }, + test: { + style: { + color: "green" + }, + renderBody() { + _write("Hello"); + } + } + }); + _write(`${_markResumeControlEnd(_scope0_id, "#text/4")}`); + _writeScope(_scope0_id, { + "#text/4!": _dynamicScope, + "#text/4(": test + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-style/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-style/components/custom-tag.marko b/packages/translator-tags/src/__tests__/fixtures/attr-style/components/custom-tag.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-style/components/custom-tag.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-style/components/custom-tag.marko diff --git a/packages/translator/src/__tests__/fixtures/attr-style/template.marko b/packages/translator-tags/src/__tests__/fixtures/attr-style/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-style/template.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-style/template.marko diff --git a/packages/translator/src/__tests__/fixtures/attr-style/test.ts b/packages/translator-tags/src/__tests__/fixtures/attr-style/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-style/test.ts rename to packages/translator-tags/src/__tests__/fixtures/attr-style/test.ts diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..0012611586 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/dom.expected/template.js @@ -0,0 +1,8 @@ +import { attr as _attr, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _input = /* @__PURE__ */_value("input", (_scope, input) => _attr(_scope["#div/0"], "foo", `Hello ${input.name}`)); +export const attrs = _input; +export { _input }; +export const template = "
"; +export const walks = /* get, over(1) */" b"; +export const setup = function () {}; +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/attr-template-literal-escape/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..c7b107886d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { attr as _attr, 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(); + _write(`${_markResumeNode(_scope0_id, "#div/0")}`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/template.marko b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/template.marko rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/template.marko diff --git a/packages/translator/src/__tests__/fixtures/attr-template-literal-escape/test.ts b/packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/attr-template-literal-escape/test.ts rename to packages/translator-tags/src/__tests__/fixtures/attr-template-literal-escape/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..b539b0a668 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/dom.expected/template.js @@ -0,0 +1,11 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _z = /* @__PURE__ */_value("z", (_scope, z) => _data(_scope["#text/0"], z)); +const _y = /* @__PURE__ */_value("y", (_scope, y) => _z(_scope, y * 3)); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _y(_scope, x * 2)); +const _setup = _scope => { + _x(_scope, 1); +}; +export const template = "
"; +export const walks = /* next(1), get, out(1) */"D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-chain/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..608a7c4a38 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/html.expected/template.js @@ -0,0 +1,9 @@ +import { 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 = 1; + const y = x * 2; + const z = y * 3; + _write(`
${_escapeXML(z)}${_markResumeNode(_scope0_id, "#text/0")}
`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-chain/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-chain/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-chain/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-chain/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-chain/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-chain/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/dom.expected/components/my-button.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/dom.expected/components/my-button.js new file mode 100644 index 0000000000..9dfbb4b5d7 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/dom.expected/components/my-button.js @@ -0,0 +1,23 @@ +import { on as _on, data as _data, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _text = /* @__PURE__ */_value("text", (_scope, text) => _data(_scope["#text/1"], text)); +const _onClick_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/components/my-button.marko_0_onClick", _scope => { + const { + onClick + } = _scope; + _on(_scope["#button/0"], "click", onClick); +}); +const _onClick = /* @__PURE__ */_value("onClick", (_scope, onClick) => _queueEffect(_scope, _onClick_effect)); +export const attrs = (_scope, _destructure, _clean) => { + let onClick, text; + if (!_clean) ({ + onClick, + text + } = _destructure); + _onClick(_scope, onClick, _clean); + _text(_scope, text, _clean); +}; +export { _onClick, _text }; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = function () {}; +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/basic-component-attrs/components/my-button.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..bbb88820da --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/dom.expected/template.js @@ -0,0 +1,19 @@ +import { queueSource as _queueSource, inChild as _inChild, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _myButton, attrs as _myButton_attrs, template as _myButton_template, walks as _myButton_walks } from "./components/my-button.marko"; +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => _myButton_attrs(_scope["#childScope/0"], { + text: clickCount, + onClick: function () { + const { + clickCount + } = _scope; + _queueSource(_scope, _clickCount, clickCount + 1); + } +}), void 0, _inChild("#childScope/0", _myButton_attrs)); +const _setup = _scope => { + _myButton(_scope["#childScope/0"]); + _clickCount(_scope, 0); +}; +export const template = `${_myButton_template}`; +export const walks = /* beginChild, _myButton_walks, endChild */`/${_myButton_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/html.expected/components/my-button.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/html.expected/components/my-button.js new file mode 100644 index 0000000000..c2a4671397 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/html.expected/components/my-button.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + onClick, + text +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/components/my-button.marko_0_onClick"); + _writeScope(_scope0_id, { + "onClick": onClick + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/components/my-button.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..5fa3f8c08d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import _myButton from "./components/my-button.marko"; +import { 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 clickCount = 0; + _myButton._({ + text: clickCount, + onClick: function () { + clickCount++; + } + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-component-attrs/components/my-button.marko b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/components/my-button.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-attrs/components/my-button.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/components/my-button.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-component-attrs/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-attrs/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-component-attrs/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-attrs/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-component-attrs/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/dom.expected/components/my-button.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/dom.expected/components/my-button.js new file mode 100644 index 0000000000..c1245463e2 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/dom.expected/components/my-button.js @@ -0,0 +1,24 @@ +import { on as _on, conditional as _conditional, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _dynamicTagName = /* @__PURE__ */_conditional("#text/1"); +const _renderBody = /* @__PURE__ */_value("renderBody", (_scope, renderBody) => _dynamicTagName(_scope, renderBody), void 0, _dynamicTagName); +const _onClick_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/components/my-button.marko_0_onClick", _scope => { + const { + onClick + } = _scope; + _on(_scope["#button/0"], "click", onClick); +}); +const _onClick = /* @__PURE__ */_value("onClick", (_scope, onClick) => _queueEffect(_scope, _onClick_effect)); +export const attrs = (_scope, _destructure, _clean) => { + let onClick, renderBody; + if (!_clean) ({ + onClick, + renderBody + } = _destructure); + _onClick(_scope, onClick, _clean); + _renderBody(_scope, renderBody, _clean); +}; +export { _onClick, _renderBody }; +export const template = ""; +export const walks = /* get, next(1), replace, out(1) */" D%l"; +export const setup = function () {}; +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/basic-component-renderBody/components/my-button.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..650cadb213 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/dom.expected/template.js @@ -0,0 +1,21 @@ +import { queueSource as _queueSource, data as _data, bindRenderer as _bindRenderer, inChild as _inChild, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _myButton, attrs as _myButton_attrs, template as _myButton_template, walks as _myButton_walks } from "./components/my-button.marko"; +const _clickCount$myButtonBody = _registerSubscriber("packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/template.marko_1_clickCount/subscriber", /* @__PURE__ */_dynamicClosure("clickCount", (_scope, clickCount) => _data(_scope["#text/0"], clickCount))); +const _myButtonBody = /* @__PURE__ */_createRenderer(" ", /* get */" ", void 0, [_clickCount$myButtonBody]); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => _myButton_attrs(_scope["#childScope/0"], { + onClick: function () { + const { + clickCount + } = _scope; + _queueSource(_scope, _clickCount, clickCount + 1); + }, + renderBody: /* @__PURE__ */_bindRenderer(_scope, _myButtonBody) +}), _dynamicSubscribers("clickCount"), _inChild("#childScope/0", _myButton_attrs)); +const _setup = _scope => { + _myButton(_scope["#childScope/0"]); + _clickCount(_scope, 0); +}; +export const template = `${_myButton_template}`; +export const walks = /* beginChild, _myButton_walks, endChild */`/${_myButton_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/html.expected/components/my-button.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/html.expected/components/my-button.js new file mode 100644 index 0000000000..ca342fd0fa --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/html.expected/components/my-button.js @@ -0,0 +1,17 @@ +import { write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, markResumeNode as _markResumeNode, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + onClick, + renderBody +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write("${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/components/my-button.marko_0_onClick"); + _writeScope(_scope0_id, { + "onClick": onClick, + "#text/1!": _dynamicScope, + "#text/1(": renderBody + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/components/my-button.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..fde1d60ad3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/html.expected/template.js @@ -0,0 +1,16 @@ +import { 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 _myButton from "./components/my-button.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const clickCount = 0; + _myButton._({ + onClick: function () { + clickCount++; + }, + renderBody() { + const _scope1_id = _nextScopeId(); + _write(`${_escapeXML(clickCount)}${_markResumeNode(_scope1_id, "#text/0")}`); + } + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..1de690e4f4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr.expected.md @@ -0,0 +1,37 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#comment0 +inserted #document/html0/body1/button0/#text1 +inserted #document/html0/body1/button0/#comment2 +inserted #document/html0/body1/button0/#comment3 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-component-renderBody/components/my-button.marko b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/components/my-button.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-renderBody/components/my-button.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/components/my-button.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-component-renderBody/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-renderBody/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-component-renderBody/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component-renderBody/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-component-renderBody/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/dom.expected/components/counter.js b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/dom.expected/components/counter.js new file mode 100644 index 0000000000..56981554f4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/dom.expected/components/counter.js @@ -0,0 +1,18 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _clickCount_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-component/components/counter.marko_0_clickCount", _scope => _on(_scope["#button/0"], "click", function () { + const { + clickCount + } = _scope; + _queueSource(_scope, _clickCount, clickCount + 1); +})); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => { + _data(_scope["#text/1"], clickCount); + _queueEffect(_scope, _clickCount_effect); +}); +const _setup = _scope => { + _clickCount(_scope, 0); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-component/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..b520ac7302 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/dom.expected/template.js @@ -0,0 +1,9 @@ +import { setup as _counter, template as _counter_template, walks as _counter_walks } from "./components/counter.marko"; +const _setup = _scope => { + _counter(_scope["#childScope/0"]); +}; +export const template = `
${_counter_template}
`; +export const walks = /* next(1), beginChild, _counter_walks, endChild, out(1) */`D/${_counter_walks}&l`; +export const setup = _setup; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-component/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/html.expected/components/counter.js b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/html.expected/components/counter.js new file mode 100644 index 0000000000..8b0839703f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/html.expected/components/counter.js @@ -0,0 +1,11 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const clickCount = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-component/components/counter.marko_0_clickCount"); + _writeScope(_scope0_id, { + "clickCount": clickCount + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-component/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..7278269e40 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/html.expected/template.js @@ -0,0 +1,9 @@ +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _counter from "./components/counter.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write("
"); + _counter._({}); + _write("
"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-component/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..cda765671e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/resume.expected.md @@ -0,0 +1,50 @@ +# Render {} +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "0" => "1" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..62fa782ead --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-component/__snapshots__/ssr.expected.md @@ -0,0 +1,36 @@ +# Write +
+ + +# Render "End" +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +inserted #document/html0/body1/div0/button0/#comment1 +inserted #document/html0/body1/div0/#comment1 +inserted #document/html0/body1/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-component/components/counter.marko b/packages/translator-tags/src/__tests__/fixtures/basic-component/components/counter.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component/components/counter.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-component/components/counter.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-component/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-component/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-component/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-component/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-component/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-component/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-component/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..d5d1657a47 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/dom.expected/template.js @@ -0,0 +1,29 @@ +import { on as _on, queueSource as _queueSource, data as _data, closure as _closure, createRenderer as _createRenderer, register as _register, conditional as _conditional, queueEffect as _queueEffect, inConditionalScope as _inConditionalScope, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _count$ifBody = /* @__PURE__ */_closure("count", (_scope, count) => _data(_scope["#text/0"], count)); +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/template.marko_1_renderer", /* @__PURE__ */_createRenderer("The count is ", /* over(1), replace */"b%", void 0, [_count$ifBody])); +const _if = /* @__PURE__ */_conditional("#text/2"); +const _count_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/template.marko_0_count", _scope => _on(_scope["#button/0"], "click", function () { + const { + count + } = _scope; + _queueSource(_scope, _count, count + 1); +})); +const _count = /* @__PURE__ */_value("count", (_scope, count) => _queueEffect(_scope, _count_effect), _inConditionalScope(_count$ifBody, "#text/2")); +const _show_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/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); + _if(_scope, show ? _ifBody : null); +}, void 0, _if); +const _setup = _scope => { + _show(_scope, true); + _count(_scope, 0); +}; +export const template = ""; +export const walks = /* get, over(1), get, over(1), replace, over(1) */" b b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..506f5c1a65 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/html.expected/template.js @@ -0,0 +1,26 @@ +import { markResumeNode as _markResumeNode, write as _write, escapeXML as _escapeXML, markResumeScopeStart as _markResumeScopeStart, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlEnd as _markResumeControlEnd, 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; + const count = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + let _scope1_, _ifRenderer; + if (show) { + const _scope1_id = _nextScopeId(); + _write(`${_markResumeScopeStart(_scope1_id)}The count is ${_escapeXML(count)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/template.marko_1_renderer"); + } + _write(`${_markResumeControlEnd(_scope0_id, "#text/2")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/template.marko_0_show"); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/template.marko_0_count"); + _writeScope(_scope0_id, { + "show": show, + "count": count, + "#text/2!": _scope1_, + "#text/2(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..d074c949d5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter-multiple-nodes/__snapshots__/resume.expected.md @@ -0,0 +1,189 @@ +# Render {} +```html + + + + The count is 0 + + +# Render "End" +```html + + + + "; +export const walks = /* get, over(1), get, over(1), replace, over(1) */" b b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..056fa17ab7 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/html.expected/template.js @@ -0,0 +1,27 @@ +import { markResumeNode as _markResumeNode, write as _write, escapeXML as _escapeXML, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, 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; + const count = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + let _ifScopeId, _scope1_, _ifRenderer; + if (show) { + const _scope1_id = _nextScopeId(); + _write(`${_escapeXML(count)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/2", _ifScopeId)}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/template.marko_0_show"); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/template.marko_0_count"); + _writeScope(_scope0_id, { + "show": show, + "count": count, + "#text/2!": _scope1_, + "#text/2(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..a3d2acda7e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-conditional-counter/__snapshots__/resume.expected.md @@ -0,0 +1,186 @@ +# Render {} +```html + + + + 0 + + +# Render "End" +```html + + + +
"; +export const walks = /* get, next(1), over(1), replace, out(1), get, over(1), next(1), get, out(1) */" Db%l bD l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..7d32510daa --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/html.expected/template.js @@ -0,0 +1,15 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const count = 0; + const multiplier = 1; + const multipliedCount = count * multiplier; + _write(`${_markResumeNode(_scope0_id, "#button/0")}${_markResumeNode(_scope0_id, "#button/2")}
${_escapeXML(multipliedCount)}${_markResumeNode(_scope0_id, "#text/3")}
`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/template.marko_0_count"); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/template.marko_0_multiplier"); + _writeScope(_scope0_id, { + "count": count, + "multiplier": multiplier + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..1ce461f29a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/resume.expected.md @@ -0,0 +1,157 @@ +# Render {} +```html + + + + + + + +
+ 0 + +
+ + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button#count").click() + +```html + + + + + + + +
+ 1 + +
+ + + +``` + +# Mutations +``` +#document/html0/body1/div4/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button#count").click() + +```html + + + + + + + +
+ 2 + +
+ + + +``` + +# Mutations +``` +#document/html0/body1/div4/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button#multiplier").click() + +```html + + + + + + + +
+ 4 + +
+ + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text2: "1" => "2" +#document/html0/body1/div4/#text0: "2" => "4" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..6c73897234 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/__snapshots__/ssr.expected.md @@ -0,0 +1,57 @@ +# Write +
0
+ + +# Render "End" +```html + + + + + + + +
+ 0 + +
+ + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/button0/#text2 +inserted #document/html0/body1/button0/#comment3 +inserted #document/html0/body1/button0/#text4 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/button2 +inserted #document/html0/body1/button2/#text0 +inserted #document/html0/body1/#comment3 +inserted #document/html0/body1/div4 +inserted #document/html0/body1/div4/#text0 +inserted #document/html0/body1/div4/#comment1 +inserted #document/html0/body1/script5 +inserted #document/html0/body1/script5/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-counter-multiplier/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter-multiplier/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-counter-multiplier/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter-multiplier/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-counter-multiplier/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..0473f7076e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/dom.expected/template.js @@ -0,0 +1,18 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _clickCount_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-counter/template.marko_0_clickCount", _scope => _on(_scope["#button/0"], "click", function () { + const { + clickCount + } = _scope; + _queueSource(_scope, _clickCount, clickCount + 1); +})); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => { + _data(_scope["#text/1"], clickCount); + _queueEffect(_scope, _clickCount_effect); +}); +const _setup = _scope => { + _clickCount(_scope, 0); +}; +export const template = "
"; +export const walks = /* next(1), get, next(1), get, out(2) */"D D m"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..6762a9178c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const clickCount = 0; + _write(`
${_markResumeNode(_scope0_id, "#button/0")}
`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-counter/template.marko_0_clickCount"); + _writeScope(_scope0_id, { + "clickCount": clickCount + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..2b8f7cffc0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/resume.expected.md @@ -0,0 +1,104 @@ +# Render {} +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "2" => "3" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..0aadff7468 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-counter/__snapshots__/ssr.expected.md @@ -0,0 +1,36 @@ +# Write +
+ + +# Render "End" +```html + + + +
+ + +
+ + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +inserted #document/html0/body1/div0/button0/#comment1 +inserted #document/html0/body1/div0/#comment1 +inserted #document/html0/body1/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-counter/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-counter/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-counter/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-counter/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-counter/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-counter/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-counter/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..3c98cab16f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,19 @@ +import { createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _tagNameBody = /* @__PURE__ */_createRenderer("Hello World", ""); +const _tagName_input = _dynamicTagAttrs("#text/0", _tagNameBody); +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0", _scope => _tagName_input(_scope, () => ({ + class: ["a", "b"] +})), void 0, _tagName_input); +const _tagName = /* @__PURE__ */_value("tagName", (_scope, tagName) => _dynamicTagName(_scope, tagName || _tagNameBody), void 0, _dynamicTagName); +export const attrs = (_scope, _destructure, _clean) => { + let tagName; + if (!_clean) ({ + tagName + } = _destructure); + _tagName(_scope, tagName, _clean); +}; +export { _tagName }; +export const template = ""; +export const walks = /* replace, over(1) */"%b"; +export const setup = function () {}; +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/basic-dynamic-native-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..322510ebf1 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,18 @@ +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeScope as _writeScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + tagName +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + const _dynamicScope = _dynamicTag(tagName, { + class: ["a", "b"] + }, /* @__PURE__ */_createRenderer(() => { + const _scope1_id = _nextScopeId(); + _write("Hello World"); + })); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}`); + _writeScope(_scope0_id, { + "#text/0!": _dynamicScope, + "#text/0(": tagName + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-dynamic-native-tag/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-dynamic-native-tag/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..3d6a1a0fb4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/dom.expected/template.js @@ -0,0 +1,9 @@ +import { register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/template.marko_0", _scope => document.body.className = "no-deps"); +const _setup = _scope => { + _queueEffect(_scope, _setup_effect); +}; +export const template = ""; +export const walks = ""; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..c97ba3efd8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { writeEffect as _writeEffect, 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(); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/template.marko_0"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..6291e344d4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/resume.expected.md @@ -0,0 +1,18 @@ +# Render undefined +```html + + + + + + +``` + +# Mutations +``` +#document/html0/body1: attr(class) null => "no-deps" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..88ed49238d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/__snapshots__/ssr.expected.md @@ -0,0 +1,24 @@ +# Write + + + +# Render "End" +```html + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/head0/script0 +inserted #document/html0/head0/script0/#text0 +inserted #document/html0/body1 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-effect-no-deps/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-effect-no-deps/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-effect-no-deps/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..43a8ed94ea --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/dom.expected/template.js @@ -0,0 +1,21 @@ +import { on as _on, queueSource as _queueSource, data as _data, closure as _closure, createRenderer as _createRenderer, register as _register, conditional as _conditional, value as _value, inConditionalScope as _inConditionalScope, queueEffect as _queueEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _message$ifBody = /* @__PURE__ */_closure("message", (_scope, message) => _data(_scope["#text/0"], message.text)); +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko_1_renderer", /* @__PURE__ */_createRenderer(" ", /* get */" ", void 0, [_message$ifBody])); +const _if = /* @__PURE__ */_conditional("#text/1"); +const _show = /* @__PURE__ */_value("show", (_scope, show) => _if(_scope, show ? _ifBody : null), void 0, _if); +const _message = /* @__PURE__ */_value("message", null, _inConditionalScope(_message$ifBody, "#text/1")); +const _setup_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko_0", _scope => _on(_scope["#button/0"], "click", function () { + _queueSource(_scope, _message, null); + _queueSource(_scope, _show, false); +})); +const _setup = _scope => { + _queueEffect(_scope, _setup_effect); + _message(_scope, { + text: "hi" + }); + _show(_scope, true); +}; +export const template = ""; +export const walks = /* get, over(1), replace, over(1) */" b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..7d7ebbf8f4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/html.expected/template.js @@ -0,0 +1,26 @@ +import { markResumeNode as _markResumeNode, write as _write, escapeXML as _escapeXML, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeEffect as _writeEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const message = { + text: "hi" + }; + const show = true; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + let _ifScopeId, _scope1_, _ifRenderer; + if (show) { + const _scope1_id = _nextScopeId(); + _write(`${_escapeXML(message.text)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/1", _ifScopeId)}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko_0"); + _writeScope(_scope0_id, { + "#text/1!": _scope1_, + "#text/1(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..75dc2a10b9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/resume.expected.md @@ -0,0 +1,51 @@ +# Render {} +```html + + + + + + hi + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + +``` + +# Mutations +``` +removed #document/html0/body1/#comment2 after #document/html0/body1/#comment3 +inserted #document/html0/body1/#comment2 +removed #text after #document/html0/body1/#comment2 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-execution-order/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..ec4244c6e0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/__snapshots__/ssr.expected.md @@ -0,0 +1,37 @@ +# Write + hi + + +# Render "End" +```html + + + + + + hi + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/#text2 +inserted #document/html0/body1/#comment3 +inserted #document/html0/body1/#comment4 +inserted #document/html0/body1/script5 +inserted #document/html0/body1/script5/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-execution-order/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-execution-order/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-execution-order/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-execution-order/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-execution-order/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-execution-order/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-execution-order/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f1fcaaf7fe --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/dom.expected/template.js @@ -0,0 +1,15 @@ +export const v = 123; +import { data as _data, value as _value2, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _value = /* @__PURE__ */_value2("value", (_scope, value) => _data(_scope["#text/0"], value)); +export const attrs = (_scope, _destructure, _clean) => { + let value; + if (!_clean) ({ + value + } = _destructure); + _value(_scope, value, _clean); +}; +export { _value }; +export const template = "
"; +export const walks = /* next(1), get, out(1) */"D l"; +export const setup = function () {}; +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/basic-export/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..b5fce29bd6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/html.expected/template.js @@ -0,0 +1,9 @@ +export const v = 123; +import { 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(({ + value +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write(`
${_escapeXML(value)}${_markResumeNode(_scope0_id, "#text/0")}
`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-export/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-export/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-export/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-export/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-export/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-export/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-export/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-export/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-export/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..1be7902ffb --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "

Hello World

"; +export const walks = /* over(2) */"c"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-flush-here/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..5c617e78fe --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("

Hello World

"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-flush-here/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-flush-here/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-flush-here/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-flush-here/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-flush-here/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..6b709777b9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/dom.expected/template.js @@ -0,0 +1,20 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _count_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/template.marko_0_count", _scope => _on(_scope["#button/0"], "click", function () { + const { + count + } = _scope; + { + _queueSource(_scope, _count, count + 1); + } +})); +const _count = /* @__PURE__ */_value("count", (_scope, count) => { + _data(_scope["#text/1"], count); + _queueEffect(_scope, _count_effect); +}); +const _setup = _scope => { + _count(_scope, 0); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..aac25f0358 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const count = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/template.marko_0_count"); + _writeScope(_scope0_id, { + "count": count + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..74e52c623e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/resume.expected.md @@ -0,0 +1,96 @@ +# Render {} +```html + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "2" => "3" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..3bcd880784 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/__snapshots__/ssr.expected.md @@ -0,0 +1,33 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-fn-with-block/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-fn-with-block/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-fn-with-block/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-fn-with-block/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-fn-with-block/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..69bee925f3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/dom.expected/template.js @@ -0,0 +1,29 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, intersection as _intersection, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_a_b_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko_0_a_b", _scope => _on(_scope["#button/0"], "click", function () { + const { + a + } = _scope; + _queueSource(_scope, _a, a.map(a => { + const { + b + } = _scope; + return b; + })); +})); +const _expr_a_b = /* @__PURE__ */_intersection(2, _scope => { + const { + a, + b + } = _scope; + _queueEffect(_scope, _expr_a_b_effect); +}); +const _b = /* @__PURE__ */_value("b", null, _expr_a_b); +const _a = /* @__PURE__ */_value("a", (_scope, a) => _data(_scope["#text/1"], a.join("")), _expr_a_b); +const _setup = _scope => { + _a(_scope, [0]); + _b(_scope, 1); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..d4785e40aa --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const a = [0]; + const b = 1; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko_0_a_b"); + _writeScope(_scope0_id, { + "a": a, + "b": b + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..040105977d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/resume.expected.md @@ -0,0 +1,46 @@ +# Render {} +```html + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "0" => "1" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..f6c13e958a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/__snapshots__/ssr.expected.md @@ -0,0 +1,33 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-multi-ref-nested/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-multi-ref-nested/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..11f744cc44 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/dom.expected/template.js @@ -0,0 +1,13 @@ +import { on as _on, queueSource as _queueSource, data as _data2, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _data = /* @__PURE__ */_value("data", (_scope, data) => _data2(_scope["#text/1"], data)); +const _setup_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/template.marko_0", _scope => _on(_scope["#button/0"], "click", function () { + _queueSource(_scope, _data, 1); +})); +const _setup = _scope => { + _queueEffect(_scope, _setup_effect); + _data(_scope, 0); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..2adcfd8692 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/html.expected/template.js @@ -0,0 +1,8 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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 data = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/template.marko_0"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..59bcbac42b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/resume.expected.md @@ -0,0 +1,46 @@ +# Render {} +```html + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "0" => "1" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-refless/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..8daeed8a7a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/__snapshots__/ssr.expected.md @@ -0,0 +1,33 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-refless/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-refless/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-handler-refless/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-handler-refless/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-handler-refless/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/dom.expected/components/comments.js b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/dom.expected/components/comments.js new file mode 100644 index 0000000000..9bb049c903 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/dom.expected/components/comments.js @@ -0,0 +1,76 @@ +import { attr as _attr, data as _data, on as _on, queueSource as _queueSource, inChild as _inChild, intersection as _intersection, closure as _closure, createRenderer as _createRenderer, register as _register, conditional as _conditional, queueEffect as _queueEffect, value as _value, inConditionalScope as _inConditionalScope, loopOf as _loopOf, inLoopScope as _inLoopScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _comments2, attrs as _comments_attrs, template as _comments_template, walks as _comments_walks } from "./comments.marko"; +const _expr_comment_id$ifBody = /* @__PURE__ */_intersection(2, _scope => { + const { + _: { + comment, + id + } + } = _scope; + _comments_attrs(_scope["#childScope/0"], { + comments: comment.comments, + path: id + }); +}); +const _id$ifBody = /* @__PURE__ */_closure("id", null, void 0, _expr_comment_id$ifBody); +const _comment$ifBody = /* @__PURE__ */_closure("comment", null, void 0, _expr_comment_id$ifBody); +const _setup$ifBody = _scope => { + _comments2(_scope["#childScope/0"]); +}; +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko_2_renderer", /* @__PURE__ */_createRenderer(`${_comments_template}`, /* beginChild, _comments_walks, endChild */`/${_comments_walks}&`, _setup$ifBody, [_comment$ifBody, _id$ifBody])); +const _expr_path_i$forBody = /* @__PURE__ */_intersection(2, _scope => { + const { + _: { + path + }, + i + } = _scope; + _id$forBody(_scope, `${path}-${i}`); +}); +const _if$forBody = /* @__PURE__ */_conditional("#text/4"); +const _open$forBody_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko_1_open", _scope => _on(_scope["#button/2"], "click", function () { + const { + open + } = _scope; + _queueSource(_scope, _open$forBody, !open); +})); +const _open$forBody = /* @__PURE__ */_value("open", (_scope, open) => { + _attr(_scope["#li/0"], "hidden", !open); + _data(_scope["#text/3"], open ? "[-]" : "[+]"); + _queueEffect(_scope, _open$forBody_effect); +}); +const _id$forBody = /* @__PURE__ */_value("id", (_scope, id) => _attr(_scope["#li/0"], "id", id), _inConditionalScope(_id$ifBody, "#text/4")); +const _i$forBody = /* @__PURE__ */_value("i", null, _expr_path_i$forBody); +const _comment$forBody = /* @__PURE__ */_value("comment", (_scope, comment) => { + _data(_scope["#text/1"], comment.text); + _if$forBody(_scope, comment.comments ? _ifBody : null); +}, _inConditionalScope(_comment$ifBody, "#text/4"), _if$forBody); +const _path$forBody = /* @__PURE__ */_closure("path", null, void 0, _expr_path_i$forBody); +const _setup$forBody = _scope => { + _open$forBody(_scope, true); +}; +const _forBody = /* @__PURE__ */_createRenderer("
  • ", /* get, next(2), get, out(1), get, next(1), get, out(1), replace */" E l D l%", _setup$forBody, [_path$forBody], void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let comment, i; + if (!_clean) ({ + value: [comment, i] + } = _destructure); + _comment$forBody(_scope, comment, _clean); + _i$forBody(_scope, i, _clean); +}); +const _for = /* @__PURE__ */_loopOf("#ul/0", _forBody); +const _path = /* @__PURE__ */_value("path", null, _inLoopScope(_path$forBody, "#ul/0")); +const _comments = /* @__PURE__ */_value("comments", (_scope, comments) => _for(_scope, [comments]), void 0, _for); +export const attrs = (_scope, _destructure2, _clean) => { + let comments, path; + if (!_clean) ({ + comments, + path = "c" + } = _destructure2); + _comments(_scope, comments, _clean); + _path(_scope, path, _clean); +}; +export { _comments, _path }; +export const template = "
      "; +export const walks = /* get, over(1) */" b"; +export const setup = function () {}; +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/basic-inert-collapsible-tree/components/comments.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..8846f67e80 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/dom.expected/template.js @@ -0,0 +1,12 @@ +import { setup as _comments, attrs as _comments_attrs, template as _comments_template, walks as _comments_walks } from "./components/comments.marko"; +import { inChild as _inChild, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _input = /* @__PURE__ */_value("input", (_scope, input) => _comments_attrs(_scope["#childScope/0"], input), void 0, _inChild("#childScope/0", _comments_attrs)); +const _setup = _scope => { + _comments(_scope["#childScope/0"]); +}; +export const attrs = _input; +export { _input }; +export const template = `${_comments_template}`; +export const walks = /* beginChild, _comments_walks, endChild */`/${_comments_walks}&`; +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/basic-inert-collapsible-tree/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/html.expected/components/comments.js b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/html.expected/components/comments.js new file mode 100644 index 0000000000..30ce3b8b68 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/html.expected/components/comments.js @@ -0,0 +1,49 @@ +import { write as _write, attr as _attr, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, markResumeScopeStart as _markResumeScopeStart, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, maybeFlush as _maybeFlush, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _comments from "./comments.marko"; +const _renderer = /* @__PURE__ */_createRenderer(({ + comments, + path = "c" +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write("
        "); + const _scope1_ = new Map(); + let _i = 0; + for (const comment of comments) { + const _scope1_id = _nextScopeId(); + let i = _i++; + const id = `${path}-${i}`; + const open = true; + _write(`${_escapeXML(comment.text)}${_markResumeNode(_scope1_id, "#text/1")}${_markResumeNode(_scope1_id, "#button/2")}`); + let _ifScopeId, _scope2_, _ifRenderer; + if (comment.comments) { + const _scope2_id = _nextScopeId(); + _comments._({ + comments: comment.comments, + path: id + }); + _writeScope(_scope2_id, _scope2_ = { + "_": _serializedScope(_scope1_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko_2_renderer"); + _ifScopeId = _scope2_id; + } + _write(`${_markResumeScopeStart(_scope1_id)}${_markResumeControlSingleNodeEnd(_scope1_id, "#text/4", _ifScopeId)}${_markResumeNode(_scope1_id, "#li/0")}`); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko_1_open"); + _writeScope(_scope1_id, (_s => (_scope1_.set(i, _s), _s))({ + "i": i, + "open": open, + "comment": comment, + "id": id, + "#text/4!": _scope2_, + "#text/4(": _ifRenderer, + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlEnd(_scope0_id, "#ul/0")}
      ${_markResumeNode(_scope0_id, "#ul/0")}`); + _writeScope(_scope0_id, { + "#ul/0(": _scope1_.size ? _scope1_ : undefined, + "path": path + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..3e9d6dc1f1 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/html.expected/template.js @@ -0,0 +1,7 @@ +import _comments from "./components/comments.marko"; +import { 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(); + _comments._(input); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..7a61cdab02 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/__snapshots__/ssr.expected.md @@ -0,0 +1,119 @@ +# Write +
      • Hello World
        • testing 123
      • Goodbye World
      + + +# Render "End" +```html + + + +
        +
      • + + Hello World + + + + +
          +
        • + + testing 123 + + + + + + +
        • + + +
        + + + +
      • + +
      • + + Goodbye World + + + + + + +
      • + + +
      + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/ul0 +inserted #document/html0/body1/ul0/li0 +inserted #document/html0/body1/ul0/li0/span0 +inserted #document/html0/body1/ul0/li0/span0/#text0 +inserted #document/html0/body1/ul0/li0/span0/#comment1 +inserted #document/html0/body1/ul0/li0/button1 +inserted #document/html0/body1/ul0/li0/button1/#text0 +inserted #document/html0/body1/ul0/li0/button1/#comment1 +inserted #document/html0/body1/ul0/li0/#comment2 +inserted #document/html0/body1/ul0/li0/ul3 +inserted #document/html0/body1/ul0/li0/ul3/li0 +inserted #document/html0/body1/ul0/li0/ul3/li0/span0 +inserted #document/html0/body1/ul0/li0/ul3/li0/span0/#text0 +inserted #document/html0/body1/ul0/li0/ul3/li0/span0/#comment1 +inserted #document/html0/body1/ul0/li0/ul3/li0/button1 +inserted #document/html0/body1/ul0/li0/ul3/li0/button1/#text0 +inserted #document/html0/body1/ul0/li0/ul3/li0/button1/#comment1 +inserted #document/html0/body1/ul0/li0/ul3/li0/#comment2 +inserted #document/html0/body1/ul0/li0/ul3/li0/#comment3 +inserted #document/html0/body1/ul0/li0/ul3/li0/#comment4 +inserted #document/html0/body1/ul0/li0/ul3/#comment1 +inserted #document/html0/body1/ul0/li0/ul3/#comment2 +inserted #document/html0/body1/ul0/li0/#comment4 +inserted #document/html0/body1/ul0/li0/#comment5 +inserted #document/html0/body1/ul0/li0/#comment6 +inserted #document/html0/body1/ul0/#comment1 +inserted #document/html0/body1/ul0/li2 +inserted #document/html0/body1/ul0/li2/span0 +inserted #document/html0/body1/ul0/li2/span0/#text0 +inserted #document/html0/body1/ul0/li2/span0/#comment1 +inserted #document/html0/body1/ul0/li2/button1 +inserted #document/html0/body1/ul0/li2/button1/#text0 +inserted #document/html0/body1/ul0/li2/button1/#comment1 +inserted #document/html0/body1/ul0/li2/#comment2 +inserted #document/html0/body1/ul0/li2/#comment3 +inserted #document/html0/body1/ul0/li2/#comment4 +inserted #document/html0/body1/ul0/#comment3 +inserted #document/html0/body1/ul0/#comment4 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/components/comments.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-inert-collapsible-tree/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-inert-collapsible-tree/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/dom.expected/components/layout.js b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/dom.expected/components/layout.js new file mode 100644 index 0000000000..37bda2db0d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/dom.expected/components/layout.js @@ -0,0 +1,15 @@ +import { conditional as _conditional, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0"); +const _renderBody = /* @__PURE__ */_value("renderBody", (_scope, renderBody) => _dynamicTagName(_scope, renderBody), void 0, _dynamicTagName); +export const attrs = (_scope, _destructure, _clean) => { + let renderBody; + if (!_clean) ({ + renderBody + } = _destructure); + _renderBody(_scope, renderBody, _clean); +}; +export { _renderBody }; +export const template = ""; +export const walks = /* next(1), replace, out(1) */"D%l"; +export const setup = function () {}; +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/basic-layout/components/layout.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..c4e0abd9e8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/dom.expected/template.js @@ -0,0 +1,23 @@ +import { data as _data, bindRenderer as _bindRenderer, inChild as _inChild, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _layout, attrs as _layout_attrs, template as _layout_template, walks as _layout_walks } from "./components/layout.marko"; +const _name$layoutBody = _registerSubscriber("packages/translator-tags/src/__tests__/fixtures/basic-layout/template.marko_1_name/subscriber", /* @__PURE__ */_dynamicClosure("name", (_scope, name) => _data(_scope["#text/0"], name))); +const _layoutBody = /* @__PURE__ */_createRenderer("

      Hello

      ", /* next(1), over(1), replace */"Db%", void 0, [_name$layoutBody]); +const _name = /* @__PURE__ */_value("name", null, _dynamicSubscribers("name")); +const _setup = _scope => { + _layout(_scope["#childScope/0"]); + _layout_attrs(_scope["#childScope/0"], { + renderBody: /* @__PURE__ */_bindRenderer(_scope, _layoutBody) + }); +}; +export const attrs = (_scope, _destructure, _clean) => { + let name; + if (!_clean) ({ + name + } = _destructure); + _name(_scope, name, _clean); +}; +export { _name }; +export const template = `${_layout_template}`; +export const walks = /* beginChild, _layout_walks, endChild */`/${_layout_walks}&`; +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/basic-layout/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/html.expected/components/layout.js b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/html.expected/components/layout.js new file mode 100644 index 0000000000..94d94abde4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/html.expected/components/layout.js @@ -0,0 +1,14 @@ +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(({ + renderBody +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write(""); + const _dynamicScope = _dynamicTag(renderBody, null); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}`); + _writeScope(_scope0_id, { + "#text/0!": _dynamicScope, + "#text/0(": renderBody + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-layout/components/layout.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..daa788d5b8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/html.expected/template.js @@ -0,0 +1,14 @@ +import { 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 _layout from "./components/layout.marko"; +const _renderer = /* @__PURE__ */_createRenderer(({ + name +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _layout._({ + renderBody() { + const _scope1_id = _nextScopeId(); + _write(`

      Hello ${_escapeXML(name)}${_markResumeNode(_scope1_id, "#text/0")}

      `); + } + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-layout/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/components/layout.marko b/packages/translator-tags/src/__tests__/fixtures/basic-layout/components/layout.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/components/layout.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/components/layout.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-layout/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-layout/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-layout/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-layout/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-layout/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/dom.expected/components/child.js new file mode 100644 index 0000000000..9cb0cbc09e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,9 @@ +import { conditional as _conditional, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0"); +const _input = /* @__PURE__ */_value("input", (_scope, input) => _dynamicTagName(_scope, input.renderBody), void 0, _dynamicTagName); +export const attrs = _input; +export { _input }; +export const template = ""; +export const walks = /* replace, over(1) */"%b"; +export const setup = function () {}; +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/basic-nested-scope-custom-tag/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..5f6b423d8b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,27 @@ +import { on as _on, queueSource as _queueSource, data as _data, bindRenderer as _bindRenderer, inChild as _inChild, register as _register, queueEffect as _queueEffect, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _child, attrs as _child_attrs, template as _child_template, walks as _child_walks } from "./components/child.marko"; +const _count$childBody_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko_1_count", _scope => _on(_scope["#button/0"], "click", function () { + const { + _: { + count + } + } = _scope; + _queueSource(_scope._, _count, count + 1); +})); +const _count$childBody = _registerSubscriber("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko_1_count/subscriber", /* @__PURE__ */_dynamicClosure("count", (_scope, count) => { + _data(_scope["#text/1"], count); + _queueEffect(_scope, _count$childBody_effect); +})); +const _childBody = /* @__PURE__ */_createRenderer("", /* get, next(1), get */" D ", void 0, [_count$childBody]); +const _count = /* @__PURE__ */_value("count", null, _dynamicSubscribers("count")); +const _setup = _scope => { + _child(_scope["#childScope/0"]); + _count(_scope, 0); + _child_attrs(_scope["#childScope/0"], { + renderBody: /* @__PURE__ */_bindRenderer(_scope, _childBody) + }); +}; +export const template = `${_child_template}`; +export const walks = /* beginChild, _child_walks, endChild */`/${_child_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..5d0f5bc5ec --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/html.expected/components/child.js @@ -0,0 +1,11 @@ +import { dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, write as _write, 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(); + 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/basic-nested-scope-custom-tag/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..edf12fe32f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,21 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, 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 count = 0; + _child._({ + renderBody() { + const _scope1_id = _nextScopeId(); + _write(`${_markResumeNode(_scope1_id, "#button/0")}`); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko_1_count"); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko_1_count/subscriber"); + _writeScope(_scope1_id, { + "_": _serializedScope(_scope0_id) + }); + } + }); + _writeScope(_scope0_id, { + "count": count + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..928ef5e6e9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume.expected.md @@ -0,0 +1,105 @@ +# Render {} +```html + + + + + + + + + + +``` + +# Mutations +``` +removed #document/html0/body1/#comment0 before #document/html0 +inserted #document/html0/body1/#comment0 +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button1/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button1/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button1/#text0: "2" => "3" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..0a733db98a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr.expected.md @@ -0,0 +1,37 @@ +# Write + + + +# Render "End" +```html + + + + + + + + + + +``` + +# Mutations +``` +inserted #document/#comment0 +inserted #document/html1 +inserted #document/html1/head0 +inserted #document/html1/body1 +inserted #document/html1/body1/button0 +inserted #document/html1/body1/button0/#text0 +inserted #document/html1/body1/button0/#comment1 +inserted #document/html1/body1/#comment1 +inserted #document/html1/body1/#comment2 +inserted #document/html1/body1/script3 +inserted #document/html1/body1/script3/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-custom-tag/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/dom.expected/components/child.js new file mode 100644 index 0000000000..9aefcd3b2e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,9 @@ +import { conditional as _conditional, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0"); +const _input = /* @__PURE__ */_value("input", (_scope, input) => _dynamicTagName(_scope, input.renderBody), void 0, _dynamicTagName); +export const attrs = _input; +export { _input }; +export const template = ""; +export const walks = /* replace, over(1) */"%b"; +export const setup = function () {}; +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/basic-nested-scope-dynamic-tag/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..26906b32e1 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,26 @@ +import Child from "./components/child.marko"; +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _count$falseChildBody_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko_1_count", _scope => _on(_scope["#button/0"], "click", function () { + const { + _: { + count + } + } = _scope; + _queueSource(_scope._, _count, count + 1); +})); +const _count$falseChildBody = _registerSubscriber("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko_1_count/subscriber", /* @__PURE__ */_dynamicClosure("count", (_scope, count) => { + _data(_scope["#text/1"], count); + _queueEffect(_scope, _count$falseChildBody_effect); +})); +const _falseChildBody = /* @__PURE__ */_createRenderer("", /* get, next(1), get */" D ", void 0, [_count$falseChildBody]); +const _falseChild_input = _dynamicTagAttrs("#text/0", _falseChildBody); +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0", _scope => _falseChild_input(_scope, () => ({})), void 0, _falseChild_input); +const _count = /* @__PURE__ */_value("count", null, _dynamicSubscribers("count")); +const _setup = _scope => { + _count(_scope, 0); + _dynamicTagName(_scope, false || Child || _falseChildBody); +}; +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/basic-nested-scope-dynamic-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..a3e78c317c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/html.expected/components/child.js @@ -0,0 +1,11 @@ +import { dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, write as _write, 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(); + 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/basic-nested-scope-dynamic-tag/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..dfb655692d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,22 @@ +import Child from "./components/child.marko"; +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const count = 0; + const _dynamicScope = _dynamicTag(false || Child, {}, /* @__PURE__ */_createRenderer(() => { + const _scope1_id = _nextScopeId(); + _write(`${_markResumeNode(_scope1_id, "#button/0")}`); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko_1_count"); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko_1_count/subscriber"); + _writeScope(_scope1_id, { + "_": _serializedScope(_scope0_id) + }); + })); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}`); + _writeScope(_scope0_id, { + "count": count, + "#text/0!": _dynamicScope, + "#text/0(": false || Child + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..e06cf8d66f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume.expected.md @@ -0,0 +1,115 @@ +# Render {} +```html + + + + + + + + + + + + +``` + +# Mutations +``` +removed #document/html0/body1/#comment1 after #document/html0/body1/#comment0 +inserted #document/html0/body1/#comment1 +removed #document/html0/body1/#comment0 before #document/html0 +inserted #document/html0/body1/#comment0 +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button2/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button2/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button2/#text0: "2" => "3" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..891f92bb57 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr.expected.md @@ -0,0 +1,41 @@ +# Write + + + +# Render "End" +```html + + + + + + + + + + + + +``` + +# Mutations +``` +inserted #document/#comment0 +inserted #document/#comment1 +inserted #document/html2 +inserted #document/html2/head0 +inserted #document/html2/body1 +inserted #document/html2/body1/button0 +inserted #document/html2/body1/button0/#text0 +inserted #document/html2/body1/button0/#comment1 +inserted #document/html2/body1/#comment1 +inserted #document/html2/body1/#comment2 +inserted #document/html2/body1/#comment3 +inserted #document/html2/body1/script4 +inserted #document/html2/body1/script4/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..7fd8fd80cf --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/dom.expected/template.js @@ -0,0 +1,39 @@ +import { on as _on, attr as _attr, queueSource as _queueSource, data as _data, intersection as _intersection, register as _register, queueEffect as _queueEffect, value as _value, closure as _closure, createRenderer as _createRenderer, loopOf as _loopOf, inLoopScope as _inLoopScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_selected_num$forBody = /* @__PURE__ */_intersection(2, _scope => { + const { + _: { + selected + }, + num + } = _scope; + _attr(_scope["#button/0"], "data-selected", selected === num); + _attr(_scope["#button/0"], "data-multiple", num % selected === 0); +}); +const _num$forBody_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/template.marko_1_num", _scope => _on(_scope["#button/0"], "click", function () { + const { + num + } = _scope; + _queueSource(_scope._, _selected, num); +})); +const _num$forBody = /* @__PURE__ */_value("num", (_scope, num) => { + _data(_scope["#text/1"], num); + _queueEffect(_scope, _num$forBody_effect); +}, _expr_selected_num$forBody); +const _selected$forBody = /* @__PURE__ */_closure("selected", null, void 0, _expr_selected_num$forBody); +const _forBody = /* @__PURE__ */_createRenderer("", /* get, next(1), get */" D ", void 0, [_selected$forBody], void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let num; + if (!_clean) ({ + value: [num] + } = _destructure); + _num$forBody(_scope, num, _clean); +}); +const _for = /* @__PURE__ */_loopOf("#text/0", _forBody); +const _selected = /* @__PURE__ */_value("selected", null, _inLoopScope(_selected$forBody, "#text/0")); +const _setup = _scope => { + _selected(_scope, 0); + _for(_scope, [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]); +}; +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/basic-nested-scope-for/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..40c1584252 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/__snapshots__/html.expected/template.js @@ -0,0 +1,19 @@ +import { attr as _attr, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const selected = 0; + for (const num of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) { + const _scope1_id = _nextScopeId(); + _write(`${_escapeXML(num)}${_markResumeNode(_scope1_id, "#text/1")}${_markResumeNode(_scope1_id, "#button/0")}`); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/template.marko_1_num"); + _writeScope(_scope1_id, { + "num": num, + "_": _serializedScope(_scope0_id) + }); + _maybeFlush(); + } + _writeScope(_scope0_id, { + "selected": selected + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-for/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-for/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-for/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-for/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-for/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..c5b8b99ae6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/dom.expected/template.js @@ -0,0 +1,25 @@ +import { on as _on, queueSource as _queueSource, data as _data, closure as _closure, createRenderer as _createRenderer, register as _register, queueEffect as _queueEffect, conditional as _conditional, inConditionalScope as _inConditionalScope, intersections as _intersections, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _clickCount$elseBody = /* @__PURE__ */_closure("clickCount", (_scope, clickCount) => _data(_scope["#text/0"], clickCount)); +const _elseBody = _register("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko_2_renderer", /* @__PURE__ */_createRenderer("The button was clicked times.", /* next(1), over(1), replace */"Db%", void 0, [_clickCount$elseBody])); +const _clickCount$ifBody_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko_1_clickCount", _scope => _on(_scope["#button/0"], "click", function () { + const { + _: { + clickCount + } + } = _scope; + _queueSource(_scope._, _clickCount, clickCount + 1); +})); +const _clickCount$ifBody = /* @__PURE__ */_closure("clickCount", (_scope, clickCount) => { + _data(_scope["#text/1"], clickCount); + _queueEffect(_scope, _clickCount$ifBody_effect); +}); +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko_1_renderer", /* @__PURE__ */_createRenderer("", /* get, next(1), get */" D ", void 0, [_clickCount$ifBody])); +const _if = /* @__PURE__ */_conditional("#text/0"); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => _if(_scope, clickCount < 3 ? _ifBody : _elseBody), _intersections([_inConditionalScope(_clickCount$ifBody, "#text/0"), _inConditionalScope(_clickCount$elseBody, "#text/0")]), _if); +const _setup = _scope => { + _clickCount(_scope, 0); +}; +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/basic-nested-scope-if/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..9eed9d12c7 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/__snapshots__/html.expected/template.js @@ -0,0 +1,32 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const clickCount = 0; + _write("
      "); + let _ifScopeId, _scope1_, _ifRenderer; + if (clickCount < 3) { + const _scope1_id = _nextScopeId(); + _write(`${_markResumeNode(_scope1_id, "#button/0")}`); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko_1_clickCount"); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } else { + const _scope2_id = _nextScopeId(); + _write(`The button was clicked ${_escapeXML(clickCount)}${_markResumeNode(_scope2_id, "#text/0")} times.`); + _writeScope(_scope2_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko_2_renderer"); + _ifScopeId = _scope2_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _ifScopeId)}
      `); + _writeScope(_scope0_id, { + "clickCount": clickCount, + "#text/0!": _scope1_, + "#text/0(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-if/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-if/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-nested-scope-if/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-nested-scope-if/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-nested-scope-if/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..104f462b1d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/dom.expected/template.js @@ -0,0 +1,46 @@ +import { data as _data, on as _on, queueSource as _queueSource, value as _value, createRenderer as _createRenderer, register as _register, queueEffect as _queueEffect, intersection as _intersection, loopOf as _loopOf, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _item$forBody = /* @__PURE__ */_value("item", (_scope, item) => _data(_scope["#text/0"], item)); +const _forBody = /* @__PURE__ */_createRenderer(" ", /* get */" ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let item; + if (!_clean) ({ + value: [item] + } = _destructure); + _item$forBody(_scope, item, _clean); +}); +const _expr_id_items_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko_0_id_items", _scope => _on(_scope["#button/1"], "click", function () { + const { + id, + items + } = _scope; + // TODO: nested writes ([...items, id++]) don't work + const nextId = id + 1; + _queueSource(_scope, _id, nextId); + _queueSource(_scope, _items, [...items, nextId]); +})); +const _expr_id_items = /* @__PURE__ */_intersection(2, _scope => { + const { + id, + items + } = _scope; + _queueEffect(_scope, _expr_id_items_effect); +}); +const _for = /* @__PURE__ */_loopOf("#text/0", _forBody); +const _items_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko_0_items", _scope => _on(_scope["#button/2"], "click", function () { + const { + items + } = _scope; + _queueSource(_scope, _items, items.slice(0, -1)); +})); +const _items = /* @__PURE__ */_value("items", (_scope, items) => { + _queueEffect(_scope, _items_effect); + _for(_scope, [items]); +}, _expr_id_items); +const _id = /* @__PURE__ */_value("id", null, _expr_id_items); +const _setup = _scope => { + _id(_scope, 0); + _items(_scope, []); +}; +export const template = "
      "; +export const walks = /* next(1), replace, over(1), get, over(1), get, out(1) */"D%b b l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..d49c08bbb6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/html.expected/template.js @@ -0,0 +1,29 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, writeEffect as _writeEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const id = 0; + const items = []; + _write("
      "); + const _forScopeIds = [], + _scope1_ = new Map(); + let _i2 = 0; + for (const item of items) { + const _scope1_id = _nextScopeId(); + let _i = _i2++; + _forScopeIds.push(_scope1_id); + _write(`${_escapeXML(item)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, (_s => (_scope1_.set(_i, _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _forScopeIds)}${_markResumeNode(_scope0_id, "#button/1")}${_markResumeNode(_scope0_id, "#button/2")}
      `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko_0_items"); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko_0_id_items"); + _writeScope(_scope0_id, { + "id": id, + "items": items, + "#text/0(": _scope1_.size ? _scope1_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..b1de2ccc7f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/resume.expected.md @@ -0,0 +1,172 @@ +# Render {} +```html + + + +
      + + + + + +
      + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("#add").click() + +```html + + + +
      + 1 + + + + +
      + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#text0 +removed #comment before #document/html0/body1/div0/#text0 +``` + + +# Render +container.querySelector("#add").click() + +```html + + + +
      + 12 + + + + +
      + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#text1 +``` + + +# Render +container.querySelector("#remove").click() + +```html + + + +
      + 1 + + + + +
      + + + +``` + +# Mutations +``` +removed #text after #document/html0/body1/div0/#text0 +``` + + +# Render +container.querySelector("#add").click() + +```html + + + +
      + 13 + + + + +
      + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#text1 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..d18b2953e8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/__snapshots__/ssr.expected.md @@ -0,0 +1,47 @@ +# Write +
      + + +# Render "End" +```html + + + +
      + + + + + +
      + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/div0/#comment0 +inserted #document/html0/body1/div0/button1 +inserted #document/html0/body1/div0/button1/#text0 +inserted #document/html0/body1/div0/#comment2 +inserted #document/html0/body1/div0/button3 +inserted #document/html0/body1/div0/button3/#text0 +inserted #document/html0/body1/div0/#comment4 +inserted #document/html0/body1/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-push-pop-list/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-push-pop-list/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-push-pop-list/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-push-pop-list/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-push-pop-list/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..b37def6868 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/__snapshots__/dom.expected/template.js @@ -0,0 +1,19 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _clickCount_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/template.marko_0_clickCount", _scope => _on(_scope["#button/0"], "click", function () { + const { + clickCount + } = _scope; + _queueSource(_scope, _clickCount, clickCount + 1); +})); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => { + const doubleCount = clickCount * 2; + _queueEffect(_scope, _clickCount_effect); +}); +const _setup = _scope => { + _data(_scope["#text/1"], doubleCount); + _clickCount(_scope, 0); +}; +export const template = "
      "; +export const walks = /* next(1), get, next(1), get, out(2) */"D D m"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..0cbffefde9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/__snapshots__/html.expected/template.js @@ -0,0 +1,12 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const clickCount = 0; + const doubleCount = clickCount * 2; + _write(`
      ${_markResumeNode(_scope0_id, "#button/0")}
      `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/template.marko_0_clickCount"); + _writeScope(_scope0_id, { + "clickCount": clickCount + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-scriptlet/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-scriptlet/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-scriptlet/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-scriptlet/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-scriptlet/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..0617d83b77 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/dom.expected/template.js @@ -0,0 +1,40 @@ +import { attr as _attr, data as _data, on as _on, queueSource as _queueSource, value as _value, createRenderer as _createRenderer, loopOf as _loopOf, register as _register, queueEffect as _queueEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x$forBody = /* @__PURE__ */_value("x", (_scope, x) => _data(_scope["#text/0"], x)); +const _forBody = /* @__PURE__ */_createRenderer("
    • ", /* next(1), get */"D ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let x; + if (!_clean) ({ + value: [x] + } = _destructure); + _x$forBody(_scope, x, _clean); +}); +const _ul_for = /* @__PURE__ */_loopOf("#ul/0", _forBody); +const _list_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko_0_list", _scope => _on(_scope["#button/2"], "click", function () { + const { + list + } = _scope; + _queueSource(_scope, _list, [].concat(list).reverse()); +})); +const _list = /* @__PURE__ */_value("list", (_scope, list) => { + _queueEffect(_scope, _list_effect); + _ul_for(_scope, [list, function (x) { + return x; + }]); +}); +const _open_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko_0_open", _scope => _on(_scope["#button/1"], "click", function () { + const { + open + } = _scope; + _queueSource(_scope, _open, !open); +})); +const _open = /* @__PURE__ */_value("open", (_scope, open) => { + _attr(_scope["#ul/0"], "hidden", !open); + _queueEffect(_scope, _open_effect); +}); +const _setup = _scope => { + _open(_scope, true); + _list(_scope, [1, 2, 3]); +}; +export const template = "
        "; +export const walks = /* get, over(1), get, over(1), get, over(1) */" b b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..e6a8036f92 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/html.expected/template.js @@ -0,0 +1,32 @@ +import { attr as _attr, write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, writeEffect as _writeEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const open = true; + const list = [1, 2, 3]; + _write(``); + const _forScopeIds = [], + _scope1_ = new Map(); + const _by = function (x) { + return x; + }; + let _i2 = 0; + for (const x of list) { + const _scope1_id = _nextScopeId(); + let _i = _i2++; + _forScopeIds.push(_scope1_id); + _write(`
      • ${_escapeXML(x)}${_markResumeNode(_scope1_id, "#text/0")}
      • `); + _writeScope(_scope1_id, (_s => (_scope1_.set(_by(x, _i), _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#ul/0", _forScopeIds)}${_markResumeNode(_scope0_id, "#ul/0")}${_markResumeNode(_scope0_id, "#button/1")}${_markResumeNode(_scope0_id, "#button/2")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko_0_list"); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko_0_open"); + _writeScope(_scope0_id, { + "open": open, + "list": list, + "#ul/0(": _scope1_.size ? _scope1_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..bed2833fe2 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/resume.expected.md @@ -0,0 +1,193 @@ +# Render {} +```html + + + +
          +
        • + 1 + +
        • +
        • + 2 + +
        • +
        • + 3 + +
        • + +
        + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("#toggle").click() + +```html + + + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/ul0: attr(hidden) null => "" +``` + + +# Render +container.querySelector("#toggle").click() + +```html + + + +
          +
        • + 1 + +
        • +
        • + 2 + +
        • +
        • + 3 + +
        • + +
        + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/ul0: attr(hidden) "" => null +``` + + +# Render +container.querySelector("#reverse").click() + +```html + + + +
          +
        • + 3 + +
        • +
        • + 2 + +
        • +
        • + 1 + +
        • + +
        + + + + + + + + +``` + +# Mutations +``` +removed #document/html0/body1/ul0/li1 after #document/html0/body1/ul0/li2 +inserted #document/html0/body1/ul0/li1 +removed #document/html0/body1/ul0/li0 after #document/html0/body1/ul0/li2 +inserted #document/html0/body1/ul0/li0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..f334f41d25 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/__snapshots__/ssr.expected.md @@ -0,0 +1,70 @@ +# Write +
        • 1
        • 2
        • 3
        + + +# Render "End" +```html + + + +
          +
        • + 1 + +
        • +
        • + 2 + +
        • +
        • + 3 + +
        • + +
        + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/ul0 +inserted #document/html0/body1/ul0/li0 +inserted #document/html0/body1/ul0/li0/#text0 +inserted #document/html0/body1/ul0/li0/#comment1 +inserted #document/html0/body1/ul0/li1 +inserted #document/html0/body1/ul0/li1/#text0 +inserted #document/html0/body1/ul0/li1/#comment1 +inserted #document/html0/body1/ul0/li2 +inserted #document/html0/body1/ul0/li2/#text0 +inserted #document/html0/body1/ul0/li2/#comment1 +inserted #document/html0/body1/ul0/#comment3 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/button2 +inserted #document/html0/body1/button2/#text0 +inserted #document/html0/body1/#comment3 +inserted #document/html0/body1/button4 +inserted #document/html0/body1/button4/#text0 +inserted #document/html0/body1/#comment5 +inserted #document/html0/body1/script6 +inserted #document/html0/body1/script6/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-shared-node-ref/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-shared-node-ref/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-shared-node-ref/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-shared-node-ref/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-shared-node-ref/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..67cf70e021 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/dom.expected/template.js @@ -0,0 +1,6 @@ +const x = 1; +export const template = "
        1
        "; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-static/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..905c987d0d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/html.expected/template.js @@ -0,0 +1,7 @@ +const x = 1; +import { 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(); + _write("
        1
        "); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-static/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-static/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-static/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-static/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-static/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-static/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-static/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..bc5895f4ab --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/dom.expected/template.js @@ -0,0 +1,20 @@ +import { on as _on, queueSource as _queueSource, createRenderer as _createRenderer, register as _register, conditional as _conditional, queueEffect as _queueEffect, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/template.marko_1_renderer", /* @__PURE__ */_createRenderer("Hello!", "")); +const _if = /* @__PURE__ */_conditional("#text/0"); +const _show_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/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); + _if(_scope, show ? _ifBody : null); +}); +const _setup = _scope => { + _show(_scope, true); +}; +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/basic-toggle-show/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..b72f4211ef --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/html.expected/template.js @@ -0,0 +1,24 @@ +import { write as _write, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, markResumeNode as _markResumeNode, 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("
        "); + let _ifScopeId, _scope1_, _ifRenderer; + if (show) { + const _scope1_id = _nextScopeId(); + _write("Hello!"); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _ifScopeId)}${_markResumeNode(_scope0_id, "#button/1")}
        `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/template.marko_0_show"); + _writeScope(_scope0_id, { + "show": show, + "#text/0!": _scope1_, + "#text/0(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..a827d47584 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/resume.expected.md @@ -0,0 +1,109 @@ +# Render {} +```html + + + +
        + Hello! + + + +
        + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + + +
        + + + +``` + +# Mutations +``` +removed #document/html0/body1/div0/#comment0 after #text +inserted #document/html0/body1/div0/#comment0 +removed #text after #document/html0/body1/div0/#comment0 +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + Hello! + + +
        + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#text0 +removed #comment after #document/html0/body1/div0/#text0 +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + + +
        + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#comment0 +removed #text after #document/html0/body1/div0/#comment0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-toggle-show/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..df928d6cf9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/__snapshots__/ssr.expected.md @@ -0,0 +1,38 @@ +# Write +
        Hello!
        + + +# Render "End" +```html + + + +
        + Hello! + + + +
        + + + +``` + +# 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/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/src/__tests__/fixtures/basic-toggle-show/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-toggle-show/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-toggle-show/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-toggle-show/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-toggle-show/test.ts diff --git a/packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..cf4ca400a6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/dom.expected/template.js @@ -0,0 +1,22 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _clickCount_effect = _register("packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/template.marko_0_clickCount", _scope => _on(_scope["#button/0"], "click", function () { + const { + clickCount + } = _scope; + _queueSource(_scope, _clickCount, clickCount + 1); +})); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => { + _data(_scope["#text/1"], clickCount); + _queueEffect(_scope, _clickCount_effect); +}); +const _unused_2 = (_scope, unused_2) => {}; +const _unused_ = (_scope, unused_1) => {}; +const _setup = _scope => { + _unused_(_scope, 123); + _unused_2(_scope, 456); + _clickCount(_scope, 0); +}; +export const template = "
        "; +export const walks = /* next(1), get, next(1), get, out(2) */"D D m"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..cf2bc49bb3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const unused_1 = 123; + const unused_2 = 456; + const clickCount = 0; + _write(`
        ${_markResumeNode(_scope0_id, "#button/0")}
        `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/template.marko_0_clickCount"); + _writeScope(_scope0_id, { + "clickCount": clickCount + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..122736a7b3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/resume.expected.md @@ -0,0 +1,104 @@ +# Render {} +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "2" => "3" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-unused-ref/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..75cca8070b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/__snapshots__/ssr.expected.md @@ -0,0 +1,36 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +inserted #document/html0/body1/div0/button0/#comment1 +inserted #document/html0/body1/div0/#comment1 +inserted #document/html0/body1/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/basic-unused-ref/template.marko b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-unused-ref/template.marko rename to packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/template.marko diff --git a/packages/translator/src/__tests__/fixtures/basic-unused-ref/test.ts b/packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/basic-unused-ref/test.ts rename to packages/translator-tags/src/__tests__/fixtures/basic-unused-ref/test.ts diff --git a/packages/translator/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f31d9a1c2e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/dom.expected/template.js @@ -0,0 +1,24 @@ +import { on as _on, queueSource as _queueSource, data as _data, closure as _closure, createRenderer as _createRenderer, register as _register, conditional as _conditional, inConditionalScope as _inConditionalScope, value as _value, queueEffect as _queueEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _message$ifBody = /* @__PURE__ */_closure("message", (_scope, message) => _data(_scope["#text/0"], message)); +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/template.marko_1_renderer", /* @__PURE__ */_createRenderer(" ", /* next(1), get */"D ", void 0, [_message$ifBody])); +const _if = /* @__PURE__ */_conditional("#text/1"); +const _message = /* @__PURE__ */_value("message", null, _inConditionalScope(_message$ifBody, "#text/1")); +const _show_effect = _register("packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/template.marko_0_show", _scope => _on(_scope["#button/0"], "click", function () { + const { + show + } = _scope; + _queueSource(_scope, _message, "bye"); + _queueSource(_scope, _show, !show); +})); +const _show = /* @__PURE__ */_value("show", (_scope, show) => { + _queueEffect(_scope, _show_effect); + _if(_scope, show ? _ifBody : null); +}, void 0, _if); +const _setup = _scope => { + _show(_scope, true); + _message(_scope, "hi"); +}; +export const template = ""; +export const walks = /* get, over(1), replace, over(1) */" b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..c24bca61c3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/html.expected/template.js @@ -0,0 +1,25 @@ +import { markResumeNode as _markResumeNode, write as _write, escapeXML as _escapeXML, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, 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; + const message = "hi"; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + let _ifScopeId, _scope1_, _ifRenderer; + if (show) { + const _scope1_id = _nextScopeId(); + _write(`${_escapeXML(message)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/1", _ifScopeId)}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/template.marko_0_show"); + _writeScope(_scope0_id, { + "show": show, + "#text/1!": _scope1_, + "#text/1(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..fe534b8527 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/batched-updates-cleanup/__snapshots__/resume.expected.md @@ -0,0 +1,48 @@ +# Render {} +```html + + + + hi + + +# Render "End" +```html + + + + "; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/batched-updates/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..0c87e2e14d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const a = 0; + const b = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/batched-updates/template.marko_0_a_b"); + _writeScope(_scope0_id, { + "a": a, + "b": b + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/batched-updates/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/batched-updates/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/batched-updates/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..e8dbc25f19 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/resume.expected.md @@ -0,0 +1,46 @@ +# Render {} +```html + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "0" => "2" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/batched-updates/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/batched-updates/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..0e514127e9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/batched-updates/__snapshots__/ssr.expected.md @@ -0,0 +1,33 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/batched-updates/template.marko b/packages/translator-tags/src/__tests__/fixtures/batched-updates/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/batched-updates/template.marko rename to packages/translator-tags/src/__tests__/fixtures/batched-updates/template.marko diff --git a/packages/translator/src/__tests__/fixtures/batched-updates/test.ts b/packages/translator-tags/src/__tests__/fixtures/batched-updates/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/batched-updates/test.ts rename to packages/translator-tags/src/__tests__/fixtures/batched-updates/test.ts diff --git a/packages/translator/src/__tests__/fixtures/body-content/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/body-content/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/body-content/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/body-content/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/csr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/body-content/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/body-content/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/body-content/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/body-content/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/body-content/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/body-content/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/body-content/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/body-content/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/body-content/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/body-content/browser.ts b/packages/translator-tags/src/__tests__/fixtures/body-content/browser.ts new file mode 100644 index 0000000000..88e3ab3984 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/body-content/browser.ts @@ -0,0 +1,145 @@ +import { + type Scope, + bindFunction, + bindRenderer, + conditional, + createRenderer, + createTemplate, + data, + dynamicClosure, + dynamicSubscribers, + on, + queueEffect, + queueSource, + value, +} from "@marko/runtime-tags/src/dom"; +import { beginChild, endChild, get, next } from "../../utils/walks"; + +//////////////////////////////////////////////////// +// FancyButton +//////////////////////////////////////////////////// +// +// + +const enum FancyButton$Index { + BUTTON = "#button/0", + COMMENT = "#comment/1", + RENDER_BODY = "renderBody", + ON_CLICK = "onClick", +} + +type FancyButton$ComponentScope = Scope<{ + [FancyButton$Index.BUTTON]: HTMLButtonElement; + [FancyButton$Index.COMMENT]: Comment; + [FancyButton$Index.RENDER_BODY]: any; + [FancyButton$Index.ON_CLICK]: (e: Event) => void; +}>; + +const FancyButton$template = ``; +const FancyButton$walks = get + next(1) + get + next(1); + +export const FancyButton$attrs = ( + scope: Scope, + value: any, + clean?: boolean | 1, +) => { + let renderBody, onclick; + if (!clean) { + ({ renderBody, onclick } = value); + } + FancyButton$renderBody(scope, renderBody, clean); + FancyButton$onclick(scope, onclick, clean); +}; + +const FancyButton$renderBodyDynamicTag = conditional(FancyButton$Index.COMMENT); + +const FancyButton$renderBody = value( + FancyButton$Index.RENDER_BODY, + (scope, value: any) => { + FancyButton$renderBodyDynamicTag(scope, value); + }, + undefined, + FancyButton$renderBodyDynamicTag, +); + +const FancyButton$onclick = value(FancyButton$Index.ON_CLICK, (_scope) => { + queueEffect(_scope, FancyButton$onclick_effect); +}); + +export const FancyButton$onclick_effect = (scope: Scope) => { + const onclick = scope[FancyButton$Index.ON_CLICK]; + + on(scope[FancyButton$Index.BUTTON], "click", onclick); +}; + +export const FancyButton = createTemplate( + createRenderer( + FancyButton$template, + FancyButton$walks, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + FancyButton$attrs, + ), +); + +///////////////////////// +// Main +///////////////////////// +// +// ${input.clickCount} + +const enum Index { + FANCYBUTTON_SCOPE = "#childScope/0", + CLICK_COUNT = "clickCount", +} + +type ComponentScope = Scope<{ + [Index.CLICK_COUNT]: number; + [Index.FANCYBUTTON_SCOPE]: FancyButton$ComponentScope; +}>; + +export const template = `${FancyButton$template}`; +export const walks = `${beginChild}${FancyButton$walks}${endChild}`; + +export const setup = (scope: Scope) => { + _clickCount(scope, 0); + FancyButton$attrs(scope[Index.FANCYBUTTON_SCOPE], { + onclick: bindFunction(scope, clickHandler), + renderBody: bindRenderer(scope, renderBody), + }); +}; + +const _clickCount = value( + Index.CLICK_COUNT, + undefined, + dynamicSubscribers(Index.CLICK_COUNT), +); + +export const clickHandler = (scope: Scope) => { + queueSource(scope, _clickCount, scope[Index.CLICK_COUNT] + 1); +}; + +export const clickCount$renderBody = dynamicClosure( + Index.CLICK_COUNT, + (scope: Scope, value: ComponentScope[Index.CLICK_COUNT]) => { + data(scope[RenderBody$Index.TEXT], value); + }, +); + +const enum RenderBody$Index { + TEXT = "#text/0", +} + +// type RenderBody$Scope = Scope<{ +// [RenderBody$Index.TEXT]: Text; +// }>; + +const renderBody = createRenderer(" ", get + next(1), undefined, [ + clickCount$renderBody, +]); + +export default createTemplate(createRenderer(template, walks, setup)); diff --git a/packages/translator/src/__tests__/fixtures/body-content/resume.ts b/packages/translator-tags/src/__tests__/fixtures/body-content/resume.ts similarity index 89% rename from packages/translator/src/__tests__/fixtures/body-content/resume.ts rename to packages/translator-tags/src/__tests__/fixtures/body-content/resume.ts index 88f49b848b..956c0048d6 100644 --- a/packages/translator/src/__tests__/fixtures/body-content/resume.ts +++ b/packages/translator-tags/src/__tests__/fixtures/body-content/resume.ts @@ -2,7 +2,7 @@ import { init, register, registerSubscriber, -} from "@marko/runtime-fluurt/src/dom"; +} from "@marko/runtime-tags/src/dom"; import { FancyButton$onclick_effect, clickCount$renderBody, diff --git a/packages/translator-tags/src/__tests__/fixtures/body-content/server.ts b/packages/translator-tags/src/__tests__/fixtures/body-content/server.ts new file mode 100644 index 0000000000..9fbdaffe7d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/body-content/server.ts @@ -0,0 +1,65 @@ +import { + createTemplate, + markResumeNode, + nextScopeId, + register, + write, + writeEffect, + writeScope, +} from "@marko/runtime-tags/src/html"; + +export default createTemplate(() => { + write(""); + counter(); + write(""); +}); + +///////////////////////// +// Main +///////////////////////// +// +// ${clickCount} + +const counter = () => { + const clickCount = 0; + const scopeId = nextScopeId(); + const scope = { clickCount }; + + FancyButton({ + renderBody() { + const bodyScopeId = nextScopeId(); + write(`${clickCount}${markResumeNode(bodyScopeId, "#text/0")}`); + writeScope(bodyScopeId, { _: scope }); + writeEffect(bodyScopeId, "subscribe_clickCount$renderBody"); + }, + onClick: register(() => {}, "clickHandler", scopeId), + }); + + // eslint-disable-next-line no-sparse-arrays + writeScope(scopeId, scope); +}; + +//////////////////////////////////////////////////// +// FancyButton +//////////////////////////////////////////////////// +// +// + +const FancyButton = ({ + renderBody, + onClick, +}: { + renderBody(): void; + onClick(): void; +}) => { + const scopeId = nextScopeId(); + + write(`${markResumeNode(scopeId, "#button/0")}`); + + writeScope(scopeId, { onClick }); + writeEffect(scopeId, "FancyButton$onclick_effect"); +}; diff --git a/packages/translator/src/__tests__/fixtures/body-content/test.ts b/packages/translator-tags/src/__tests__/fixtures/body-content/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/body-content/test.ts rename to packages/translator-tags/src/__tests__/fixtures/body-content/test.ts diff --git a/packages/translator/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/server.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/server.ts new file mode 100644 index 0000000000..56bfc501d1 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/server.ts @@ -0,0 +1,26 @@ +import { + createTemplate, + fork, + tryCatch, + write, +} from "@marko/runtime-tags/src/html"; +import { rejectAfter, resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + tryCatch( + () => { + write("b"); + fork(rejectAfter(new Error("ERROR!"), 2), write); + write("d"); + }, + (err) => { + write(err.message); + }, + ); + write("e"); + fork(resolveAfter("f", 1), write); + write("g"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/catch-single-reject-async/test.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-reject-async/test.ts rename to packages/translator-tags/src/__tests__/fixtures/catch-single-reject-async/test.ts diff --git a/packages/translator/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/server.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/server.ts new file mode 100644 index 0000000000..ca79d68ccc --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/server.ts @@ -0,0 +1,26 @@ +import { + createTemplate, + fork, + tryCatch, + write, +} from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + tryCatch( + () => { + write("b"); + fork(resolveAfter("c", 2), write); + write("d"); + }, + () => { + write("ERROR!"); + }, + ); + write("f"); + fork(resolveAfter("g", 1), write); + write("h"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/catch-single-success-async/test.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-success-async/test.ts rename to packages/translator-tags/src/__tests__/fixtures/catch-single-success-async/test.ts diff --git a/packages/translator/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/server.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/server.ts new file mode 100644 index 0000000000..64dca668c5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/server.ts @@ -0,0 +1,16 @@ +import { createTemplate, tryCatch, write } from "@marko/runtime-tags/src/html"; + +const renderer = () => { + write("a"); + tryCatch( + () => { + write("b"); + }, + () => { + write("ERROR!"); + }, + ); + write("c"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/catch-single-success-sync/test.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-success-sync/test.ts rename to packages/translator-tags/src/__tests__/fixtures/catch-single-success-sync/test.ts diff --git a/packages/translator/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/server.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/server.ts new file mode 100644 index 0000000000..9c4f67d616 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/server.ts @@ -0,0 +1,17 @@ +import { createTemplate, tryCatch, write } from "@marko/runtime-tags/src/html"; + +const renderer = () => { + write("a"); + tryCatch( + () => { + write("b"); + throw new Error("ERROR!"); + }, + (err) => { + write(err.message); + }, + ); + write("d"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/catch-single-throw-sync/test.ts b/packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/catch-single-throw-sync/test.ts rename to packages/translator-tags/src/__tests__/fixtures/catch-single-throw-sync/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/cdata/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/cdata/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..006836ab90 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/cdata/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "
        Here is a CDATA section: with all kinds of unescaped text.
        "; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/cdata/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/cdata/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/cdata/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..9fed5cb11f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/cdata/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
        Here is a CDATA section: & ]]> with all kinds of unescaped text.
        "); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/cdata/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/cdata/template.marko b/packages/translator-tags/src/__tests__/fixtures/cdata/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/cdata/template.marko rename to packages/translator-tags/src/__tests__/fixtures/cdata/template.marko diff --git a/packages/translator/src/__tests__/fixtures/cdata/test.ts b/packages/translator-tags/src/__tests__/fixtures/cdata/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/cdata/test.ts rename to packages/translator-tags/src/__tests__/fixtures/cdata/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/comments/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/comments/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f12f1cb5d3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/comments/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "
        "; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/comments/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/comments/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/comments/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..87f08305cb --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/comments/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
        "); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/comments/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/comments/template.marko b/packages/translator-tags/src/__tests__/fixtures/comments/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/comments/template.marko rename to packages/translator-tags/src/__tests__/fixtures/comments/template.marko diff --git a/packages/translator/src/__tests__/fixtures/comments/test.ts b/packages/translator-tags/src/__tests__/fixtures/comments/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/comments/test.ts rename to packages/translator-tags/src/__tests__/fixtures/comments/test.ts diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/components/counter.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/components/counter.js new file mode 100644 index 0000000000..c4ff46fbb6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/components/counter.js @@ -0,0 +1,25 @@ +import { on as _on, queueSource as _queueSource, data as _data, intersection as _intersection, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_input_count = /* @__PURE__ */_intersection(2, _scope => { + const { + input, + count + } = _scope; + _data(_scope["#text/1"], input.format(count)); +}); +const _count_effect = _register("packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/components/counter.marko_0_count", _scope => _on(_scope["#button/0"], "click", function () { + const { + count + } = _scope; + _queueSource(_scope, _count, count + 1); +})); +const _count = /* @__PURE__ */_value("count", (_scope, count) => _queueEffect(_scope, _count_effect), _expr_input_count); +const _input = /* @__PURE__ */_value("input", null, _expr_input_count); +const _setup = _scope => { + _count(_scope, 0); +}; +export const attrs = _input; +export { _input }; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +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/component-attrs-import-value/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/components/display-intersection.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/components/display-intersection.js new file mode 100644 index 0000000000..1b1e1f148b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/components/display-intersection.js @@ -0,0 +1,25 @@ +import { data as _data, intersection as _intersection, value as _value2, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_value_dummy = /* @__PURE__ */_intersection(2, _scope => { + const { + value, + dummy + } = _scope; + _data(_scope["#text/0"], (dummy, value)); +}); +const _dummy = /* @__PURE__ */_value2("dummy", null, _expr_value_dummy); +const _value = /* @__PURE__ */_value2("value", null, _expr_value_dummy); +const _setup = _scope => { + _dummy(_scope, {}); +}; +export const attrs = (_scope, _destructure, _clean) => { + let value; + if (!_clean) ({ + value + } = _destructure); + _value(_scope, value, _clean); +}; +export { _value }; +export const template = "
        "; +export const walks = /* next(1), get, out(1) */"D l"; +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/component-attrs-intersection/components/display-intersection.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..0f7de6729c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/dom.expected/template.js @@ -0,0 +1,13 @@ +import { formatNumber } from "./helpers"; +import { setup as _counter, attrs as _counter_attrs, template as _counter_template, walks as _counter_walks } from "./components/counter.marko"; +import { inChild as _inChild, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup = _scope => { + _counter(_scope["#childScope/0"]); + _counter_attrs(_scope["#childScope/0"], { + format: formatNumber + }); +}; +export const template = `${_counter_template}`; +export const walks = /* beginChild, _counter_walks, endChild */`/${_counter_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/components/counter.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/components/counter.js new file mode 100644 index 0000000000..f8cf13bf2b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/components/counter.js @@ -0,0 +1,12 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const count = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/components/counter.marko_0_count"); + _writeScope(_scope0_id, { + "input": input, + "count": count + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/components/display-intersection.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/components/display-intersection.js new file mode 100644 index 0000000000..92537f201b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/components/display-intersection.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, nextScopeId as _nextScopeId, writeScope as _writeScope, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + value +}, _tagVar, _scope0_) => { + const _scope0_id = _nextScopeId(); + const dummy = {}; + _write(`
        ${_escapeXML((dummy, value))}${_markResumeNode(_scope0_id, "#text/0")}
        `); + _writeScope(_scope0_id, { + "value": value, + "dummy": dummy + }, _scope0_); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/components/display-intersection.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..4817b122d5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/html.expected/template.js @@ -0,0 +1,10 @@ +import { formatNumber } from "./helpers"; +import _counter from "./components/counter.marko"; +import { 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(); + _counter._({ + format: formatNumber + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..fc842a87a9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/__snapshots__/ssr.expected.md @@ -0,0 +1,33 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-import-value/components/counter.marko b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/components/counter.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-import-value/components/counter.marko rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/components/counter.marko diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-import-value/helpers.ts b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/helpers.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-import-value/helpers.ts rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/helpers.ts diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-import-value/template.marko b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-import-value/template.marko rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/template.marko diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-import-value/test.ts b/packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-import-value/test.ts rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-import-value/test.ts diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/dom.expected/components/display-intersection.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/dom.expected/components/display-intersection.js new file mode 100644 index 0000000000..1b1e1f148b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/dom.expected/components/display-intersection.js @@ -0,0 +1,25 @@ +import { data as _data, intersection as _intersection, value as _value2, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_value_dummy = /* @__PURE__ */_intersection(2, _scope => { + const { + value, + dummy + } = _scope; + _data(_scope["#text/0"], (dummy, value)); +}); +const _dummy = /* @__PURE__ */_value2("dummy", null, _expr_value_dummy); +const _value = /* @__PURE__ */_value2("value", null, _expr_value_dummy); +const _setup = _scope => { + _dummy(_scope, {}); +}; +export const attrs = (_scope, _destructure, _clean) => { + let value; + if (!_clean) ({ + value + } = _destructure); + _value(_scope, value, _clean); +}; +export { _value }; +export const template = "
        "; +export const walks = /* next(1), get, out(1) */"D l"; +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/component-attrs-intersection/components/display-intersection.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..d2539091fe --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/dom.expected/template.js @@ -0,0 +1,22 @@ +import { setup as _displayIntersection, attrs as _displayIntersection_attrs, template as _displayIntersection_template, walks as _displayIntersection_walks } from "./components/display-intersection.marko"; +import { inChild as _inChild, on as _on, queueSource as _queueSource, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _count_effect = _register("packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/template.marko_0_count", _scope => _on(_scope["#button/1"], "click", function () { + const { + count + } = _scope; + _queueSource(_scope, _count, count + 1); +})); +const _count = /* @__PURE__ */_value("count", (_scope, count) => { + _queueEffect(_scope, _count_effect); + _displayIntersection_attrs(_scope["#childScope/0"], { + value: count + }); +}, void 0, _inChild("#childScope/0", _displayIntersection_attrs)); +const _setup = _scope => { + _displayIntersection(_scope["#childScope/0"]); + _count(_scope, 0); +}; +export const template = `${_displayIntersection_template}`; +export const walks = /* beginChild, _displayIntersection_walks, endChild, get, over(1) */`/${_displayIntersection_walks}& b`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/html.expected/components/display-intersection.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/html.expected/components/display-intersection.js new file mode 100644 index 0000000000..78b7defd9c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/html.expected/components/display-intersection.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + value +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + const dummy = {}; + _write(`
        ${_escapeXML((dummy, value))}${_markResumeNode(_scope0_id, "#text/0")}
        `); + _writeScope(_scope0_id, { + "value": value, + "dummy": dummy + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/components/display-intersection.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..89ddd042b5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/html.expected/template.js @@ -0,0 +1,15 @@ +import _displayIntersection from "./components/display-intersection.marko"; +import { markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const count = 0; + _displayIntersection._({ + value: count + }); + _write(`${_markResumeNode(_scope0_id, "#button/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/template.marko_0_count"); + _writeScope(_scope0_id, { + "count": count + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..7d2b14d4b6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/__snapshots__/ssr.expected.md @@ -0,0 +1,35 @@ +# Write +
        0
        + + +# Render "End" +```html + + + +
        + 0 + +
        + "; +export const walks = /* get, next(1), get, out(1) */" D l"; +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/component-attrs-static-code/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/dom.expected/components/display-intersection.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/dom.expected/components/display-intersection.js new file mode 100644 index 0000000000..1b1e1f148b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/dom.expected/components/display-intersection.js @@ -0,0 +1,25 @@ +import { data as _data, intersection as _intersection, value as _value2, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_value_dummy = /* @__PURE__ */_intersection(2, _scope => { + const { + value, + dummy + } = _scope; + _data(_scope["#text/0"], (dummy, value)); +}); +const _dummy = /* @__PURE__ */_value2("dummy", null, _expr_value_dummy); +const _value = /* @__PURE__ */_value2("value", null, _expr_value_dummy); +const _setup = _scope => { + _dummy(_scope, {}); +}; +export const attrs = (_scope, _destructure, _clean) => { + let value; + if (!_clean) ({ + value + } = _destructure); + _value(_scope, value, _clean); +}; +export { _value }; +export const template = "
        "; +export const walks = /* next(1), get, out(1) */"D l"; +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/component-attrs-intersection/components/display-intersection.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..2887e1034d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/dom.expected/template.js @@ -0,0 +1,15 @@ +const formatNumber = n => { + return "$" + n.toFixed(2); +}; +import { setup as _counter, attrs as _counter_attrs, template as _counter_template, walks as _counter_walks } from "./components/counter.marko"; +import { inChild as _inChild, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup = _scope => { + _counter(_scope["#childScope/0"]); + _counter_attrs(_scope["#childScope/0"], { + format: formatNumber + }); +}; +export const template = `${_counter_template}`; +export const walks = /* beginChild, _counter_walks, endChild */`/${_counter_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/components/counter.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/components/counter.js new file mode 100644 index 0000000000..643c7f6a5e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/components/counter.js @@ -0,0 +1,12 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const count = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/components/counter.marko_0_count"); + _writeScope(_scope0_id, { + "input": input, + "count": count + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/components/display-intersection.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/components/display-intersection.js new file mode 100644 index 0000000000..92537f201b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/components/display-intersection.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, nextScopeId as _nextScopeId, writeScope as _writeScope, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + value +}, _tagVar, _scope0_) => { + const _scope0_id = _nextScopeId(); + const dummy = {}; + _write(`
        ${_escapeXML((dummy, value))}${_markResumeNode(_scope0_id, "#text/0")}
        `); + _writeScope(_scope0_id, { + "value": value, + "dummy": dummy + }, _scope0_); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-intersection/components/display-intersection.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..81da3a9ab6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/html.expected/template.js @@ -0,0 +1,12 @@ +const formatNumber = n => { + return "$" + n.toFixed(2); +}; +import _counter from "./components/counter.marko"; +import { 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(); + _counter._({ + format: formatNumber + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..ec7da934d3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/__snapshots__/ssr.expected.md @@ -0,0 +1,33 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-static-code/components/counter.marko b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/components/counter.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-static-code/components/counter.marko rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/components/counter.marko diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-static-code/helpers.ts b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/helpers.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-static-code/helpers.ts rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/helpers.ts diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-static-code/template.marko b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-static-code/template.marko rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/template.marko diff --git a/packages/translator/src/__tests__/fixtures/component-attrs-static-code/test.ts b/packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-attrs-static-code/test.ts rename to packages/translator-tags/src/__tests__/fixtures/component-attrs-static-code/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/component-markers-async.skip/server.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-async.skip/server.ts new file mode 100644 index 0000000000..ed953b2d37 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-markers-async.skip/server.ts @@ -0,0 +1,21 @@ +import { createTemplate, fork, write } from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + firstComponent(); + secondComponent(); +}; + +const firstComponent = () => { + write("x"); + write("y"); + write("z"); +}; + +const secondComponent = () => { + write("a"); + fork(resolveAfter("b", 1), write); + fork(resolveAfter("c", 2), write); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/component-markers-async.skip/test.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-async.skip/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-markers-async.skip/test.ts rename to packages/translator-tags/src/__tests__/fixtures/component-markers-async.skip/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/component-markers-placeholder.skip/server.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-placeholder.skip/server.ts new file mode 100644 index 0000000000..2b60f949ea --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-markers-placeholder.skip/server.ts @@ -0,0 +1,46 @@ +import { + createTemplate, + fork, + tryPlaceholder, + write, +} from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + firstComponent(); + secondComponent(); +}; + +const firstComponent = () => { + write("a"); + tryPlaceholder( + () => { + write("b"); + fork(resolveAfter("c", 2), write); + write("d"); + }, + () => { + write("e..."); + }, + ); + write("e"); + fork(resolveAfter("f", 1), write); + write("g"); +}; + +const secondComponent = () => { + write("v"); + tryPlaceholder( + () => { + write("w"); + fork(resolveAfter("x", 2), write); + write("y"); + }, + () => { + write("z..."); + }, + ); + write("z"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/component-markers-placeholder.skip/test.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-placeholder.skip/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-markers-placeholder.skip/test.ts rename to packages/translator-tags/src/__tests__/fixtures/component-markers-placeholder.skip/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/component-markers-sibling-forks.skip/server.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-sibling-forks.skip/server.ts new file mode 100644 index 0000000000..43cced034e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-markers-sibling-forks.skip/server.ts @@ -0,0 +1,22 @@ +import { createTemplate, fork, write } from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + firstComponent(); + secondComponent(); + thirdComponent(); +}; + +const firstComponent = () => { + fork(resolveAfter("a", 3), write); +}; + +const secondComponent = () => { + fork(resolveAfter("b", 2), write); +}; + +const thirdComponent = () => { + fork(resolveAfter("c", 1), write); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/component-markers-sibling-forks.skip/test.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-sibling-forks.skip/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-markers-sibling-forks.skip/test.ts rename to packages/translator-tags/src/__tests__/fixtures/component-markers-sibling-forks.skip/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/component-markers-sync.skip/server.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-sync.skip/server.ts new file mode 100644 index 0000000000..f7f290c2f1 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/component-markers-sync.skip/server.ts @@ -0,0 +1,25 @@ +import { createTemplate, write } from "@marko/runtime-tags/src/html"; + +const renderer = () => { + firstComponent(); + secondComponent(); +}; + +const firstComponent = () => { + write("a"); + childComponent(); + write("d"); +}; + +const childComponent = () => { + write("b"); + write("c"); +}; + +const secondComponent = () => { + write("x"); + write("y"); + write("z"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/component-markers-sync.skip/test.ts b/packages/translator-tags/src/__tests__/fixtures/component-markers-sync.skip/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/component-markers-sync.skip/test.ts rename to packages/translator-tags/src/__tests__/fixtures/component-markers-sync.skip/test.ts diff --git a/packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..097a0cf847 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/dom.expected/template.js @@ -0,0 +1,21 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _y = /* @__PURE__ */_value("y", (_scope, y) => _data(_scope["#text/1"], y)); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _data(_scope["#text/0"], x)); +const _destructure2 = (_scope, { + x, + y +}) => { + _x(_scope, x); + _y(_scope, y); +}; +const _z = /* @__PURE__ */_value("z", (_scope, z) => _destructure2(_scope, z)); +const _setup = _scope => { + _z(_scope, { + x: 1, + y: 2 + }); +}; +export const template = "
        "; +export const walks = /* next(1), get, out(1), replace, over(1) */"D l%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..12001f6dd3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/html.expected/template.js @@ -0,0 +1,14 @@ +import { 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 z = { + x: 1, + y: 2 + }; + const { + x, + y + } = z; + _write(`
        ${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}
        ${_escapeXML(y)}${_markResumeNode(_scope0_id, "#text/1")}`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag-destructure/template.marko b/packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag-destructure/template.marko rename to packages/translator-tags/src/__tests__/fixtures/const-tag-destructure/template.marko diff --git a/packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..397d71962c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,11 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _y = /* @__PURE__ */_value("y", (_scope, y) => _data(_scope["#text/1"], y)); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _data(_scope["#text/0"], x)); +const _setup = _scope => { + _x(_scope, 1); + _y(_scope, 1); +}; +export const template = "
        "; +export const walks = /* next(1), get, out(1), replace, over(1) */"D l%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/const-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..80b909accf --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,8 @@ +import { 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 = 1; + const y = 1; + _write(`
        ${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}
        ${_escapeXML(y)}${_markResumeNode(_scope0_id, "#text/1")}`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/const-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/const-tag/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/const-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/const-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/const-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/const-tag/template.marko diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/csr.expected.md 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 new file mode 100644 index 0000000000..aec9f43be6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000000..0029a8a787 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/dom.expected/template.js @@ -0,0 +1,15 @@ +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 new file mode 100644 index 0000000000..1dad18435e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/components/child.js @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000000..2e43cf5cd7 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/html.expected/template.js @@ -0,0 +1,10 @@ +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/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-derivation/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-derivation/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-derivation/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-derivation/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-derivation/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-derivation/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-derivation/test.ts 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 new file mode 100644 index 0000000000..1e8a9679bc --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/dom.expected/template.js @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000000..096d9b5731 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/html.expected/template.js @@ -0,0 +1,10 @@ +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/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-global/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-global/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-global/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-global/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-global/test.ts 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 new file mode 100644 index 0000000000..4eae0fb1ea --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/other.js @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000000..201e6d323e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/__snapshots__/html.expected/template.js @@ -0,0 +1,14 @@ +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/src/__tests__/fixtures/context-tag-from-relative-path/other.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-relative-path/other.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/other.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-relative-path/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-relative-path/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-relative-path/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-relative-path/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-relative-path/test.ts diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/csr.expected.md 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 new file mode 100644 index 0000000000..299f177cb3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/dom.expected/template.js @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000000..fe2fb836ff --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +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/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-self/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-self/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-self/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-self/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-self/test.ts diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/csr.expected.md 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 new file mode 100644 index 0000000000..e6d23c725b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/components/other.js @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000000..db3fa31eb7 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/dom.expected/template.js @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000000..2d636103ac --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/components/other.js @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000000..1e743a2fb6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/html.expected/template.js @@ -0,0 +1,14 @@ +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/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/__snapshots__/ssr.expected.md diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/components/other.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-from-tag-name/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-from-tag-name/test.ts diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/csr.expected.md 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 new file mode 100644 index 0000000000..587f74842f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/dom.expected/template.js @@ -0,0 +1,23 @@ +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 new file mode 100644 index 0000000000..30efae4cd0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/html.expected/template.js @@ -0,0 +1,32 @@ +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/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr-sanitized.expected.md 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 new file mode 100644 index 0000000000..e1355bf4a0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/__snapshots__/ssr.expected.md @@ -0,0 +1,45 @@ +# 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/src/__tests__/fixtures/context-tag-in-if/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-in-if/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-in-if/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-in-if/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-in-if/test.ts diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/csr.expected.md 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 new file mode 100644 index 0000000000..e1b8e7f5e4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000000..c58aee0b92 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/dom.expected/template.js @@ -0,0 +1,26 @@ +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 new file mode 100644 index 0000000000..81712b255a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/components/child.js @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000000..426442f6b8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/html.expected/template.js @@ -0,0 +1,16 @@ +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/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr-sanitized.expected.md 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 new file mode 100644 index 0000000000..91c74a300e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/__snapshots__/ssr.expected.md @@ -0,0 +1,42 @@ +# 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/src/__tests__/fixtures/context-tag-reactive/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-reactive/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-reactive/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-reactive/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-reactive/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-reactive/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-reactive/test.ts diff --git a/packages/translator/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-static/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/csr.expected.md 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 new file mode 100644 index 0000000000..0d71fa1fe9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000000..a3d4122a30 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/dom.expected/template.js @@ -0,0 +1,15 @@ +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 new file mode 100644 index 0000000000..0b6f831daa --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/components/child.js @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000000..de8507f917 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/html.expected/template.js @@ -0,0 +1,10 @@ +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/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 similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/context-tag-static/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/context-tag-static/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-static/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-static/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-static/template.marko b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-static/template.marko rename to packages/translator-tags/src/__tests__/fixtures/context-tag-static/template.marko diff --git a/packages/translator/src/__tests__/fixtures/context-tag-static/test.ts b/packages/translator-tags/src/__tests__/fixtures/context-tag-static/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/context-tag-static/test.ts rename to packages/translator-tags/src/__tests__/fixtures/context-tag-static/test.ts diff --git a/packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f3190b1f64 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/dom.expected/template.js @@ -0,0 +1,27 @@ +import { on as _on, queueSource as _queueSource, data as _data, intersection as _intersection, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_a_b = /* @__PURE__ */_intersection(2, _scope => { + const { + a, + b + } = _scope; + _data(_scope["#text/4"], a + b); +}); +const _b = /* @__PURE__ */_value("b", (_scope, b) => _data(_scope["#text/3"], b), _expr_a_b); +const _a = /* @__PURE__ */_value("a", (_scope, a) => _data(_scope["#text/1"], a), _expr_a_b); +const _setup_effect = _register("packages/translator-tags/src/__tests__/fixtures/counter-intersection/template.marko_0", _scope => { + _on(_scope["#button/0"], "click", function () { + _queueSource(_scope, _a, 10); + }); + _on(_scope["#button/2"], "click", function () { + _queueSource(_scope, _b, 5); + }); +}); +const _setup = _scope => { + _queueEffect(_scope, _setup_effect); + _a(_scope, 0); + _b(_scope, 0); +}; +export const template = "
        + =
        "; +export const walks = /* next(1), get, next(1), get, out(1), over(1), get, next(1), get, out(1), over(1), replace, out(1) */"D D lb D lb%l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/counter-intersection/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..6fa0c526aa --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const a = 0; + const b = 0; + _write(`
        ${_markResumeNode(_scope0_id, "#button/0")} + ${_markResumeNode(_scope0_id, "#button/2")} = ${_escapeXML(a + b)}${_markResumeNode(_scope0_id, "#text/4")}
        `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/counter-intersection/template.marko_0"); + _writeScope(_scope0_id, { + "a": a, + "b": b + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/counter-intersection/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..b7d86cb384 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/resume.expected.md @@ -0,0 +1,121 @@ +# Render {} +```html + + + +
        + + + + + + + = + + 0 + +
        + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button.a").click() + +```html + + + +
        + + + + + + + = + + 10 + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/div0/button0/#text0: "0" => "10" +#document/html0/body1/div0/#text7: "0" => "10" +``` + + +# Render +container.querySelector("button.b").click() + +```html + + + +
        + + + + + + + = + + 15 + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/div0/button3/#text0: "0" => "5" +#document/html0/body1/div0/#text7: "10" => "15" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/counter-intersection/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..5f507eb17c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/__snapshots__/ssr.expected.md @@ -0,0 +1,59 @@ +# Write +
        + = 0
        + + +# Render "End" +```html + + + +
        + + + + + + + = + + 0 + +
        + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +inserted #document/html0/body1/div0/button0/#comment1 +inserted #document/html0/body1/div0/#comment1 +inserted #document/html0/body1/div0/#text2 +inserted #document/html0/body1/div0/button3 +inserted #document/html0/body1/div0/button3/#text0 +inserted #document/html0/body1/div0/button3/#comment1 +inserted #document/html0/body1/div0/#comment4 +inserted #document/html0/body1/div0/#text5 +inserted #document/html0/body1/div0/#comment6 +inserted #document/html0/body1/div0/#text7 +inserted #document/html0/body1/div0/#comment8 +inserted #document/html0/body1/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/counter-intersection/template.marko b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/counter-intersection/template.marko rename to packages/translator-tags/src/__tests__/fixtures/counter-intersection/template.marko diff --git a/packages/translator/src/__tests__/fixtures/counter-intersection/test.ts b/packages/translator-tags/src/__tests__/fixtures/counter-intersection/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/counter-intersection/test.ts rename to packages/translator-tags/src/__tests__/fixtures/counter-intersection/test.ts diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..04b40df7ae --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/dom.expected/template.js @@ -0,0 +1,17 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, loopTo as _loopTo, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _n$forBody = /* @__PURE__ */_value("n", (_scope, n) => _data(_scope["#text/0"], n)); +const _forBody = /* @__PURE__ */_createRenderer(", ", /* replace */"%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let n; + if (!_clean) ({ + value: [n] + } = _destructure); + _n$forBody(_scope, n, _clean); +}); +const _for = /* @__PURE__ */_loopTo("#div/0", _forBody); +const _input = /* @__PURE__ */_value("input", (_scope, input) => _for(_scope, [input.to, input.from, input.step])); +export const attrs = _input; +export { _input }; +export const template = "
        "; +export const walks = /* get, over(1) */" b"; +export const setup = function () {}; +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/create-and-clear-rows-loop-from/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..f712ee12af --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/html.expected/template.js @@ -0,0 +1,20 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, markResumeScopeStart as _markResumeScopeStart, serializedScope as _serializedScope, markResumeControlEnd as _markResumeControlEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write("
        "); + const _scope1_ = new Map(); + for (let _from = input.from ?? 0, _step = input.step ?? 1, _steps = (input.to - _from) / _step, _i = 0; _i <= _steps; _i++) { + const _scope1_id = _nextScopeId(); + const n = _from + _i * _step; + _write(`${_markResumeScopeStart(_scope1_id)}${_escapeXML(n)}${_markResumeNode(_scope1_id, "#text/0")}, `); + _writeScope(_scope1_id, (_s => (_scope1_.set(n, _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlEnd(_scope0_id, "#div/0")}
        ${_markResumeNode(_scope0_id, "#div/0")}`); + _writeScope(_scope0_id, { + "#div/0(": _scope1_.size ? _scope1_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/template.marko b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/template.marko rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/template.marko diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/test.ts b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-from/test.ts rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-from/test.ts diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..00bc7bc960 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/dom.expected/template.js @@ -0,0 +1,31 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, loopIn as _loopIn, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _key$forBody2 = /* @__PURE__ */_value("key", (_scope, key) => _data(_scope["#text/0"], key)); +const _forBody2 = /* @__PURE__ */_createRenderer("

        ", /* next(1), get */"D ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let key; + if (!_clean) ({ + value: [key] + } = _destructure); + _key$forBody2(_scope, key, _clean); +}); +const _text$forBody = /* @__PURE__ */_value("text", (_scope, text) => _data(_scope["#text/1"], text)); +const _key$forBody = /* @__PURE__ */_value("key", (_scope, key) => _data(_scope["#text/0"], key)); +const _forBody = /* @__PURE__ */_createRenderer("

        :

        ", /* next(1), replace, over(2), replace */"D%c%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure2, _clean) => { + let key, text; + if (!_clean) ({ + value: [key, text] + } = _destructure2); + _key$forBody(_scope, key, _clean); + _text$forBody(_scope, text, _clean); +}); +const _for2 = /* @__PURE__ */_loopIn("#text/1", _forBody2); +const _for = /* @__PURE__ */_loopIn("#text/0", _forBody); +const _input = /* @__PURE__ */_value("input", (_scope, input) => { + _for(_scope, [input.children]); + _for2(_scope, [input.children]); +}); +export const attrs = _input; +export { _input }; +export const template = "
        "; +export const walks = /* next(1), replace, over(1), replace, out(1) */"D%b%l"; +export const setup = function () {}; +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/create-and-clear-rows-loop-in/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..24d47460d8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/html.expected/template.js @@ -0,0 +1,35 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write("
        "); + const _forScopeIds = [], + _scope1_ = new Map(); + for (const key in input.children) { + const _scope1_id = _nextScopeId(); + const text = input.children[key]; + _forScopeIds.push(_scope1_id); + _write(`

        ${_escapeXML(key)}${_markResumeNode(_scope1_id, "#text/0")}: ${_escapeXML(text)}${_markResumeNode(_scope1_id, "#text/1")}

        `); + _writeScope(_scope1_id, (_s => (_scope1_.set(key, _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _forScopeIds)}`); + const _forScopeIds2 = [], + _scope2_ = new Map(); + for (const key in input.children) { + const _scope2_id = _nextScopeId(); + _forScopeIds2.push(_scope2_id); + _write(`

        ${_escapeXML(key)}${_markResumeNode(_scope2_id, "#text/0")}

        `); + _writeScope(_scope2_id, (_s2 => (_scope2_.set(key, _s2), _s2))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/1", _forScopeIds2)}
        `); + _writeScope(_scope0_id, { + "#text/0(": _scope1_.size ? _scope1_ : undefined, + "#text/1(": _scope2_.size ? _scope2_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/template.marko b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/template.marko rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/template.marko diff --git a/packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/test.ts b/packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/create-and-clear-rows-loop-in/test.ts rename to packages/translator-tags/src/__tests__/fixtures/create-and-clear-rows-loop-in/test.ts diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/components/hello/index.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/components/hello/index.js new file mode 100644 index 0000000000..d713c3d564 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/components/hello/index.js @@ -0,0 +1,5 @@ +export const template = "Hello"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/components/message.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/components/message.js new file mode 100644 index 0000000000..942ed512b5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/components/message.js @@ -0,0 +1,5 @@ +export const template = "Frank"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/message.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..bb41436801 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "Hello Frank"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/components/hello/index.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/components/hello/index.js new file mode 100644 index 0000000000..000f4b2465 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/components/hello/index.js @@ -0,0 +1,6 @@ +import { 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(); + _write("Hello"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/components/message.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/components/message.js new file mode 100644 index 0000000000..ff05fffbbf --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/components/message.js @@ -0,0 +1,6 @@ +import { 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(); + _write("Frank"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/message.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..55c47f666d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("Hello Frank"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/index.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/index.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/index.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/index.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/marko-tag.json b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/marko-tag.json similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/marko-tag.json rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/marko-tag.json diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/transformer.ts b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/transformer.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/transformer.ts rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/hello/transformer.ts diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/message.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/message.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/components/message.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/components/message.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-child-analyze/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-child-analyze/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/dom.expected/components/child.js new file mode 100644 index 0000000000..8456118221 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,9 @@ +import { data as _data, value as _value2, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _value = /* @__PURE__ */_value2("value", (_scope, value) => _data(_scope["#text/0"], value)); +const _input = /* @__PURE__ */_value2("input", (_scope, input) => _value(_scope, input.value)); +export const attrs = _input; +export { _input }; +export const template = " "; +export const walks = /* replace, over(2) */"%c"; +export const setup = function () {}; +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/custom-tag-default-value/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..81bd5c51a5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/dom.expected/template.js @@ -0,0 +1,17 @@ +import { setup as _child, attrs as _child_attrs, template as _child_template, walks as _child_walks } from "./components/child.marko"; +import { inChild as _inChild, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x = /* @__PURE__ */_value("x", (_scope, x) => _child_attrs(_scope["#childScope/1"], { + value: x +}), void 0, _inChild("#childScope/1", _child_attrs)); +const _setup = _scope => { + _child(_scope["#childScope/0"]); + _child(_scope["#childScope/1"]); + _x(_scope, "y"); + _child_attrs(_scope["#childScope/0"], { + value: 3 + }); +}; +export const template = `${_child_template}${_child_template}`; +export const walks = /* beginChild, _child_walks, endChild, beginChild, _child_walks, endChild */`/${_child_walks}&/${_child_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..827aca123b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/html.expected/components/child.js @@ -0,0 +1,7 @@ +import { 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 value = input.value; + _write(`${_escapeXML(value)}${_markResumeNode(_scope0_id, "#text/0")} `); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..f2cbeeac6f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import _child from "./components/child.marko"; +import { 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 = "y"; + _child._({ + value: 3 + }); + _child._({ + value: x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-default-value/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-default-value/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-default-value/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/dom.expected/components/custom-tag.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/dom.expected/components/custom-tag.js new file mode 100644 index 0000000000..6bdd54fd98 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/dom.expected/components/custom-tag.js @@ -0,0 +1,32 @@ +import { on as _on, queueSource as _queueSource, data as _data, dynamicTagAttrs as _dynamicTagAttrs, intersection as _intersection, conditional as _conditional, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _inputRenderBody_input = _dynamicTagAttrs("#text/2"); +const _expr_dynamicTagName_x = /* @__PURE__ */_intersection(2, _scope => { + const { + "#text/2": dynamicTagName, + x + } = _scope; + _inputRenderBody_input(_scope, () => ({ + value: [x] + })); +}); +const _dynamicTagName = /* @__PURE__ */_conditional("#text/2", null, _expr_dynamicTagName_x); +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/components/custom-tag.marko_0_x", _scope => _on(_scope["#button/0"], "click", function () { + const { + x + } = _scope; + _queueSource(_scope, _x, x + 1); +})); +const _x = /* @__PURE__ */_value("x", (_scope, x) => { + _data(_scope["#text/1"], x); + _queueEffect(_scope, _x_effect); +}, _expr_dynamicTagName_x); +const _input = /* @__PURE__ */_value("input", (_scope, input) => _dynamicTagName(_scope, input.renderBody), void 0, _dynamicTagName); +const _setup = _scope => { + _x(_scope, 1); +}; +export const attrs = _input; +export { _input }; +export const template = ""; +export const walks = /* get, next(1), get, out(1), replace, over(1) */" D l%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/custom-tag-parameters/components/custom-tag.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..67710e4370 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/dom.expected/template.js @@ -0,0 +1,20 @@ +import { data as _data, bindRenderer as _bindRenderer, inChild as _inChild, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +import { setup as _customTag, attrs as _customTag_attrs, template as _customTag_template, walks as _customTag_walks } from "./components/custom-tag.marko"; +const _count$customTagBody = /* @__PURE__ */_value("count", (_scope, count) => _data(_scope["#text/0"], count)); +const _customTagBody = /* @__PURE__ */_createRenderer("
        Count:
        ", /* next(1), over(1), replace */"Db%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let count; + if (!_clean) ({ + value: [count] + } = _destructure); + _count$customTagBody(_scope, count, _clean); +}); +const _setup = _scope => { + _customTag(_scope["#childScope/0"]); + _customTag_attrs(_scope["#childScope/0"], { + renderBody: /* @__PURE__ */_bindRenderer(_scope, _customTagBody) + }); +}; +export const template = `${_customTag_template}`; +export const walks = /* beginChild, _customTag_walks, endChild */`/${_customTag_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/html.expected/components/custom-tag.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/html.expected/components/custom-tag.js new file mode 100644 index 0000000000..6ab913c597 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/html.expected/components/custom-tag.js @@ -0,0 +1,17 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, 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(); + const x = 1; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + const _dynamicScope = _dynamicTag(input.renderBody, { + value: [x] + }); + _write(`${_markResumeControlEnd(_scope0_id, "#text/2")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/components/custom-tag.marko_0_x"); + _writeScope(_scope0_id, { + "x": x, + "#text/2!": _dynamicScope, + "#text/2(": input.renderBody + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/components/custom-tag.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..cd71142b28 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/html.expected/template.js @@ -0,0 +1,14 @@ +import { 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 _customTag from "./components/custom-tag.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + _customTag._({ + renderBody({ + value: [count] + }) { + const _scope1_id = _nextScopeId(); + _write(`
        Count: ${_escapeXML(count)}${_markResumeNode(_scope1_id, "#text/0")}
        `); + } + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..aa744386eb --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/__snapshots__/ssr.expected.md @@ -0,0 +1,50 @@ +# Write +
        Count: 1
        + + +# Render "End" +```html + + + + + + +
        + Count: + + 1 + +
        + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/#comment2 +inserted #document/html0/body1/div3 +inserted #document/html0/body1/div3/#text0 +inserted #document/html0/body1/div3/#comment1 +inserted #document/html0/body1/div3/#text2 +inserted #document/html0/body1/div3/#comment3 +inserted #document/html0/body1/#comment4 +inserted #document/html0/body1/script5 +inserted #document/html0/body1/script5/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-parameters/components/custom-tag.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/components/custom-tag.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-parameters/components/custom-tag.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/components/custom-tag.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-parameters/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-parameters/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-parameters/test.ts b/packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-parameters/test.ts rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-parameters/test.ts diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/dom.expected/components/child/index.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/dom.expected/components/child/index.js new file mode 100644 index 0000000000..253ff14606 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/dom.expected/components/child/index.js @@ -0,0 +1,9 @@ +import { conditional as _conditional, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0"); +const _input = /* @__PURE__ */_value("input", (_scope, input) => _dynamicTagName(_scope, input.renderBody), void 0, _dynamicTagName); +export const attrs = _input; +export { _input }; +export const template = ""; +export const walks = /* replace, over(1) */"%b"; +export const setup = function () {}; +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/custom-tag-render-body/components/child/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..1c4e1af127 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/dom.expected/template.js @@ -0,0 +1,14 @@ +import { setup as _child, attrs as _child_attrs, template as _child_template, walks as _child_walks } from "./components/child/index.marko"; +import { bindRenderer as _bindRenderer, inChild as _inChild, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _childBody = /* @__PURE__ */_createRenderer("This is the body content", ""); +const _setup = _scope => { + _child(_scope["#childScope/0"]); + _child_attrs(_scope["#childScope/0"], { + name: "World", + renderBody: /* @__PURE__ */_bindRenderer(_scope, _childBody) + }); +}; +export const template = `${_child_template}`; +export const walks = /* beginChild, _child_walks, endChild */`/${_child_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/html.expected/components/child/index.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/html.expected/components/child/index.js new file mode 100644 index 0000000000..78f085d853 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/html.expected/components/child/index.js @@ -0,0 +1,11 @@ +import { dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, write as _write, 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(); + 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/custom-tag-render-body/components/child/index.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..ca6016afab --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _child from "./components/child/index.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + _child._({ + name: "World", + renderBody() { + const _scope1_id = _nextScopeId(); + _write("This is the body content"); + } + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/components/child/index.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/components/child/index.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/components/child/index.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/components/child/index.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-render-body/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-render-body/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-render-body/template.marko diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..b5489c87db --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "
        "; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..835e1f4133 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
        "); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-separate-assets/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-separate-assets/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-separate-assets/template.style.css b/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/template.style.css similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-separate-assets/template.style.css rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/template.style.css diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-separate-assets/test.ts b/packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-separate-assets/test.ts rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-separate-assets/test.ts diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/dom.expected/hello.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/dom.expected/hello.js new file mode 100644 index 0000000000..edaef07748 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/dom.expected/hello.js @@ -0,0 +1,8 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _input = /* @__PURE__ */_value("input", (_scope, input) => _data(_scope["#text/0"], input.name)); +export const attrs = _input; +export { _input }; +export const template = "Hello !"; +export const walks = /* over(1), replace, over(2) */"b%c"; +export const setup = function () {}; +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/custom-tag-template/hello.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..6524a9a3db --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/dom.expected/template.js @@ -0,0 +1,12 @@ +import { setup as _hello, attrs as _hello_attrs, template as _hello_template, walks as _hello_walks } from "./hello.marko"; +import { inChild as _inChild, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup = _scope => { + _hello(_scope["#childScope/0"]); + _hello_attrs(_scope["#childScope/0"], { + name: "Frank" + }); +}; +export const template = `${_hello_template}`; +export const walks = /* beginChild, _hello_walks, endChild */`/${_hello_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-template/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/html.expected/hello.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/html.expected/hello.js new file mode 100644 index 0000000000..f20f586ffc --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/html.expected/hello.js @@ -0,0 +1,6 @@ +import { 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(); + _write(`Hello ${_escapeXML(input.name)}${_markResumeNode(_scope0_id, "#text/0")}!`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-template/hello.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..d0ecdedc77 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/html.expected/template.js @@ -0,0 +1,9 @@ +import _hello from "./hello.marko"; +import { 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(); + _hello._({ + name: "Frank" + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-template/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/hello.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/hello.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/hello.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/hello.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/marko.json b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/marko.json similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/marko.json rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/marko.json diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-template/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-template/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-template/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-template/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/dom.expected/components/child.js new file mode 100644 index 0000000000..0fcc2a39f0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,9 @@ +import { tagVarSignal as _tagVarSignal, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x = /* @__PURE__ */_value("x", (_scope, x) => _tagVarSignal(_scope, x + 3), void 0, _tagVarSignal); +const _setup = _scope => { + _x(_scope, 1); +}; +export const template = "child"; +export const walks = /* over(1) */"b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f63ac4191d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/dom.expected/template.js @@ -0,0 +1,11 @@ +import { setup as _child, template as _child_template, walks as _child_walks } from "./components/child.marko"; +import { setTagVar as _setTagVar, data as _data2, value as _value, register as _register, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _data = _register("packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/template.marko_0_data", /* @__PURE__ */_value("data", (_scope, data) => _data2(_scope["#text/1"], data))); +const _setup = _scope => { + _setTagVar(_scope, "#childScope/0", _data); + _child(_scope["#childScope/0"]); +}; +export const template = `${_child_template}
        `; +export const walks = /* beginChild, _child_walks, endChild, next(1), get, out(1) */`/${_child_walks}&D l`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..8a9069850d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/html.expected/components/child.js @@ -0,0 +1,12 @@ +import { write as _write, 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(); + const x = 1; + _write("child"); + const _return = x + 3; + _writeScope(_scope0_id, { + "/": _tagVar + }); + return _return; +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..a7fd9a51f8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/html.expected/template.js @@ -0,0 +1,9 @@ +import _child from "./components/child.marko"; +import { createRenderer as _createRenderer, register as _register, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const data = _child._({}, _register( /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/template.marko_0_data", _scope0_id)); + _write(`
        ${_escapeXML(data)}${_markResumeNode(_scope0_id, "#text/1")}
        `); + _writeScope(_scope0_id, {}); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..0c64c3a339 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/resume.expected.md @@ -0,0 +1,23 @@ +# Render undefined +```html + + + + + child + +
        + 4 + +
        + + + +``` + +# Mutations +``` + +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..5dad177160 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/ssr.expected.md @@ -0,0 +1,36 @@ +# Write + child
        4
        + + +# Render "End" +```html + + + + + child + +
        + 4 + +
        + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/span0 +inserted #document/html0/body1/span0/#text0 +inserted #document/html0/body1/div1 +inserted #document/html0/body1/div1/#text0 +inserted #document/html0/body1/div1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-expression/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-expression/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-expression/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-expression/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-expression/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/dom.expected/components/child.js new file mode 100644 index 0000000000..ff1d7874d5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,18 @@ +import { tagVarSignal as _tagVarSignal, intersection as _intersection, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_x_y = /* @__PURE__ */_intersection(2, _scope => { + const { + x, + y + } = _scope; + _tagVarSignal(_scope, x + y); +}); +const _y = /* @__PURE__ */_value("y", null, _expr_x_y); +const _x = /* @__PURE__ */_value("x", null, _expr_x_y); +const _setup = _scope => { + _x(_scope, 1); + _y(_scope, 2); +}; +export const template = "child"; +export const walks = /* over(1) */"b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..cc7288cf50 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/dom.expected/template.js @@ -0,0 +1,11 @@ +import { setup as _child, template as _child_template, walks as _child_walks } from "./components/child.marko"; +import { setTagVar as _setTagVar, data as _data2, value as _value, register as _register, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _data = _register("packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/template.marko_0_data", /* @__PURE__ */_value("data", (_scope, data) => _data2(_scope["#text/1"], data))); +const _setup = _scope => { + _setTagVar(_scope, "#childScope/0", _data); + _child(_scope["#childScope/0"]); +}; +export const template = `${_child_template}
        `; +export const walks = /* beginChild, _child_walks, endChild, next(1), get, out(1) */`/${_child_walks}&D l`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..5f6314be1d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/html.expected/components/child.js @@ -0,0 +1,15 @@ +import { write as _write, 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(); + const x = 1; + const y = 2; + _write("child"); + const _return = x + y; + _writeScope(_scope0_id, { + "x": x, + "y": y, + "/": _tagVar + }); + return _return; +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..ffcfd76ec6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/html.expected/template.js @@ -0,0 +1,9 @@ +import _child from "./components/child.marko"; +import { createRenderer as _createRenderer, register as _register, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const data = _child._({}, _register( /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/template.marko_0_data", _scope0_id)); + _write(`
        ${_escapeXML(data)}${_markResumeNode(_scope0_id, "#text/1")}
        `); + _writeScope(_scope0_id, {}); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..775be0b9ab --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/resume.expected.md @@ -0,0 +1,23 @@ +# Render undefined +```html + + + + + child + +
        + 3 + +
        + + + +``` + +# Mutations +``` + +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..bb5bdec950 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/ssr.expected.md @@ -0,0 +1,36 @@ +# Write + child
        3
        + + +# Render "End" +```html + + + + + child + +
        + 3 + +
        + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/span0 +inserted #document/html0/body1/span0/#text0 +inserted #document/html0/body1/div1 +inserted #document/html0/body1/div1/#text0 +inserted #document/html0/body1/div1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var-multiple/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var-multiple/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/dom.expected/components/child.js new file mode 100644 index 0000000000..9443a368a0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,19 @@ +import { on as _on, queueSource as _queueSource, data as _data, tagVarSignal as _tagVarSignal, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/custom-tag-var/components/child.marko_0_x", _scope => _on(_scope["#button/0"], "click", function () { + const { + x + } = _scope; + _queueSource(_scope, _x, x + 1); +})); +const _x = /* @__PURE__ */_value("x", (_scope, x) => { + _data(_scope["#text/1"], x); + _queueEffect(_scope, _x_effect); + _tagVarSignal(_scope, x); +}, void 0, _tagVarSignal); +const _setup = _scope => { + _x(_scope, 1); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..ab8a47c456 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/dom.expected/template.js @@ -0,0 +1,11 @@ +import { setup as _child, template as _child_template, walks as _child_walks } from "./components/child.marko"; +import { setTagVar as _setTagVar, data as _data2, value as _value, register as _register, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _data = _register("packages/translator-tags/src/__tests__/fixtures/custom-tag-var/template.marko_0_data", /* @__PURE__ */_value("data", (_scope, data) => _data2(_scope["#text/1"], data))); +const _setup = _scope => { + _setTagVar(_scope, "#childScope/0", _data); + _child(_scope["#childScope/0"]); +}; +export const template = `${_child_template}
        `; +export const walks = /* beginChild, _child_walks, endChild, next(1), get, out(1) */`/${_child_walks}&D l`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..2631112d1f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/html.expected/components/child.js @@ -0,0 +1,14 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const x = 1; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + const _return = x; + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/custom-tag-var/components/child.marko_0_x"); + _writeScope(_scope0_id, { + "x": x, + "/": _tagVar + }); + return _return; +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-var/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..c7fd1fd1a3 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/html.expected/template.js @@ -0,0 +1,9 @@ +import _child from "./components/child.marko"; +import { createRenderer as _createRenderer, register as _register, escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const data = _child._({}, _register( /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/custom-tag-var/template.marko_0_data", _scope0_id)); + _write(`
        ${_escapeXML(data)}${_markResumeNode(_scope0_id, "#text/1")}
        `); + _writeScope(_scope0_id, {}); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/custom-tag-var/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..92cffaf491 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/resume.expected.md @@ -0,0 +1,123 @@ +# Render {} +```html + + + + + +
        + 1 + +
        + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button.inc").click() + +```html + + + + + +
        + 2 + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "1" => "2" +#document/html0/body1/div2/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button.inc").click() + +```html + + + + + +
        + 3 + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "2" => "3" +#document/html0/body1/div2/#text0: "2" => "3" +``` + + +# Render +container.querySelector("button.inc").click() + +```html + + + + + +
        + 4 + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "3" => "4" +#document/html0/body1/div2/#text0: "3" => "4" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..d7ce4b7abd --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/ssr.expected.md @@ -0,0 +1,42 @@ +# Write +
        1
        + + +# Render "End" +```html + + + + + +
        + 1 + +
        + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/div2 +inserted #document/html0/body1/div2/#text0 +inserted #document/html0/body1/div2/#comment1 +inserted #document/html0/body1/script3 +inserted #document/html0/body1/script3/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var/template.marko b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var/template.marko rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var/template.marko diff --git a/packages/translator/src/__tests__/fixtures/custom-tag-var/test.ts b/packages/translator-tags/src/__tests__/fixtures/custom-tag-var/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/custom-tag-var/test.ts rename to packages/translator-tags/src/__tests__/fixtures/custom-tag-var/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/declaration/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/declaration/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..339afd4aaf --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/declaration/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "Hello World"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/declaration/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/declaration/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/declaration/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..f0a5609e6e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/declaration/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("Hello World"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/declaration/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/declaration/marko.json b/packages/translator-tags/src/__tests__/fixtures/declaration/marko.json similarity index 100% rename from packages/translator/src/__tests__/fixtures/declaration/marko.json rename to packages/translator-tags/src/__tests__/fixtures/declaration/marko.json diff --git a/packages/translator/src/__tests__/fixtures/declaration/template.marko b/packages/translator-tags/src/__tests__/fixtures/declaration/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/declaration/template.marko rename to packages/translator-tags/src/__tests__/fixtures/declaration/template.marko diff --git a/packages/translator/src/__tests__/fixtures/declaration/test.ts b/packages/translator-tags/src/__tests__/fixtures/declaration/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/declaration/test.ts rename to packages/translator-tags/src/__tests__/fixtures/declaration/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/doctype/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/doctype/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..cb878a39d5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/doctype/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "Title of the documentThe content of the document......"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/doctype/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/doctype/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/doctype/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..9642fc238e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/doctype/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("Title of the documentThe content of the document......"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/doctype/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/doctype/template.marko b/packages/translator-tags/src/__tests__/fixtures/doctype/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/doctype/template.marko rename to packages/translator-tags/src/__tests__/fixtures/doctype/template.marko diff --git a/packages/translator/src/__tests__/fixtures/doctype/test.ts b/packages/translator-tags/src/__tests__/fixtures/doctype/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/doctype/test.ts rename to packages/translator-tags/src/__tests__/fixtures/doctype/test.ts diff --git a/packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..1ce7d3f960 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/dom.expected/template.js @@ -0,0 +1,23 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _clickCount_effect = _register("packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/template.marko_0_clickCount", _scope => { + const { + clickCount + } = _scope; + _on(_scope["#button/0"], "click", clickCount <= 1 ? () => { + const { + clickCount + } = _scope; + _queueSource(_scope, _clickCount, clickCount + 1); + } : false); +}); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => { + _data(_scope["#text/1"], clickCount); + _queueEffect(_scope, _clickCount_effect); +}); +const _setup = _scope => { + _clickCount(_scope, 0); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..914cb6367a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const clickCount = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/template.marko_0_clickCount"); + _writeScope(_scope0_id, { + "clickCount": clickCount + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..56544eb40e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/resume.expected.md @@ -0,0 +1,96 @@ +# Render {} +```html + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + + + +``` + +# Mutations +``` + +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..cb88ae056f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/__snapshots__/ssr.expected.md @@ -0,0 +1,33 @@ +# Write + + + +# Render "End" +```html + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-event-handlers/template.marko b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-event-handlers/template.marko rename to packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/template.marko diff --git a/packages/translator/src/__tests__/fixtures/dynamic-event-handlers/test.ts b/packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-event-handlers/test.ts rename to packages/translator-tags/src/__tests__/fixtures/dynamic-event-handlers/test.ts diff --git a/packages/translator/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..5b164f357f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,32 @@ +import { on as _on, queueSource as _queueSource, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, intersection as _intersection, conditional as _conditional, value as _value, register as _register, queueEffect as _queueEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _tagNameBody = /* @__PURE__ */_createRenderer("body content", ""); +const _tagName_input = _dynamicTagAttrs("#text/0", _tagNameBody); +const _expr_dynamicTagName_className = /* @__PURE__ */_intersection(2, _scope => { + const { + "#text/0": dynamicTagName, + className + } = _scope; + _tagName_input(_scope, () => ({ + class: className + })); +}); +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0", null, _expr_dynamicTagName_className); +const _className = /* @__PURE__ */_value("className", null, _expr_dynamicTagName_className); +const _tagName_effect = _register("packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/template.marko_0_tagName", _scope => _on(_scope["#button/1"], "click", function () { + const { + tagName + } = _scope; + _queueSource(_scope, _tagName, tagName === "span" ? "div" : "span"); +})); +const _tagName = /* @__PURE__ */_value("tagName", (_scope, tagName) => { + _queueEffect(_scope, _tagName_effect); + _dynamicTagName(_scope, tagName || _tagNameBody); +}, void 0, _dynamicTagName); +const _setup = _scope => { + _tagName(_scope, "span"); + _className(_scope, "A"); +}; +export const template = ""; +export const walks = /* replace, over(1), get, over(1) */"%b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..bf7d54ee40 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,21 @@ +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, markResumeNode as _markResumeNode, writeEffect as _writeEffect, writeScope as _writeScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const tagName = "span"; + const className = "A"; + const _dynamicScope = _dynamicTag(tagName, { + class: className + }, /* @__PURE__ */_createRenderer(() => { + const _scope1_id = _nextScopeId(); + _write("body content"); + })); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/template.marko_0_tagName"); + _writeScope(_scope0_id, { + "tagName": tagName, + "className": className, + "#text/0!": _dynamicScope, + "#text/0(": tagName + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..d4f963ec41 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-native-dynamic-tag/__snapshots__/resume.expected.md @@ -0,0 +1,89 @@ +# Render {} +```html + + + + + + body content + + + + + +# Render "End" +```html + + + + + + body content + + + "; +export const walks = /* get, over(1), get, over(1) */" b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..605ac4a3e8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { classAttr as _classAttr, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const className = "A"; + _write(`paragraph

        ${_markResumeNode(_scope0_id, "#p/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/template.marko_0_className"); + _writeScope(_scope0_id, { + "className": className + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..0dab9e9eeb --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-attr-signal/__snapshots__/resume.expected.md @@ -0,0 +1,80 @@ +# Render {} +```html + + + +

        + paragraph +

        + + + + +# Render "End" +```html + + + +

        + paragraph +

        + + "; +export const walks = /* get, over(1), replace, over(1) */" b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..d19b4a85de --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/html.expected/components/child.js @@ -0,0 +1,8 @@ +import { 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(({ + id +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write(`
        Id is ${_escapeXML(id)}${_markResumeNode(_scope0_id, "#text/0")}
        `); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..6bdb71a67e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/html.expected/template.js @@ -0,0 +1,18 @@ +import child from "./components/child.marko"; +import { markResumeNode as _markResumeNode, write as _write, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, writeEffect as _writeEffect, 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(); + const tagName = child; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + const _dynamicScope = _dynamicTag(tagName, { + id: "dynamic" + }); + _write(`${_markResumeControlEnd(_scope0_id, "#text/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/template.marko_0_tagName"); + _writeScope(_scope0_id, { + "tagName": tagName, + "#text/1!": _dynamicScope, + "#text/1(": tagName + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..6403dc4e01 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-native/__snapshots__/resume.expected.md @@ -0,0 +1,83 @@ +# Render {} +```html + + + +
        Id is dynamic
        + + +# Render "End" +```html + + + + "; +export const walks = /* replace, over(1), get, over(1) */"%b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/components/child1.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/components/child1.js new file mode 100644 index 0000000000..253f94ebaf --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/components/child1.js @@ -0,0 +1,8 @@ +import { 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(({ + value +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write(`
        Child 1 has ${_escapeXML(value)}${_markResumeNode(_scope0_id, "#text/0")}
        `); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/components/child1.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/components/child2.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/components/child2.js new file mode 100644 index 0000000000..8c1f4884a2 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/components/child2.js @@ -0,0 +1,8 @@ +import { 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(({ + value +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write(`
        Child 2 has ${_escapeXML(value)}${_markResumeNode(_scope0_id, "#text/0")}
        `); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/components/child2.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..63fcd8e0be --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/html.expected/template.js @@ -0,0 +1,20 @@ +import child1 from "./components/child1.marko"; +import child2 from "./components/child2.marko"; +import { dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const tagName = child1; + const val = 3; + const _dynamicScope = _dynamicTag(tagName, { + value: val + }); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/template.marko_0_tagName"); + _writeScope(_scope0_id, { + "tagName": tagName, + "val": val, + "#text/0!": _dynamicScope, + "#text/0(": tagName + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..6022376f9e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-custom-tags/__snapshots__/resume.expected.md @@ -0,0 +1,84 @@ +# Render {} +```html + + + + +
        + Child 1 has + + 3 + +
        + + + + +# Render "End" +```html + + + + +
        + Child 1 has + + 3 + +
        + + "; +export const walks = /* replace, over(1), get, over(1) */"%b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..6ec4f90f76 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/html.expected/template.js @@ -0,0 +1,17 @@ +import { write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, markResumeNode as _markResumeNode, writeEffect as _writeEffect, writeScope as _writeScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const x = null; + const _dynamicScope = _dynamicTag(x, {}, /* @__PURE__ */_createRenderer(() => { + const _scope1_id = _nextScopeId(); + _write("Body Content"); + })); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/template.marko_0_x"); + _writeScope(_scope0_id, { + "x": x, + "#text/0!": _dynamicScope, + "#text/0(": x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..6dda20ac78 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-sometimes-null/__snapshots__/resume.expected.md @@ -0,0 +1,76 @@ +# Render {} +```html + + + + + Body Content + + + + +# Render "End" +```html + + + + + Body Content + + "; +export const walks = /* get, next(1), get, out(1) */" D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..7206d65655 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/dom.expected/template.js @@ -0,0 +1,25 @@ +import { setup as _counter, template as _counter_template, walks as _counter_walks } from "./components/counter.marko"; +import { on as _on, queueSource as _queueSource, createRenderer as _createRenderer, dynamicTagAttrs as _dynamicTagAttrs, conditional as _conditional, register as _register, queueEffect as _queueEffect, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup$tagNameBody = _scope => { + _counter(_scope["#childScope/0"]); +}; +const _tagNameBody = /* @__PURE__ */_createRenderer(`${_counter_template}`, /* beginChild, _counter_walks, endChild */`/${_counter_walks}&`, _setup$tagNameBody); +const _tagName_input = _dynamicTagAttrs("#text/0", _tagNameBody); +const _dynamicTagName = /* @__PURE__ */_conditional("#text/0", _scope => _tagName_input(_scope, () => ({})), void 0, _tagName_input); +const _tagName_effect = _register("packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/template.marko_0_tagName", _scope => _on(_scope["#button/1"], "click", function () { + const { + tagName + } = _scope; + _queueSource(_scope, _tagName, tagName === "span" ? "div" : "span"); +})); +const _tagName = /* @__PURE__ */_value("tagName", (_scope, tagName) => { + _queueEffect(_scope, _tagName_effect); + _dynamicTagName(_scope, tagName || _tagNameBody); +}, void 0, _dynamicTagName); +const _setup = _scope => { + _tagName(_scope, "div"); +}; +export const template = ""; +export const walks = /* replace, over(1), get, over(1) */"%b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/html.expected/components/counter.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/html.expected/components/counter.js new file mode 100644 index 0000000000..958cf2b3c5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/html.expected/components/counter.js @@ -0,0 +1,11 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const count = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/components/counter.marko_0_count"); + _writeScope(_scope0_id, { + "count": count + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/components/counter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..9d2d222a7b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/html.expected/template.js @@ -0,0 +1,18 @@ +import _counter from "./components/counter.marko"; +import { nextScopeId as _nextScopeId, createRenderer as _createRenderer, dynamicTag as _dynamicTag, markResumeControlEnd as _markResumeControlEnd, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, writeScope as _writeScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const tagName = "div"; + const _dynamicScope = _dynamicTag(tagName, {}, /* @__PURE__ */_createRenderer(() => { + const _scope1_id = _nextScopeId(); + _counter._({}); + })); + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}${_markResumeNode(_scope0_id, "#button/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/template.marko_0_tagName"); + _writeScope(_scope0_id, { + "tagName": tagName, + "#text/0!": _dynamicScope, + "#text/0(": tagName + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..7d04632136 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/dynamic-tag-with-updating-body/__snapshots__/resume.expected.md @@ -0,0 +1,134 @@ +# Render {} +```html + + + + +
        + + +
        + + + + + + + + + + + + + + +# Render "End" +```html + + + + +
        + + +
        + + "; +export const walks = /* next(1), get, out(1) */"D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/effect-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..3f521f2efa --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const clickCount = 0; + _write(`
        ${_markResumeNode(_scope0_id, "#button/0")}
        `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/effect-counter/template.marko_0_clickCount"); + _writeScope(_scope0_id, { + "clickCount": clickCount + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/effect-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/effect-counter/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-counter/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..eac621be69 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/resume.expected.md @@ -0,0 +1,112 @@ +# Render {} +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +``` + + +# Render +container.querySelector("button").click() + +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/effect-counter/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-counter/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..9134a47e99 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/effect-counter/__snapshots__/ssr.expected.md @@ -0,0 +1,36 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + +
        + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/div0/button0 +inserted #document/html0/body1/div0/button0/#text0 +inserted #document/html0/body1/div0/#comment1 +inserted #document/html0/body1/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/effect-counter/template.marko b/packages/translator-tags/src/__tests__/fixtures/effect-counter/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-counter/template.marko rename to packages/translator-tags/src/__tests__/fixtures/effect-counter/template.marko diff --git a/packages/translator/src/__tests__/fixtures/effect-counter/test.ts b/packages/translator-tags/src/__tests__/fixtures/effect-counter/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-counter/test.ts rename to packages/translator-tags/src/__tests__/fixtures/effect-counter/test.ts diff --git a/packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..5b5f08b07d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,15 @@ +import { register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/effect-tag/template.marko_0_x", _scope => { + const { + x + } = _scope; + document.getElementById("ref").textContent = x; +}); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _queueEffect(_scope, _x_effect)); +const _setup = _scope => { + _x(_scope, 1); +}; +export const template = "
        0
        "; +export const walks = /* over(1) */"b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/effect-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..9479cafa3c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { write as _write, writeEffect as _writeEffect, 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(); + const x = 1; + _write("
        0
        "); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/effect-tag/template.marko_0_x"); + _writeScope(_scope0_id, { + "x": x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/effect-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..280deeda36 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/resume.expected.md @@ -0,0 +1,22 @@ +# Render undefined +```html + + + +
        + 1 +
        + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0 +inserted #document/html0/body1/div0/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..81e0986145 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/effect-tag/__snapshots__/ssr.expected.md @@ -0,0 +1,31 @@ +# Write +
        0
        + + +# Render "End" +```html + + + +
        + 0 +
        + + + +``` + +# 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/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/effect-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/effect-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/effect-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/effect-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/entities/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/entities/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/entities/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/entities/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f80e6aca18 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "Hello John & Suzy Invalid Entity: &b ; Valid Numeric Entity: " Valid Hexadecimal Entity: ¢"; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/entities/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..a726185063 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("Hello John & Suzy Invalid Entity: &b ; Valid Numeric Entity: " Valid Hexadecimal Entity: ¢"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/entities/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/entities/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/entities/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/entities/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/entities/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/entities/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/entities/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/entities/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/entities/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/entities/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/entities/template.marko b/packages/translator-tags/src/__tests__/fixtures/entities/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/entities/template.marko rename to packages/translator-tags/src/__tests__/fixtures/entities/template.marko diff --git a/packages/translator/src/__tests__/fixtures/error-async/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/error-async/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/error-async/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/error-async/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/error-async/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/error-async/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/error-async/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/error-async/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/error-async/server.ts b/packages/translator-tags/src/__tests__/fixtures/error-async/server.ts new file mode 100644 index 0000000000..6fb3fce6db --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/error-async/server.ts @@ -0,0 +1,10 @@ +import { createTemplate, fork, write } from "@marko/runtime-tags/src/html"; +import { rejectAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + fork(rejectAfter(new Error("ERROR!"), 1), write); + write("b"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/error-async/test.ts b/packages/translator-tags/src/__tests__/fixtures/error-async/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/error-async/test.ts rename to packages/translator-tags/src/__tests__/fixtures/error-async/test.ts diff --git a/packages/translator/src/__tests__/fixtures/error-sync/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/error-sync/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/error-sync/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/error-sync/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/error-sync/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/error-sync/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/error-sync/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/error-sync/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/error-sync/server.ts b/packages/translator-tags/src/__tests__/fixtures/error-sync/server.ts new file mode 100644 index 0000000000..17f38052dc --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/error-sync/server.ts @@ -0,0 +1,8 @@ +import { createTemplate, write } from "@marko/runtime-tags/src/html"; + +const renderer = () => { + write("a"); + throw new Error("ERROR!"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/error-sync/test.ts b/packages/translator-tags/src/__tests__/fixtures/error-sync/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/error-sync/test.ts rename to packages/translator-tags/src/__tests__/fixtures/error-sync/test.ts diff --git a/packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..c4fc1fb0cb --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/dom.expected/template.js @@ -0,0 +1,48 @@ +import { data as _data, on as _on, queueSource as _queueSource, value as _value, createRenderer as _createRenderer, loopOf as _loopOf, register as _register, queueEffect as _queueEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _description$forBody = /* @__PURE__ */_value("description", (_scope, description) => _data(_scope["#text/1"], description)); +const _name$forBody = /* @__PURE__ */_value("name", (_scope, name) => _data(_scope["#text/0"], name)); +const _forBody = /* @__PURE__ */_createRenderer("
        :
        ", /* next(1), replace, over(2), replace */"D%c%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let name, description; + if (!_clean) ({ + value: [{ + name, + description + }] + } = _destructure); + _name$forBody(_scope, name, _clean); + _description$forBody(_scope, description, _clean); +}); +const _for = /* @__PURE__ */_loopOf("#text/0", _forBody); +const _items_effect = _register("packages/translator-tags/src/__tests__/fixtures/for-destructure/template.marko_0_items", _scope => { + _on(_scope["#button/1"], "click", function () { + const { + items + } = _scope; + _queueSource(_scope, _items, [...items, { + name: "JavaScript", + description: "Java, but scriptier" + }]); + }); + _on(_scope["#button/2"], "click", function () { + const { + items + } = _scope; + _queueSource(_scope, _items, items.slice(0, -1)); + }); +}); +const _items = /* @__PURE__ */_value("items", (_scope, items) => { + _queueEffect(_scope, _items_effect); + _for(_scope, [items]); +}); +const _id = (_scope, id) => {}; +const _setup = _scope => { + _id(_scope, 0); + _items(_scope, [{ + name: "Marko", + description: "HTML Reimagined" + }]); +}; +export const template = "
        "; +export const walks = /* next(1), replace, over(1), get, over(1), get, out(1) */"D%b b l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/for-destructure/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..860d7eca83 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/html.expected/template.js @@ -0,0 +1,33 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, writeEffect as _writeEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const id = 0; + const items = [{ + name: "Marko", + description: "HTML Reimagined" + }]; + _write("
        "); + const _forScopeIds = [], + _scope1_ = new Map(); + let _i2 = 0; + for (const { + name, + description + } of items) { + const _scope1_id = _nextScopeId(); + let _i = _i2++; + _forScopeIds.push(_scope1_id); + _write(`
        ${_escapeXML(name)}${_markResumeNode(_scope1_id, "#text/0")}: ${_escapeXML(description)}${_markResumeNode(_scope1_id, "#text/1")}
        `); + _writeScope(_scope1_id, (_s => (_scope1_.set(_i, _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _forScopeIds)}${_markResumeNode(_scope0_id, "#button/1")}${_markResumeNode(_scope0_id, "#button/2")}
        `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/for-destructure/template.marko_0_items"); + _writeScope(_scope0_id, { + "items": items, + "#text/0(": _scope1_.size ? _scope1_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/for-destructure/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..8fdc741ae4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/resume.expected.md @@ -0,0 +1,203 @@ +# Render {} +```html + + + +
        +
        + Marko + + : + + HTML Reimagined + +
        + + + + + +
        + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("#add").click() + +```html + + + +
        +
        + Marko + + : + + HTML Reimagined + +
        +
        + JavaScript: Java, but scriptier +
        + + + + + +
        + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/div1 +``` + + +# Render +container.querySelector("#remove").click() + +```html + + + +
        +
        + Marko + + : + + HTML Reimagined + +
        + + + + + +
        + + + +``` + +# Mutations +``` +removed div after #document/html0/body1/div0/div0 +``` + + +# Render +container.querySelector("#remove").click() + +```html + + + +
        + + + + + +
        + + + +``` + +# Mutations +``` +removed #document/html0/body1/div0/#comment0 after div +inserted #document/html0/body1/div0/#comment0 +removed div before #document/html0/body1/div0/#comment0 +``` + + +# Render +container.querySelector("#add").click() + +```html + + + +
        +
        + JavaScript: Java, but scriptier +
        + + + + +
        + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/div0 +removed #comment before #document/html0/body1/div0/div0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-destructure/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..0fd7651726 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-destructure/__snapshots__/ssr.expected.md @@ -0,0 +1,62 @@ +# Write +
        Marko: HTML Reimagined
        + + +# Render "End" +```html + + + +
        +
        + Marko + + : + + HTML Reimagined + +
        + + + + + +
        + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/div0/div0 +inserted #document/html0/body1/div0/div0/#text0 +inserted #document/html0/body1/div0/div0/#comment1 +inserted #document/html0/body1/div0/div0/#text2 +inserted #document/html0/body1/div0/div0/#comment3 +inserted #document/html0/body1/div0/div0/#text4 +inserted #document/html0/body1/div0/div0/#comment5 +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/div0/button4 +inserted #document/html0/body1/div0/button4/#text0 +inserted #document/html0/body1/div0/#comment5 +inserted #document/html0/body1/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/for-destructure/template.marko b/packages/translator-tags/src/__tests__/fixtures/for-destructure/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-destructure/template.marko rename to packages/translator-tags/src/__tests__/fixtures/for-destructure/template.marko diff --git a/packages/translator/src/__tests__/fixtures/for-destructure/test.ts b/packages/translator-tags/src/__tests__/fixtures/for-destructure/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-destructure/test.ts rename to packages/translator-tags/src/__tests__/fixtures/for-destructure/test.ts diff --git a/packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..d97da00d74 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/dom.expected/template.js @@ -0,0 +1,30 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, loopOf as _loopOf, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _val$forBody2 = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/0"], val)); +const _forBody2 = /* @__PURE__ */_createRenderer("
        ", /* next(1), get */"D ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let val; + if (!_clean) ({ + value: [val] + } = _destructure); + _val$forBody2(_scope, val, _clean); +}); +const _val$forBody = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/0"], val)); +const _forBody = /* @__PURE__ */_createRenderer("
        ", /* next(1), get */"D ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure2, _clean) => { + let val; + if (!_clean) ({ + value: [val] + } = _destructure2); + _val$forBody(_scope, val, _clean); +}); +const _for2 = /* @__PURE__ */_loopOf("#text/1", _forBody2); +const _for = /* @__PURE__ */_loopOf("#div/0", _forBody); +const _arrA = /* @__PURE__ */_value("arrA", (_scope, arrA) => { + _for(_scope, [arrA]); + _for2(_scope, [arrA]); +}); +const _setup = _scope => { + _arrA(_scope, [1, 2, 3]); +}; +export const template = "
        "; +export const walks = /* get, over(1), next(1), replace, out(1) */" bD%l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..018c680017 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/html.expected/template.js @@ -0,0 +1,39 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const arrA = [1, 2, 3]; + _write("
        "); + const _forScopeIds = [], + _scope1_ = new Map(); + let _i2 = 0; + for (const val of arrA) { + const _scope1_id = _nextScopeId(); + let _i = _i2++; + _forScopeIds.push(_scope1_id); + _write(`
        ${_escapeXML(val)}${_markResumeNode(_scope1_id, "#text/0")}
        `); + _writeScope(_scope1_id, (_s => (_scope1_.set(_i, _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#div/0", _forScopeIds)}
        ${_markResumeNode(_scope0_id, "#div/0")}
        `); + const _forScopeIds2 = [], + _scope2_ = new Map(); + let _i4 = 0; + for (const val of arrA) { + const _scope2_id = _nextScopeId(); + let _i3 = _i4++; + _forScopeIds2.push(_scope2_id); + _write(`
        ${_escapeXML(val)}${_markResumeNode(_scope2_id, "#text/0")}
        `); + _writeScope(_scope2_id, (_s2 => (_scope2_.set(_i3, _s2), _s2))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/1", _forScopeIds2)}
        `); + _writeScope(_scope0_id, { + "#div/0(": _scope1_.size ? _scope1_ : undefined, + "#text/1(": _scope2_.size ? _scope2_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-siblings/template.marko b/packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-siblings/template.marko rename to packages/translator-tags/src/__tests__/fixtures/for-tag-siblings/template.marko diff --git a/packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..18d6f1bbc5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/dom.expected/template.js @@ -0,0 +1,33 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, loopOf as _loopOf, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _i$forBody2 = /* @__PURE__ */_value("i", (_scope, i) => _data(_scope["#text/0"], i)); +const _val$forBody2 = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/1"], val)); +const _forBody2 = /* @__PURE__ */_createRenderer("
        :
        ", /* next(1), replace, over(2), replace */"D%c%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let val, i; + if (!_clean) ({ + value: [val, i] + } = _destructure); + _val$forBody2(_scope, val, _clean); + _i$forBody2(_scope, i, _clean); +}); +const _i$forBody = /* @__PURE__ */_value("i", (_scope, i) => _data(_scope["#text/0"], i)); +const _val$forBody = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/1"], val)); +const _forBody = /* @__PURE__ */_createRenderer("
        :
        ", /* next(1), replace, over(2), replace */"D%c%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure2, _clean) => { + let val, i; + if (!_clean) ({ + value: [val, i] + } = _destructure2); + _val$forBody(_scope, val, _clean); + _i$forBody(_scope, i, _clean); +}); +const _for2 = /* @__PURE__ */_loopOf("#text/1", _forBody2); +const _for = /* @__PURE__ */_loopOf("#text/0", _forBody); +const _arrB = /* @__PURE__ */_value("arrB", (_scope, arrB) => _for2(_scope, [arrB])); +const _arrA = /* @__PURE__ */_value("arrA", (_scope, arrA) => _for(_scope, [arrA])); +const _setup = _scope => { + _arrA(_scope, [1, 2, 3]); + _arrB(_scope, [1, 2, 3]); +}; +export const template = ""; +export const walks = /* replace, over(1), replace, over(1) */"%b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..43816dbe16 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/html.expected/template.js @@ -0,0 +1,39 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const arrA = [1, 2, 3]; + const _forScopeIds = [], + _scope1_ = new Map(); + let _i = 0; + for (const val of arrA) { + const _scope1_id = _nextScopeId(); + let i = _i++; + _forScopeIds.push(_scope1_id); + _write(`
        ${_escapeXML(i)}${_markResumeNode(_scope1_id, "#text/0")}: ${_escapeXML(val)}${_markResumeNode(_scope1_id, "#text/1")}
        `); + _writeScope(_scope1_id, (_s => (_scope1_.set(i, _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + const arrB = [1, 2, 3]; + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _forScopeIds)}`); + const _forScopeIds2 = [], + _scope2_ = new Map(); + let _i2 = 0; + for (const val of arrB) { + const _scope2_id = _nextScopeId(); + let i = _i2++; + _forScopeIds2.push(_scope2_id); + _write(`
        ${_escapeXML(i)}${_markResumeNode(_scope2_id, "#text/0")}: ${_escapeXML(val)}${_markResumeNode(_scope2_id, "#text/1")}
        `); + _writeScope(_scope2_id, (_s2 => (_scope2_.set(i, _s2), _s2))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/1", _forScopeIds2)}`); + _writeScope(_scope0_id, { + "#text/0(": _scope1_.size ? _scope1_ : undefined, + "#text/1(": _scope2_.size ? _scope2_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag-with-state/template.marko b/packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag-with-state/template.marko rename to packages/translator-tags/src/__tests__/fixtures/for-tag-with-state/template.marko diff --git a/packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f8762ef910 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,147 @@ +import { data as _data, attr as _attr, createRenderer as _createRenderer, value as _value, loopTo as _loopTo, loopIn as _loopIn, loopOf as _loopOf, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _forBody11 = /* @__PURE__ */_createRenderer("Hello", ""); +const _forBody10 = /* @__PURE__ */_createRenderer("Hello", ""); +const _i$forBody7 = /* @__PURE__ */_value("i", (_scope, i) => { + _attr(_scope["#div/0"], "key", i); + _data(_scope["#text/1"], i); + _attr(_scope["#div/2"], "key", `other-${i}`); +}); +const _forBody9 = /* @__PURE__ */_createRenderer("
        ", /* get, next(1), get, out(1), over(1), get */" D lb ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let i; + if (!_clean) ({ + value: [i] + } = _destructure); + _i$forBody7(_scope, i, _clean); +}); +const _i$forBody6 = /* @__PURE__ */_value("i", (_scope, i) => { + _attr(_scope["#div/0"], "key", i); + _data(_scope["#text/1"], i); + _attr(_scope["#div/2"], "key", `other-${i}`); +}); +const _forBody8 = /* @__PURE__ */_createRenderer("
        ", /* get, next(1), get, out(1), over(1), get */" D lb ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure2, _clean) => { + let i; + if (!_clean) ({ + value: [i] + } = _destructure2); + _i$forBody6(_scope, i, _clean); +}); +const _for$forBody = /* @__PURE__ */_loopTo("#text/3", _forBody8); +const _i$forBody5 = /* @__PURE__ */_value("i", (_scope, i) => { + _attr(_scope["#div/0"], "key", i); + _data(_scope["#text/1"], i); + _attr(_scope["#div/2"], "key", `other-${i}`); +}); +const _setup$forBody = _scope => { + _for$forBody(_scope, [10, 0, 2]); +}; +const _forBody7 = /* @__PURE__ */_createRenderer("
        ", /* get, next(1), get, out(1), over(1), get, over(1), replace */" D lb b%", _setup$forBody, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure3, _clean) => { + let i; + if (!_clean) ({ + value: [i] + } = _destructure3); + _i$forBody5(_scope, i, _clean); +}); +const _val$forBody5 = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/2"], val)); +const _key$forBody2 = /* @__PURE__ */_value("key", (_scope, key) => { + _attr(_scope["#div/0"], "key", key); + _data(_scope["#text/1"], key); + _attr(_scope["#div/3"], "key", `other-${key}`); +}); +const _forBody6 = /* @__PURE__ */_createRenderer("
        :
        ", /* get, next(1), replace, over(2), replace, out(1), over(1), get */" D%c%lb ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure4, _clean) => { + let key, val; + if (!_clean) ({ + value: [key, val] + } = _destructure4); + _key$forBody2(_scope, key, _clean); + _val$forBody5(_scope, val, _clean); +}); +const _list$forBody = /* @__PURE__ */_value("list", (_scope, list) => _data(_scope["#text/1"], list.length)); +const _i$forBody4 = /* @__PURE__ */_value("i", (_scope, i) => _attr(_scope["#div/0"], "key", i)); +const _val$forBody4 = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/2"], val)); +const _forBody5 = /* @__PURE__ */_createRenderer("
        :
        ", /* get, next(1), replace, over(2), replace */" D%c%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure5, _clean) => { + let val, i, list; + if (!_clean) ({ + value: [val, i, list] + } = _destructure5); + _val$forBody4(_scope, val, _clean); + _i$forBody4(_scope, i, _clean); + _list$forBody(_scope, list, _clean); +}); +const _i$forBody3 = /* @__PURE__ */_value("i", (_scope, i) => { + _attr(_scope["#div/0"], "key", i); + _data(_scope["#text/1"], i); + _attr(_scope["#div/3"], "key", `other-${i}`); +}); +const _val$forBody3 = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/2"], val)); +const _forBody4 = /* @__PURE__ */_createRenderer("
        :
        ", /* get, next(1), replace, over(2), replace, out(1), over(1), get */" D%c%lb ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure6, _clean) => { + let val, i; + if (!_clean) ({ + value: [val, i] + } = _destructure6); + _val$forBody3(_scope, val, _clean); + _i$forBody3(_scope, i, _clean); +}); +const _i$forBody2 = /* @__PURE__ */_value("i", (_scope, i) => _data(_scope["#text/0"], i)); +const _forBody3 = /* @__PURE__ */_createRenderer("
        ", /* next(1), get */"D ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure7, _clean) => { + let i; + if (!_clean) ({ + value: [i] + } = _destructure7); + _i$forBody2(_scope, i, _clean); +}); +const _val$forBody2 = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/1"], val)); +const _key$forBody = /* @__PURE__ */_value("key", (_scope, key) => _data(_scope["#text/0"], key)); +const _forBody2 = /* @__PURE__ */_createRenderer("
        :
        ", /* next(1), replace, over(2), replace */"D%c%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure8, _clean) => { + let key, val; + if (!_clean) ({ + value: [key, val] + } = _destructure8); + _key$forBody(_scope, key, _clean); + _val$forBody2(_scope, val, _clean); +}); +const _i$forBody = /* @__PURE__ */_value("i", (_scope, i) => _data(_scope["#text/0"], i)); +const _val$forBody = /* @__PURE__ */_value("val", (_scope, val) => _data(_scope["#text/1"], val)); +const _forBody = /* @__PURE__ */_createRenderer("
        :
        ", /* next(1), replace, over(2), replace */"D%c%", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure9, _clean) => { + let val, i; + if (!_clean) ({ + value: [val, i] + } = _destructure9); + _val$forBody(_scope, val, _clean); + _i$forBody(_scope, i, _clean); +}); +const _for10 = /* @__PURE__ */_loopTo("#text/9", _forBody11); +const _for9 = /* @__PURE__ */_loopTo("#text/8", _forBody10); +const _for8 = /* @__PURE__ */_loopTo("#text/7", _forBody9); +const _for7 = /* @__PURE__ */_loopTo("#text/6", _forBody7); +const _for6 = /* @__PURE__ */_loopIn("#text/5", _forBody6); +const _for5 = /* @__PURE__ */_loopOf("#text/4", _forBody5); +const _for4 = /* @__PURE__ */_loopOf("#text/3", _forBody4); +const _for3 = /* @__PURE__ */_loopTo("#text/2", _forBody3); +const _for2 = /* @__PURE__ */_loopIn("#text/1", _forBody2); +const _for = /* @__PURE__ */_loopOf("#text/0", _forBody); +const _obj = /* @__PURE__ */_value("obj", (_scope, obj) => { + _for2(_scope, [obj]); + _for6(_scope, [obj]); +}); +const _arr = /* @__PURE__ */_value("arr", (_scope, arr) => { + _for(_scope, [arr]); + _for4(_scope, [arr]); + _for5(_scope, [arr]); +}); +const _setup = _scope => { + _arr(_scope, [1, 2, 3]); + _obj(_scope, { + a: 1, + b: 1, + c: 1 + }); + _for3(_scope, [10, 0, 2]); + _for7(_scope, [10, 0, 2]); + _for8(_scope, [0, 10, -2]); + _for9(_scope, [10, 0, 1]); + _for10(_scope, [10, 0, 1]); +}; +export const template = ""; +export const walks = /* replace, over(1), replace, over(1), replace, over(1), replace, over(1), replace, over(1), replace, over(1), replace, over(1), replace, over(1), replace, over(1), replace, over(1) */"%b%b%b%b%b%b%b%b%b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/for-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..9c0af15140 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,113 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, markResumeScopeStart as _markResumeScopeStart, serializedScope as _serializedScope, markResumeControlEnd as _markResumeControlEnd, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, attr as _attr, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const arr = [1, 2, 3]; + const obj = { + a: 1, + b: 1, + c: 1 + }; + const _scope1_ = new Map(); + let _i = 0; + for (const val of arr) { + const _scope1_id = _nextScopeId(); + let i = _i++; + _write(`${_markResumeScopeStart(_scope1_id)}
        ${_escapeXML(i)}${_markResumeNode(_scope1_id, "#text/0")}: ${_escapeXML(val)}${_markResumeNode(_scope1_id, "#text/1")}
        `); + _writeScope(_scope1_id, (_s => (_scope1_.set(i, _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlEnd(_scope0_id, "#text/0")}`); + const _scope2_ = new Map(); + for (const key in obj) { + const _scope2_id = _nextScopeId(); + const val = obj[key]; + _write(`${_markResumeScopeStart(_scope2_id)}
        ${_escapeXML(key)}${_markResumeNode(_scope2_id, "#text/0")}: ${_escapeXML(val)}${_markResumeNode(_scope2_id, "#text/1")}
        `); + _writeScope(_scope2_id, (_s2 => (_scope2_.set(key, _s2), _s2))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlEnd(_scope0_id, "#text/1")}`); + for (let _from = 0 ?? 0, _step = 2 ?? 1, _steps = (10 - _from) / _step, _i2 = 0; _i2 <= _steps; _i2++) { + const _scope3_id = _nextScopeId(); + const i = _from + _i2 * _step; + _write(`
        ${_escapeXML(i)}${_markResumeNode(_scope3_id, "#text/0")}
        `); + _maybeFlush(); + } + const _scope4_ = new Map(); + let _i3 = 0; + for (const val of arr) { + const _scope4_id = _nextScopeId(); + let i = _i3++; + _write(`${_markResumeScopeStart(_scope4_id)}${_escapeXML(i)}${_markResumeNode(_scope4_id, "#text/1")}: ${_escapeXML(val)}${_markResumeNode(_scope4_id, "#text/2")}${_markResumeNode(_scope4_id, "#div/0")}
        ${_markResumeNode(_scope4_id, "#div/3")}`); + _writeScope(_scope4_id, (_s3 => (_scope4_.set(i, _s3), _s3))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlEnd(_scope0_id, "#text/3")}`); + const _forScopeIds4 = [], + _scope5_ = new Map(); + let _i4 = 0; + const list = arr; + for (const val of list) { + const _scope5_id = _nextScopeId(); + let i = _i4++; + _forScopeIds4.push(_scope5_id); + _write(`${_escapeXML(list.length)}${_markResumeNode(_scope5_id, "#text/1")}: ${_escapeXML(val)}${_markResumeNode(_scope5_id, "#text/2")}${_markResumeNode(_scope5_id, "#div/0")}`); + _writeScope(_scope5_id, (_s4 => (_scope5_.set(i, _s4), _s4))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/4", _forScopeIds4)}`); + const _scope6_ = new Map(); + for (const key in obj) { + const _scope6_id = _nextScopeId(); + const val = obj[key]; + _write(`${_markResumeScopeStart(_scope6_id)}${_escapeXML(key)}${_markResumeNode(_scope6_id, "#text/1")}: ${_escapeXML(val)}${_markResumeNode(_scope6_id, "#text/2")}${_markResumeNode(_scope6_id, "#div/0")}
        ${_markResumeNode(_scope6_id, "#div/3")}`); + _writeScope(_scope6_id, (_s5 => (_scope6_.set(key, _s5), _s5))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlEnd(_scope0_id, "#text/5")}`); + for (let _from3 = 0 ?? 0, _step3 = 2 ?? 1, _steps3 = (10 - _from3) / _step3, _i6 = 0; _i6 <= _steps3; _i6++) { + const _scope7_id = _nextScopeId(); + const i = _from3 + _i6 * _step3; + _write(`${_escapeXML(i)}${_markResumeNode(_scope7_id, "#text/1")}${_markResumeNode(_scope7_id, "#div/0")}
        ${_markResumeNode(_scope7_id, "#div/2")}`); + for (let _from2 = 0 ?? 0, _step2 = 2 ?? 1, _steps2 = (10 - _from2) / _step2, _i5 = 0; _i5 <= _steps2; _i5++) { + const _scope8_id = _nextScopeId(); + const i = _from2 + _i5 * _step2; + _write(`${_escapeXML(i)}${_markResumeNode(_scope8_id, "#text/1")}${_markResumeNode(_scope8_id, "#div/0")}
        ${_markResumeNode(_scope8_id, "#div/2")}`); + _maybeFlush(); + } + _maybeFlush(); + } + for (let _from4 = 10 ?? 0, _step4 = -2 ?? 1, _steps4 = (0 - _from4) / _step4, _i7 = 0; _i7 <= _steps4; _i7++) { + const _scope9_id = _nextScopeId(); + const i = _from4 + _i7 * _step4; + _write(`${_escapeXML(i)}${_markResumeNode(_scope9_id, "#text/1")}${_markResumeNode(_scope9_id, "#div/0")}
        ${_markResumeNode(_scope9_id, "#div/2")}`); + _maybeFlush(); + } + for (let _from5 = 0 ?? 0, _step5 = 1 ?? 1, _steps5 = (10 - _from5) / _step5, _i8 = 0; _i8 <= _steps5; _i8++) { + const _scope10_id = _nextScopeId(); + _write("Hello"); + _maybeFlush(); + } + for (let _from6 = 0 ?? 0, _step6 = 1 ?? 1, _steps6 = (10 - _from6) / _step6, _i9 = 0; _i9 <= _steps6; _i9++) { + const _scope11_id = _nextScopeId(); + _write("Hello"); + _maybeFlush(); + } + _writeScope(_scope0_id, { + "#text/0(": _scope1_.size ? _scope1_ : undefined, + "#text/1(": _scope2_.size ? _scope2_ : undefined, + "#text/3(": _scope4_.size ? _scope4_ : undefined, + "#text/4(": _scope5_.size ? _scope5_ : undefined, + "#text/5(": _scope6_.size ? _scope6_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/for-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/for-tag/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/for-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/for-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/for-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/for-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..6e30ee8958 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/dom.expected/template.js @@ -0,0 +1,12 @@ +import { data as _data, html as _html, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _input = /* @__PURE__ */_value("input", (_scope, input) => { + _data(_scope["#text/0"], input.name); + _html(_scope, input.name, "#text/1"); + _html(_scope, input.missing, "#text/2"); +}); +export const attrs = _input; +export { _input }; +export const template = "Hello ! Hello ! Hello !"; +export const walks = /* over(1), replace, over(2), replace, over(2), replace, over(2) */"b%c%c%c"; +export const setup = function () {}; +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/hello-dynamic/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..c55d82a467 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, toString as _toString, 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(); + _write(`Hello ${_escapeXML(input.name)}${_markResumeNode(_scope0_id, "#text/0")}! Hello ${_toString(input.name)}${_markResumeNode(_scope0_id, "#text/1")}! Hello ${_toString(input.missing)}${_markResumeNode(_scope0_id, "#text/2")}!`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/hello-dynamic/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/template.marko b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/template.marko rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/template.marko diff --git a/packages/translator/src/__tests__/fixtures/hello-dynamic/test.ts b/packages/translator-tags/src/__tests__/fixtures/hello-dynamic/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/hello-dynamic/test.ts rename to packages/translator-tags/src/__tests__/fixtures/hello-dynamic/test.ts diff --git a/packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..31986e53ff --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/dom.expected/template.js @@ -0,0 +1,5 @@ +export const template = "
        <div>
        "; +export const walks = /* over(1) */"b"; +export const setup = function () {}; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/html-entity/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..e987c03df8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write("
        <div>
        "); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/html-entity/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/html-entity/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/html-entity/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/html-entity/template.marko b/packages/translator-tags/src/__tests__/fixtures/html-entity/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/html-entity/template.marko rename to packages/translator-tags/src/__tests__/fixtures/html-entity/template.marko diff --git a/packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..9bcf513fcd --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,11 @@ +import { nextTagId as _nextTagId, data as _data, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _y = /* @__PURE__ */_value("y", (_scope, y) => _data(_scope["#text/1"], y)); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _data(_scope["#text/0"], x)); +const _setup = _scope => { + _x(_scope, _nextTagId()); + _y(_scope, _nextTagId()); +}; +export const template = "
        "; +export const walks = /* next(1), get, out(1), replace, over(1) */"D l%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/id-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..f599094223 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,8 @@ +import { nextTagId as _nextTagId, 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 = _nextTagId(); + const y = _nextTagId(); + _write(`
        ${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}
        ${_escapeXML(y)}${_markResumeNode(_scope0_id, "#text/1")}`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/id-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/id-tag/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/id-tag/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/id-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/id-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/id-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/id-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/if-default-false/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/if-default-false/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/if-default-false/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/if-default-false/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..a58710c28d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/dom.expected/template.js @@ -0,0 +1,20 @@ +import { on as _on, queueSource as _queueSource, createRenderer as _createRenderer, register as _register, conditional as _conditional, queueEffect as _queueEffect, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/if-default-false/template.marko_1_renderer", /* @__PURE__ */_createRenderer("hi", "")); +const _if = /* @__PURE__ */_conditional("#text/1"); +const _show_effect = _register("packages/translator-tags/src/__tests__/fixtures/if-default-false/template.marko_0_show", _scope => _on(_scope["#button/0"], "click", function () { + const { + show + } = _scope; + _queueSource(_scope, _show, !show); +})); +const _show = /* @__PURE__ */_value("show", (_scope, show) => { + _queueEffect(_scope, _show_effect); + _if(_scope, show ? _ifBody : null); +}); +const _setup = _scope => { + _show(_scope, false); +}; +export const template = ""; +export const walks = /* get, over(1), replace, over(1) */" b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/if-default-false/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..91a204f7ba --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/html.expected/template.js @@ -0,0 +1,24 @@ +import { markResumeNode as _markResumeNode, write as _write, serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeEffect as _writeEffect, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const show = false; + _write(`${_markResumeNode(_scope0_id, "#button/0")}`); + let _ifScopeId, _scope1_, _ifRenderer; + if (show) { + const _scope1_id = _nextScopeId(); + _write("hi"); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/if-default-false/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/1", _ifScopeId)}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/if-default-false/template.marko_0_show"); + _writeScope(_scope0_id, { + "show": show, + "#text/1!": _scope1_, + "#text/1(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/if-default-false/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/if-default-false/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/if-default-false/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..6eb0f80b9e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/if-default-false/__snapshots__/resume.expected.md @@ -0,0 +1,91 @@ +# Render {} +```html + + + + + + +# Render "End" +```html + + + + "; +export const walks = /* get, over(1), replace, over(2), replace, over(1) */" b%c%b"; +export const setup = function () {}; +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/let-tag-derived/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..4dc29e502f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/html.expected/template.js @@ -0,0 +1,14 @@ +import { markResumeNode as _markResumeNode, escapeXML as _escapeXML, write as _write, writeEffect as _writeEffect, 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(); + const { + a + } = input; + const b = a * 2; + _write(`${_markResumeNode(_scope0_id, "#button/0")}${_escapeXML(a)}${_markResumeNode(_scope0_id, "#text/1")} ${_escapeXML(b)}${_markResumeNode(_scope0_id, "#text/2")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/let-tag-derived/template.marko_0_b"); + _writeScope(_scope0_id, { + "b": b + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/let-tag-derived/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag-derived/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-derived/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..de5f4f431c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/resume.expected.md @@ -0,0 +1,56 @@ +# Render {"a":2} +```html + + + + + + 2 + + + + 4 + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + 2 + + + + 5 + + + + +``` + +# Mutations +``` +#document/html0/body1/#text6: "4" => "5" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag-derived/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-derived/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..d025e4572a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/__snapshots__/ssr.expected.md @@ -0,0 +1,43 @@ +# Write + 2 4 + + +# Render "End" +```html + + + + + + 2 + + + + 4 + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/#text2 +inserted #document/html0/body1/#comment3 +inserted #document/html0/body1/#text4 +inserted #document/html0/body1/#comment5 +inserted #document/html0/body1/#text6 +inserted #document/html0/body1/#comment7 +inserted #document/html0/body1/script8 +inserted #document/html0/body1/script8/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag-derived/template.marko b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-derived/template.marko rename to packages/translator-tags/src/__tests__/fixtures/let-tag-derived/template.marko diff --git a/packages/translator/src/__tests__/fixtures/let-tag-derived/test.ts b/packages/translator-tags/src/__tests__/fixtures/let-tag-derived/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-derived/test.ts rename to packages/translator-tags/src/__tests__/fixtures/let-tag-derived/test.ts diff --git a/packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..8a25f72d5a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/dom.expected/template.js @@ -0,0 +1,21 @@ +import { queueSource as _queueSource, data as _data, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _y = /* @__PURE__ */_value("y", (_scope, y) => _data(_scope["#text/1"], y)); +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/template.marko_0_x", _scope => { + const { + x + } = _scope; + _queueSource(_scope, _y, x); + _queueSource(_scope, _x, 2); +}); +const _x = /* @__PURE__ */_value("x", (_scope, x) => { + _data(_scope["#text/0"], x); + _queueEffect(_scope, _x_effect); +}); +const _setup = _scope => { + _x(_scope, 1); + _y(_scope, 0); +}; +export const template = " "; +export const walks = /* next(1), get, out(1), next(1), get, out(1) */"D lD l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..e79c9fab02 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/html.expected/template.js @@ -0,0 +1,12 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const x = 1; + const y = 0; + _write(`${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}${_escapeXML(y)}${_markResumeNode(_scope0_id, "#text/1")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/template.marko_0_x"); + _writeScope(_scope0_id, { + "x": x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..a1b0275d07 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/resume.expected.md @@ -0,0 +1,77 @@ +# Render {} +```html + + + + + 1 + + + + 0 + + + + + +``` + +# Mutations +``` + +``` + + +# Render "ASYNC" +```html + + + + + 2 + + + + 1 + + + + + +``` + +# Mutations +``` +#document/html0/body1/span1/#text0: "0" => "1" +#document/html0/body1/span0/#text0: "1" => "2" +``` + + +# Render "ASYNC" +```html + + + + + 2 + + + + 2 + + + + + +``` + +# Mutations +``` +#document/html0/body1/span1/#text0: "1" => "2" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..6e86a03cba --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/__snapshots__/ssr.expected.md @@ -0,0 +1,38 @@ +# Write + 10 + + +# Render "End" +```html + + + + + 1 + + + + 0 + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/span0 +inserted #document/html0/body1/span0/#text0 +inserted #document/html0/body1/span0/#comment1 +inserted #document/html0/body1/span1 +inserted #document/html0/body1/span1/#text0 +inserted #document/html0/body1/span1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/template.marko b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/template.marko rename to packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/template.marko diff --git a/packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/test.ts b/packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag-set-in-effect/test.ts rename to packages/translator-tags/src/__tests__/fixtures/let-tag-set-in-effect/test.ts diff --git a/packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..0b74e92e14 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,25 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, intersection as _intersection, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _expr_x_y_effect = _register("packages/translator-tags/src/__tests__/fixtures/let-tag/template.marko_0_x_y", _scope => _on(_scope["#button/0"], "click", () => { + const { + x, + y + } = _scope; + return _queueSource(_scope, _x, _queueSource(_scope, _y, x + y)); +})); +const _expr_x_y = /* @__PURE__ */_intersection(2, _scope => { + const { + x, + y + } = _scope; + _queueEffect(_scope, _expr_x_y_effect); +}); +const _y = /* @__PURE__ */_value("y", (_scope, y) => _data(_scope["#text/2"], y), _expr_x_y); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _data(_scope["#text/1"], x), _expr_x_y); +const _setup = _scope => { + _x(_scope, 1); + _y(_scope, 1); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1), replace, over(1) */" D l%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/let-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..f4fc2a743f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const x = 1; + const y = 1; + _write(`${_markResumeNode(_scope0_id, "#button/0")}${_escapeXML(y)}${_markResumeNode(_scope0_id, "#text/2")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/let-tag/template.marko_0_x_y"); + _writeScope(_scope0_id, { + "x": x, + "y": y + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/let-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..c9996ee3cc --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/resume.expected.md @@ -0,0 +1,107 @@ +# Render {} +```html + + + + + + 1 + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + 2 + + + + +``` + +# Mutations +``` +#document/html0/body1/#text2: "1" => "2" +#document/html0/body1/button0/#text0: "1" => "2" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + 4 + + + + +``` + +# Mutations +``` +#document/html0/body1/#text2: "2" => "4" +#document/html0/body1/button0/#text0: "2" => "4" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + 8 + + + + +``` + +# Mutations +``` +#document/html0/body1/#text2: "4" => "8" +#document/html0/body1/button0/#text0: "4" => "8" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..d3ca30ec45 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-tag/__snapshots__/ssr.expected.md @@ -0,0 +1,37 @@ +# Write + 1 + + +# Render "End" +```html + + + + + + 1 + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/#text2 +inserted #document/html0/body1/#comment3 +inserted #document/html0/body1/script4 +inserted #document/html0/body1/script4/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/let-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/let-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/let-tag/test.ts b/packages/translator-tags/src/__tests__/fixtures/let-tag/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-tag/test.ts rename to packages/translator-tags/src/__tests__/fixtures/let-tag/test.ts diff --git a/packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..5127b1461c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/dom.expected/template.js @@ -0,0 +1,11 @@ +import { queueSource as _queueSource, data as _data, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x = /* @__PURE__ */_value("x", (_scope, x) => _data(_scope["#text/0"], x)); +const _setup_effect = _register("packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/template.marko_0", _scope => _queueSource(_scope, _x, "Client Only")); +const _setup = _scope => { + _queueEffect(_scope, _setup_effect); + _x(_scope, undefined); +}; +export const template = "
        "; +export const walks = /* next(1), get, out(1) */"D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..8b33517f1f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/html.expected/template.js @@ -0,0 +1,8 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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 = undefined; + _write(`
        ${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}
        `); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/template.marko_0"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..6ae7452466 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/resume.expected.md @@ -0,0 +1,42 @@ +# Render {} +```html + + + +
        + ‍ + +
        + + + +``` + +# Mutations +``` + +``` + + +# Render "ASYNC" +```html + + + +
        + Client Only + +
        + + + +``` + +# Mutations +``` +#document/html0/body1/div0/#text0: "‍" => "Client Only" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..6b68873539 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/__snapshots__/ssr.expected.md @@ -0,0 +1,31 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + ‍ + +
        + + + +``` + +# 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/script1 +inserted #document/html0/body1/script1/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/let-undefined-until-dom/template.marko b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-undefined-until-dom/template.marko rename to packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/template.marko diff --git a/packages/translator/src/__tests__/fixtures/let-undefined-until-dom/test.ts b/packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/let-undefined-until-dom/test.ts rename to packages/translator-tags/src/__tests__/fixtures/let-undefined-until-dom/test.ts diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..410d88af0c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/dom.expected/template.js @@ -0,0 +1,37 @@ +import { queueSource as _queueSource, lifecycle as _lifecycle, data as _data, on as _on, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _prev = /* @__PURE__ */_value("prev", (_scope, prev) => _data(_scope["#text/1"], prev)); +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko_0_x", _scope => { + _lifecycle(_scope, "cleanup", { + onMount: function () { + const { + x + } = _scope; + this.cur = x; + }, + onUpdate: function () { + const { + x + } = _scope; + _queueSource(_scope, _prev, this.cur); + this.cur = x; + } + }); + _on(_scope["#button/2"], "click", function () { + const { + x + } = _scope; + _queueSource(_scope, _x, x + 1); + }); +}); +const _x = /* @__PURE__ */_value("x", (_scope, x) => { + _data(_scope["#text/0"], x); + _queueEffect(_scope, _x_effect); +}); +const _setup = _scope => { + _x(_scope, 0); + _prev(_scope, false); +}; +export const template = "
        x= , was=
        "; +export const walks = /* next(1), over(1), next(1), get, out(1), over(1), replace, out(1), get, over(1) */"DbD lb%l b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..58efbe560d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/html.expected/template.js @@ -0,0 +1,12 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const x = 0; + const prev = false; + _write(`
        x=${_escapeXML(x)}${_markResumeNode(_scope0_id, "#text/0")}, was=${_escapeXML(prev)}${_markResumeNode(_scope0_id, "#text/1")}
        ${_markResumeNode(_scope0_id, "#button/2")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko_0_x"); + _writeScope(_scope0_id, { + "x": x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..1386328aae --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/resume.expected.md @@ -0,0 +1,143 @@ +# Render {} +```html + + + +
        + x= + + 0 + + + , was= + + ‍ + +
        + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("#increment")?.click() + +```html + + + +
        + x= + + 1 + + + , was= + + 0 + +
        + + + + + +``` + +# Mutations +``` +#document/html0/body1/div0/span1/#text0: "0" => "1" +#document/html0/body1/div0/#text4: "‍" => "0" +``` + + +# Render +container.querySelector("#increment")?.click() + +```html + + + +
        + x= + + 2 + + + , was= + + 0 + +
        + + + + + +``` + +# Mutations +``` +#document/html0/body1/div0/span1/#text0: "1" => "2" +``` + + +# Render "ASYNC" +```html + + + +
        + x= + + 2 + + + , was= + + 1 + +
        + + + + + +``` + +# Mutations +``` +#document/html0/body1/div0/#text4: "0" => "1" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..84b303190d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/__snapshots__/ssr.expected.md @@ -0,0 +1,53 @@ +# Write +
        x=0, was=
        + + +# Render "End" +```html + + + +
        + x= + + 0 + + + , was= + + ‍ + +
        + + + + + +``` + +# 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/span1 +inserted #document/html0/body1/div0/span1/#text0 +inserted #document/html0/body1/div0/span1/#comment1 +inserted #document/html0/body1/div0/#text2 +inserted #document/html0/body1/div0/#comment3 +inserted #document/html0/body1/div0/#text4 +inserted #document/html0/body1/div0/#comment5 +inserted #document/html0/body1/button1 +inserted #document/html0/body1/button1/#text0 +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/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/template.marko diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/test.ts b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-assignment/test.ts rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-assignment/test.ts diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..5335281048 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/dom.expected/template.js @@ -0,0 +1,50 @@ +import { lifecycle as _lifecycle, on as _on, queueSource as _queueSource, register as _register, queueEffect as _queueEffect, closure as _closure, createRenderer as _createRenderer, conditional as _conditional, value as _value, inConditionalScope as _inConditionalScope, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x$ifBody_effect = _register("packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko_1_x", _scope => _lifecycle(_scope, "cleanup", { + onMount: function () { + const { + _: { + x + } + } = _scope; + document.getElementById("ref").textContent = "Mount " + x; + }, + onUpdate: function () { + const { + _: { + x + } + } = _scope; + document.getElementById("ref").textContent = "Update " + x; + }, + onDestroy: function () { + document.getElementById("ref").textContent = "Destroy"; + } +})); +const _x$ifBody = /* @__PURE__ */_closure("x", (_scope, x) => _queueEffect(_scope, _x$ifBody_effect)); +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko_1_renderer", /* @__PURE__ */_createRenderer("", "", void 0, [_x$ifBody])); +const _if = /* @__PURE__ */_conditional("#text/0"); +const _show_effect = _register("packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko_0_show", _scope => _on(_scope["#button/2"], "click", function () { + const { + show + } = _scope; + _queueSource(_scope, _show, !show); +})); +const _show = /* @__PURE__ */_value("show", (_scope, show) => { + _queueEffect(_scope, _show_effect); + _if(_scope, show ? _ifBody : null); +}, void 0, _if); +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/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) => _queueEffect(_scope, _x_effect), _inConditionalScope(_x$ifBody, "#text/0")); +const _setup = _scope => { + _x(_scope, 0); + _show(_scope, true); +}; +export const template = "
        "; +export const walks = /* replace, over(2), get, over(1), get, over(1) */"%c b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..8f3f54c7ff --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/__snapshots__/html.expected/template.js @@ -0,0 +1,26 @@ +import { serializedScope as _serializedScope, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, markResumeNode as _markResumeNode, write as _write, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const x = 0; + const show = true; + let _ifScopeId, _scope1_, _ifRenderer; + if (show) { + const _scope1_id = _nextScopeId(); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko_1_x"); + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _ifScopeId)}
        ${_markResumeNode(_scope0_id, "#button/1")}${_markResumeNode(_scope0_id, "#button/2")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko_0_show"); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko_0_x"); + _writeScope(_scope0_id, { + "x": x, + "show": show, + "#text/0!": _scope1_, + "#text/0(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/template.marko diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/test.ts b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-conditional/test.ts rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-conditional/test.ts diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..a1fa4fd8b5 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/dom.expected/template.js @@ -0,0 +1,29 @@ +import { lifecycle as _lifecycle, on as _on, queueSource as _queueSource, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/template.marko_0_x", _scope => { + _lifecycle(_scope, "cleanup", { + onMount: function () { + this.onUpdate(); + }, + onUpdate: function () { + const { + x + } = _scope; + document.getElementById("ref").textContent = `x=${x}, was=${this.cur}`; + this.cur = x; + } + }); + _on(_scope["#button/0"], "click", function () { + const { + x + } = _scope; + _queueSource(_scope, _x, x + 1); + }); +}); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _queueEffect(_scope, _x_effect)); +const _setup = _scope => { + _x(_scope, 0); +}; +export const template = "
        "; +export const walks = /* over(1), get, over(1) */"b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..f8248368bc --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const x = 0; + _write(`
        ${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/template.marko_0_x"); + _writeScope(_scope0_id, { + "x": x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..658af56d10 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/resume.expected.md @@ -0,0 +1,91 @@ +# Render {} +```html + + + +
        + x=0, was=undefined +
        + + + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#text0 +``` + + +# Render +container.querySelector("#increment")?.click() + +```html + + + +
        + x=1, was=0 +
        + + + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0 +inserted #document/html0/body1/div0/#text0 +``` + + +# Render +container.querySelector("#increment")?.click() + +```html + + + +
        + x=2, was=1 +
        + + + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0 +inserted #document/html0/body1/div0/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..94edf5ff9d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/__snapshots__/ssr.expected.md @@ -0,0 +1,37 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/button1 +inserted #document/html0/body1/button1/#text0 +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/src/__tests__/fixtures/lifecycle-tag-this/template.marko b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-this/template.marko rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/template.marko diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag-this/test.ts b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag-this/test.ts rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag-this/test.ts diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..e5c935e6fa --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,31 @@ +import { lifecycle as _lifecycle, on as _on, queueSource as _queueSource, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x_effect = _register("packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/template.marko_0_x", _scope => { + _lifecycle(_scope, "cleanup", { + onMount: function () { + const { + x + } = _scope; + document.getElementById("ref").textContent = "Mount " + x; + }, + onUpdate: function () { + const { + x + } = _scope; + document.getElementById("ref").textContent = "Update " + x; + } + }); + _on(_scope["#button/0"], "click", function () { + const { + x + } = _scope; + _queueSource(_scope, _x, x + 1); + }); +}); +const _x = /* @__PURE__ */_value("x", (_scope, x) => _queueEffect(_scope, _x_effect)); +const _setup = _scope => { + _x(_scope, 0); +}; +export const template = "
        "; +export const walks = /* over(1), get, over(1) */"b b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..fa6ab472ea --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const x = 0; + _write(`
        ${_markResumeNode(_scope0_id, "#button/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/template.marko_0_x"); + _writeScope(_scope0_id, { + "x": x + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..20f6cd8323 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/resume.expected.md @@ -0,0 +1,91 @@ +# Render {} +```html + + + +
        + Mount 0 +
        + + + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#text0 +``` + + +# Render +container.querySelector("#increment")?.click() + +```html + + + +
        + Update 1 +
        + + + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0 +inserted #document/html0/body1/div0/#text0 +``` + + +# Render +container.querySelector("#increment")?.click() + +```html + + + +
        + Update 2 +
        + + + + + +``` + +# Mutations +``` +removed #text in #document/html0/body1/div0 +inserted #document/html0/body1/div0/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..be955e25a6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/__snapshots__/ssr.expected.md @@ -0,0 +1,37 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/button1 +inserted #document/html0/body1/button1/#text0 +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/src/__tests__/fixtures/lifecycle-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/lifecycle-tag/test.ts b/packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/lifecycle-tag/test.ts rename to packages/translator-tags/src/__tests__/fixtures/lifecycle-tag/test.ts diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..06e2b97659 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/dom.expected/template.js @@ -0,0 +1,8 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _input = /* @__PURE__ */_value("input", (_scope, input) => _data(_scope["#text/0"], input.x)); +export const attrs = _input; +export { _input }; +export const template = "
        "; +export const walks = /* next(2), get, out(2) */"E m"; +export const setup = function () {}; +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/migrate-input/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..467947bac7 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/html.expected/template.js @@ -0,0 +1,6 @@ +import { 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(); + _write(`
        ${_escapeXML(input.x)}${_markResumeNode(_scope0_id, "#text/0")}
        `); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/migrate-input/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/template.marko b/packages/translator-tags/src/__tests__/fixtures/migrate-input/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/template.marko rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/template.marko diff --git a/packages/translator/src/__tests__/fixtures/migrate-input/test.ts b/packages/translator-tags/src/__tests__/fixtures/migrate-input/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-input/test.ts rename to packages/translator-tags/src/__tests__/fixtures/migrate-input/test.ts 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 new file mode 100644 index 0000000000..3cf37c8a4b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/dom.expected/template.js @@ -0,0 +1,7 @@ +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)); +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 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 new file mode 100644 index 0000000000..81aae8b3a6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/html.expected/template.js @@ -0,0 +1,7 @@ +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 _$global = _getInContext("$"); + _write(`
        ${_escapeXML(_$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/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/migrate-out-global/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/migrate-out-global/template.marko b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-out-global/template.marko rename to packages/translator-tags/src/__tests__/fixtures/migrate-out-global/template.marko diff --git a/packages/translator/src/__tests__/fixtures/migrate-out-global/test.ts b/packages/translator-tags/src/__tests__/fixtures/migrate-out-global/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/migrate-out-global/test.ts rename to packages/translator-tags/src/__tests__/fixtures/migrate-out-global/test.ts diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..26ecc47aef --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/dom.expected/template.js @@ -0,0 +1,25 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, loopOf as _loopOf, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _child$forBody = /* @__PURE__ */_value("child", (_scope, child) => _data(_scope["#text/0"], child.text)); +const _forBody = /* @__PURE__ */_createRenderer(" ", /* get */" ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let child; + if (!_clean) ({ + value: [child] + } = _destructure); + _child$forBody(_scope, child, _clean); +}); +const _for = /* @__PURE__ */_loopOf("#div/0", _forBody); +const _children = /* @__PURE__ */_value("children", (_scope, children) => _for(_scope, [children, function (c) { + return c.id; +}])); +export const attrs = (_scope, _destructure2, _clean) => { + let children; + if (!_clean) ({ + children + } = _destructure2); + _children(_scope, children, _clean); +}; +export { _children }; +export const template = "
        "; +export const walks = /* get, over(1) */" b"; +export const setup = function () {}; +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/move-and-clear-children/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..156f05fcc0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/html.expected/template.js @@ -0,0 +1,28 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + children +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write("
        "); + const _forScopeIds = [], + _scope1_ = new Map(); + const _by = function (c) { + return c.id; + }; + let _i2 = 0; + for (const child of children) { + const _scope1_id = _nextScopeId(); + let _i = _i2++; + _forScopeIds.push(_scope1_id); + _write(`${_escapeXML(child.text)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, (_s => (_scope1_.set(_by(child, _i), _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#div/0", _forScopeIds)}
        ${_markResumeNode(_scope0_id, "#div/0")}`); + _writeScope(_scope0_id, { + "#div/0(": _scope1_.size ? _scope1_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/template.marko b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/template.marko rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/template.marko diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-children/test.ts b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-children/test.ts rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-children/test.ts diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..5060aa5a7d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/dom.expected/template.js @@ -0,0 +1,19 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, loopOf as _loopOf, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _child$forBody = /* @__PURE__ */_value("child", (_scope, child) => _data(_scope["#text/0"], child.text)); +const _forBody = /* @__PURE__ */_createRenderer(" ", /* get */" ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let child; + if (!_clean) ({ + value: [child] + } = _destructure); + _child$forBody(_scope, child, _clean); +}); +const _for = /* @__PURE__ */_loopOf("#text/0", _forBody); +const _input = /* @__PURE__ */_value("input", (_scope, input) => _for(_scope, [input.children, function (c) { + return c.id; +}])); +export const attrs = _input; +export { _input }; +export const template = ""; +export const walks = /* replace, over(1) */"%b"; +export const setup = function () {}; +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/move-and-clear-top-level/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..b123b7afdf --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/html.expected/template.js @@ -0,0 +1,25 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, write as _write, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const _forScopeIds = [], + _scope1_ = new Map(); + const _by = function (c) { + return c.id; + }; + let _i2 = 0; + for (const child of input.children) { + const _scope1_id = _nextScopeId(); + let _i = _i2++; + _forScopeIds.push(_scope1_id); + _write(`${_escapeXML(child.text)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, (_s => (_scope1_.set(_by(child, _i), _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _forScopeIds)}`); + _writeScope(_scope0_id, { + "#text/0(": _scope1_.size ? _scope1_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/template.marko b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/template.marko rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/template.marko diff --git a/packages/translator/src/__tests__/fixtures/move-and-clear-top-level/test.ts b/packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/move-and-clear-top-level/test.ts rename to packages/translator-tags/src/__tests__/fixtures/move-and-clear-top-level/test.ts diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..23322a5641 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/dom.expected/template.js @@ -0,0 +1,14 @@ +import { register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, conditional as _conditional, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup$ifBody_effect = _register("packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko_1", _scope => _scope._["#div/0"].textContent = "hello"); +const _setup$ifBody = _scope => { + _queueEffect(_scope, _setup$ifBody_effect); +}; +const _ifBody = /* @__PURE__ */_createRenderer("", "", _setup$ifBody); +const _if = /* @__PURE__ */_conditional("#text/1"); +const _setup = _scope => { + _if(_scope, true ? _ifBody : null); +}; +export const template = "
        "; +export const walks = /* get, over(1), replace, over(1) */" b%b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..5659fa8536 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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 el = () => { + throw new Error("Cannot reference DOM node from server"); + }; + _write(`
        ${_markResumeNode(_scope0_id, "#div/0")}`); + if (true) { + const _scope1_id = _nextScopeId(); + _writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko_1"); + } +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..281efed50b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/__snapshots__/ssr.expected.md @@ -0,0 +1,28 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/template.marko diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/test.ts b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-downstream-effect/test.ts rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-downstream-effect/test.ts diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/dom.expected/components/hello-setter.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/dom.expected/components/hello-setter.js new file mode 100644 index 0000000000..b9322b0b4a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/dom.expected/components/hello-setter.js @@ -0,0 +1,20 @@ +import { register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _el_effect = _register("packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/components/hello-setter.marko_0_el", _scope => { + const { + el + } = _scope; + el().textContent = "hello"; +}); +const _el = /* @__PURE__ */_value("el", (_scope, el) => _queueEffect(_scope, _el_effect)); +export const attrs = (_scope, _destructure, _clean) => { + let el; + if (!_clean) ({ + el + } = _destructure); + _el(_scope, el, _clean); +}; +export { _el }; +export const template = ""; +export const walks = ""; +export const setup = function () {}; +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/native-tag-ref-effect-child/components/hello-setter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..c93a10ee8f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/dom.expected/template.js @@ -0,0 +1,13 @@ +import { bindFunction as _bindFunction, inChild as _inChild, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const el_getter = _scope => _scope["#div/0"]; +import { setup as _helloSetter, attrs as _helloSetter_attrs, template as _helloSetter_template, walks as _helloSetter_walks } from "./components/hello-setter.marko"; +const _setup = _scope => { + _helloSetter(_scope["#childScope/1"]); + _helloSetter_attrs(_scope["#childScope/1"], { + el: /* @__PURE__ */_bindFunction(_scope, el_getter) + }); +}; +export const template = `
        ${_helloSetter_template}`; +export const walks = /* get, over(1), beginChild, _helloSetter_walks, endChild */` b/${_helloSetter_walks}&`; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/html.expected/components/hello-setter.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/html.expected/components/hello-setter.js new file mode 100644 index 0000000000..01212162fd --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/html.expected/components/hello-setter.js @@ -0,0 +1,11 @@ +import { writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + el +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/components/hello-setter.marko_0_el"); + _writeScope(_scope0_id, { + "el": el + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/components/hello-setter.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..09138f4a9d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { markResumeNode as _markResumeNode, write as _write, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +import _helloSetter from "./components/hello-setter.marko"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + const el = () => { + throw new Error("Cannot reference DOM node from server"); + }; + _write(`
        ${_markResumeNode(_scope0_id, "#div/0")}`); + _helloSetter._({ + el: el + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..1d7f05da0c --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/__snapshots__/ssr.expected.md @@ -0,0 +1,28 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/components/hello-setter.marko b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/components/hello-setter.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/components/hello-setter.marko rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/components/hello-setter.marko diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/template.marko b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/template.marko rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/template.marko diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/test.ts b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect-child/test.ts rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect-child/test.ts diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..188b329308 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/dom.expected/template.js @@ -0,0 +1,9 @@ +import { register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup_effect = _register("packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/template.marko_0", _scope => _scope["#div/0"].textContent = "hello"); +const _setup = _scope => { + _queueEffect(_scope, _setup_effect); +}; +export const template = "
        "; +export const walks = /* get, over(1) */" b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..15c9ffd97b --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/html.expected/template.js @@ -0,0 +1,10 @@ +import { markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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 el = () => { + throw new Error("Cannot reference DOM node from server"); + }; + _write(`
        ${_markResumeNode(_scope0_id, "#div/0")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/template.marko_0"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..e8a0d62d8a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/resume.expected.md @@ -0,0 +1,20 @@ +# Render undefined +```html + + + +
        + hello +
        + + + + +``` + +# Mutations +``` +inserted #document/html0/body1/div0/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..d61efdaedf --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/__snapshots__/ssr.expected.md @@ -0,0 +1,28 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-effect/template.marko b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-effect/template.marko rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-effect/template.marko diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..784caec656 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { markResumeNode as _markResumeNode, write as _write, nextScopeId as _nextScopeId, writeEffect as _writeEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + if (true) { + const _scope1_id = _nextScopeId(); + const el = () => { + throw new Error("Cannot reference DOM node from server"); + }; + _write(`
        ${_markResumeNode(_scope1_id, "#div/0")}`); + } + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/template.marko_0"); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..ef606900b6 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/__snapshots__/ssr.expected.md @@ -0,0 +1,28 @@ +# Write +
        + + +# Render "End" +```html + + + +
        + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/div0 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/script2 +inserted #document/html0/body1/script2/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-hoisting/template.marko b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-hoisting/template.marko rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/template.marko diff --git a/packages/translator/src/__tests__/fixtures/native-tag-ref-hoisting/test.ts b/packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/native-tag-ref-hoisting/test.ts rename to packages/translator-tags/src/__tests__/fixtures/native-tag-ref-hoisting/test.ts diff --git a/packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..61c51b1cf9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/dom.expected/template.js @@ -0,0 +1,23 @@ +import { on as _on, queueSource as _queueSource, data as _data, value as _value, register as _register, queueEffect as _queueEffect, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _lastCount2 = /* @__PURE__ */_value("lastCount2", (_scope, lastCount2) => _data(_scope["#text/3"], lastCount2)); +const _lastCount = /* @__PURE__ */_value("lastCount", (_scope, lastCount) => _data(_scope["#text/2"], lastCount)); +const _clickCount_effect = _register("packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/template.marko_0_clickCount", _scope => _on(_scope["#button/0"], "click", function () { + const { + clickCount + } = _scope; + const last = _queueSource(_scope, _lastCount, (_queueSource(_scope, _clickCount, clickCount + 1), clickCount)); + _queueSource(_scope, _lastCount2, last); +})); +const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => { + _data(_scope["#text/1"], clickCount); + _queueEffect(_scope, _clickCount_effect); +}); +const _setup = _scope => { + _clickCount(_scope, 0); + _lastCount(_scope, 0); + _lastCount2(_scope, 0); +}; +export const template = "used to be which should be the same as "; +export const walks = /* get, next(1), get, out(1), over(1), next(1), get, out(1), over(1), next(1), get, out(1) */" D lbD lbD l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..38405b3244 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/html.expected/template.js @@ -0,0 +1,13 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const clickCount = 0; + const lastCount = 0; + const lastCount2 = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}used to be ${_escapeXML(lastCount)}${_markResumeNode(_scope0_id, "#text/2")} which should be the same as ${_escapeXML(lastCount2)}${_markResumeNode(_scope0_id, "#text/3")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/template.marko_0_clickCount"); + _writeScope(_scope0_id, { + "clickCount": clickCount + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..0fc1e6492a --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/resume.expected.md @@ -0,0 +1,140 @@ +# Render {} +```html + + + + + + used to be + + 0 + + + which should be the same as + + 0 + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + used to be + + 0 + + + which should be the same as + + 0 + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + used to be + + 1 + + + which should be the same as + + 1 + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "1" => "2" +#document/html0/body1/span3/#text0: "0" => "1" +#document/html0/body1/span5/#text0: "0" => "1" +``` + + +# Render +container.querySelector("button").click() + +```html + + + + + + used to be + + 2 + + + which should be the same as + + 2 + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "2" => "3" +#document/html0/body1/span3/#text0: "1" => "2" +#document/html0/body1/span5/#text0: "1" => "2" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..1c112c3964 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/__snapshots__/ssr.expected.md @@ -0,0 +1,51 @@ +# Write + used to be 0 which should be the same as 0 + + +# Render "End" +```html + + + + + + used to be + + 0 + + + which should be the same as + + 0 + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/#text2 +inserted #document/html0/body1/span3 +inserted #document/html0/body1/span3/#text0 +inserted #document/html0/body1/span3/#comment1 +inserted #document/html0/body1/#text4 +inserted #document/html0/body1/span5 +inserted #document/html0/body1/span5/#text0 +inserted #document/html0/body1/span5/#comment1 +inserted #document/html0/body1/script6 +inserted #document/html0/body1/script6/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/nested-assignment-expression/template.marko b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/nested-assignment-expression/template.marko rename to packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/template.marko diff --git a/packages/translator/src/__tests__/fixtures/nested-assignment-expression/test.ts b/packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/nested-assignment-expression/test.ts rename to packages/translator-tags/src/__tests__/fixtures/nested-assignment-expression/test.ts diff --git a/packages/translator/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholder-context/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/placeholder-context/server.ts b/packages/translator-tags/src/__tests__/fixtures/placeholder-context/server.ts new file mode 100644 index 0000000000..ab62138469 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/placeholder-context/server.ts @@ -0,0 +1,40 @@ +import { + createTemplate, + fork, + getInContext, + popContext, + pushContext, + tryPlaceholder, + write, +} from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const k = "KEY"; +const renderer = () => { + write("a"); + pushContext(k, "2"); + tryPlaceholder( + () => { + write("b"); + fork(resolveAfter("c", 2), (r) => { + const v = getInContext(k) as string; + write(r + v); + }); + write("d"); + }, + () => { + write("e..."); + }, + ); + write("f"); + fork(resolveAfter("g", 1), write); + write("h"); + popContext(); + try { + getInContext(k); + } catch (err) { + write("\ncontext cleared"); + } +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/placeholder-context/test.ts b/packages/translator-tags/src/__tests__/fixtures/placeholder-context/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-context/test.ts rename to packages/translator-tags/src/__tests__/fixtures/placeholder-context/test.ts diff --git a/packages/translator/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholder-single/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/placeholder-single/server.ts b/packages/translator-tags/src/__tests__/fixtures/placeholder-single/server.ts new file mode 100644 index 0000000000..5aea714a9d --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/placeholder-single/server.ts @@ -0,0 +1,26 @@ +import { + createTemplate, + fork, + tryPlaceholder, + write, +} from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + tryPlaceholder( + () => { + write("b"); + fork(resolveAfter("c", 2), write); + write("d"); + }, + () => { + write("e..."); + }, + ); + write("f"); + fork(resolveAfter("g", 1), write); + write("h"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/placeholder-single/test.ts b/packages/translator-tags/src/__tests__/fixtures/placeholder-single/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-single/test.ts rename to packages/translator-tags/src/__tests__/fixtures/placeholder-single/test.ts diff --git a/packages/translator/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/server.ts b/packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/server.ts new file mode 100644 index 0000000000..1a63410f0f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/server.ts @@ -0,0 +1,24 @@ +import { + createTemplate, + fork, + tryPlaceholder, + write, +} from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + tryPlaceholder( + () => { + write("b"); + }, + () => { + write("c..."); + }, + ); + write("d"); + fork(resolveAfter("e", 1), write); + write("f"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/placeholder-skipped/test.ts b/packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholder-skipped/test.ts rename to packages/translator-tags/src/__tests__/fixtures/placeholder-skipped/test.ts diff --git a/packages/translator/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders-nested/__snapshots__/ssr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/placeholders-nested/server.ts b/packages/translator-tags/src/__tests__/fixtures/placeholders-nested/server.ts new file mode 100644 index 0000000000..070c2b10c2 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/placeholders-nested/server.ts @@ -0,0 +1,36 @@ +import { + createTemplate, + fork, + tryPlaceholder, + write, +} from "@marko/runtime-tags/src/html"; +import { resolveAfter } from "../../utils/resolve"; + +const renderer = () => { + write("a"); + tryPlaceholder( + () => { + write("b"); + fork(resolveAfter("c", 2), write); + write("d"); + tryPlaceholder( + () => { + write("e"); + fork(resolveAfter("f", 3), write); + write("g"); + }, + () => { + write("h..."); + }, + ); + }, + () => { + write("i..."); + }, + ); + write("j"); + fork(resolveAfter("k", 1), write); + write("l"); +}; + +export default createTemplate(renderer); diff --git a/packages/translator/src/__tests__/fixtures/placeholders-nested/test.ts b/packages/translator-tags/src/__tests__/fixtures/placeholders-nested/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders-nested/test.ts rename to packages/translator-tags/src/__tests__/fixtures/placeholders-nested/test.ts diff --git a/packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f068d25f5e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/dom.expected/template.js @@ -0,0 +1,16 @@ +import { data as _data, html as _html, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _input = /* @__PURE__ */_value("input", (_scope, input) => { + _data(_scope["#text/0"], input.x); + _data(_scope["#text/1"], input.x); + _data(_scope["#text/2"], input.x); + _html(_scope, input.x, "#text/3"); +}); +const _setup = _scope => { + _html(_scope, "Hello HTML ", "#text/4"); +}; +export const attrs = _input; +export { _input }; +export const template = "
        a
        Hello Text <a/>
        "; +export const walks = /* replace, over(1), next(1), get, out(1), next(1), over(1), replace, over(2), replace, over(2), replace, out(1) */"%bD lDb%c%c%l"; +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/placeholders/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..68d9e031f0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/html.expected/template.js @@ -0,0 +1,8 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, toString as _toString, 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(); + _write(`${_escapeXML(input.x)}${_markResumeNode(_scope0_id, "#text/0")}${_escapeXML(input.x)}${_markResumeNode(_scope0_id, "#text/1")}
        `); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/placeholders/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/placeholders/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/placeholders/template.marko b/packages/translator-tags/src/__tests__/fixtures/placeholders/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/template.marko rename to packages/translator-tags/src/__tests__/fixtures/placeholders/template.marko diff --git a/packages/translator/src/__tests__/fixtures/placeholders/test.ts b/packages/translator-tags/src/__tests__/fixtures/placeholders/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/placeholders/test.ts rename to packages/translator-tags/src/__tests__/fixtures/placeholders/test.ts diff --git a/packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f09cb68529 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/dom.expected/template.js @@ -0,0 +1,34 @@ +import { on as _on, queueSource as _queueSource, data as _data, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _count_effect = _register("packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/template.marko_0_count", _scope => { + _on(_scope["#button/0"], "click", function () { + const { + count + } = _scope; + _queueSource(_scope, _count, count + 2); + }); + _on(_scope["#button/2"], "click", function () { + const { + count + } = _scope; + _queueSource(_scope, _count, count * 3); + }); + _on(_scope["#button/4"], "click", function () { + const { + count + } = _scope; + _queueSource(_scope, _count, count ** 3); + }); +}); +const _count = /* @__PURE__ */_value("count", (_scope, count) => { + _data(_scope["#text/1"], count); + _data(_scope["#text/3"], count); + _data(_scope["#text/5"], count); + _queueEffect(_scope, _count_effect); +}); +const _setup = _scope => { + _count(_scope, 0); +}; +export const template = ""; +export const walks = /* get, next(1), get, out(1), get, next(1), get, out(1), get, next(1), get, out(1) */" D l D l D l"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..ccfc9b9e56 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/html.expected/template.js @@ -0,0 +1,11 @@ +import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, writeEffect as _writeEffect, 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(); + const count = 0; + _write(`${_markResumeNode(_scope0_id, "#button/0")}${_markResumeNode(_scope0_id, "#button/2")}${_markResumeNode(_scope0_id, "#button/4")}`); + _writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/template.marko_0_count"); + _writeScope(_scope0_id, { + "count": count + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/resume.expected.md new file mode 100644 index 0000000000..a66a1a59d8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/resume.expected.md @@ -0,0 +1,166 @@ +# Render {} +```html + + + + + + + + + + + + +``` + +# Mutations +``` + +``` + + +# Render +container.querySelector("#addTwo").click() + +```html + + + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "0" => "2" +#document/html0/body1/button2/#text0: "0" => "2" +#document/html0/body1/button4/#text0: "0" => "2" +``` + + +# Render +container.querySelector("#triple").click() + +```html + + + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "2" => "6" +#document/html0/body1/button2/#text0: "2" => "6" +#document/html0/body1/button4/#text0: "2" => "6" +``` + + +# Render +container.querySelector("#cube").click() + +```html + + + + + + + + + + + + +``` + +# Mutations +``` +#document/html0/body1/button0/#text0: "6" => "216" +#document/html0/body1/button2/#text0: "6" => "216" +#document/html0/body1/button4/#text0: "6" => "216" +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..7cf244bf5f --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/__snapshots__/ssr.expected.md @@ -0,0 +1,57 @@ +# Write + + + +# Render "End" +```html + + + + + + + + + + + + +``` + +# Mutations +``` +inserted #document/html0 +inserted #document/html0/head0 +inserted #document/html0/body1 +inserted #document/html0/body1/button0 +inserted #document/html0/body1/button0/#text0 +inserted #document/html0/body1/button0/#comment1 +inserted #document/html0/body1/#comment1 +inserted #document/html0/body1/button2 +inserted #document/html0/body1/button2/#text0 +inserted #document/html0/body1/button2/#comment1 +inserted #document/html0/body1/#comment3 +inserted #document/html0/body1/button4 +inserted #document/html0/body1/button4/#text0 +inserted #document/html0/body1/button4/#comment1 +inserted #document/html0/body1/#comment5 +inserted #document/html0/body1/script6 +inserted #document/html0/body1/script6/#text0 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/reassignment-expression-counter/template.marko b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/reassignment-expression-counter/template.marko rename to packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/template.marko diff --git a/packages/translator/src/__tests__/fixtures/reassignment-expression-counter/test.ts b/packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/reassignment-expression-counter/test.ts rename to packages/translator-tags/src/__tests__/fixtures/reassignment-expression-counter/test.ts diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..a8fea41fca --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/dom.expected/template.js @@ -0,0 +1,25 @@ +import { data as _data, value as _value, createRenderer as _createRenderer, loopOf as _loopOf, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _child$forBody = /* @__PURE__ */_value("child", (_scope, child) => _data(_scope["#text/0"], child.text)); +const _forBody = /* @__PURE__ */_createRenderer(" ", /* get */" ", void 0, void 0, void 0, void 0, void 0, void 0, (_scope, _destructure, _clean) => { + let child; + if (!_clean) ({ + value: [child] + } = _destructure); + _child$forBody(_scope, child, _clean); +}); +const _for = /* @__PURE__ */_loopOf("#div/0", _forBody); +const _children = /* @__PURE__ */_value("children", (_scope, children) => _for(_scope, [children, function (c) { + return c.id; +}])); +export const attrs = (_scope, _destructure2, _clean) => { + let children; + if (!_clean) ({ + children + } = _destructure2); + _children(_scope, children, _clean); +}; +export { _children }; +export const template = "
        "; +export const walks = /* get, over(1) */" b"; +export const setup = function () {}; +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/remove-and-add-rows/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..77cf931bb7 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/html.expected/template.js @@ -0,0 +1,28 @@ +import { write as _write, escapeXML as _escapeXML, markResumeNode as _markResumeNode, serializedScope as _serializedScope, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, writeScope as _writeScope, nextScopeId as _nextScopeId, maybeFlush as _maybeFlush, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer(({ + children +}, _tagVar) => { + const _scope0_id = _nextScopeId(); + _write("
        "); + const _forScopeIds = [], + _scope1_ = new Map(); + const _by = function (c) { + return c.id; + }; + let _i2 = 0; + for (const child of children) { + const _scope1_id = _nextScopeId(); + let _i = _i2++; + _forScopeIds.push(_scope1_id); + _write(`${_escapeXML(child.text)}${_markResumeNode(_scope1_id, "#text/0")}`); + _writeScope(_scope1_id, (_s => (_scope1_.set(_by(child, _i), _s), _s))({ + "_": _serializedScope(_scope0_id) + })); + _maybeFlush(); + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#div/0", _forScopeIds)}
        ${_markResumeNode(_scope0_id, "#div/0")}`); + _writeScope(_scope0_id, { + "#div/0(": _scope1_.size ? _scope1_ : undefined + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/template.marko b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/template.marko rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/template.marko diff --git a/packages/translator/src/__tests__/fixtures/remove-and-add-rows/test.ts b/packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/remove-and-add-rows/test.ts rename to packages/translator-tags/src/__tests__/fixtures/remove-and-add-rows/test.ts diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/dom.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/dom.expected/components/child.js new file mode 100644 index 0000000000..0e9b4df412 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/dom.expected/components/child.js @@ -0,0 +1,9 @@ +import { tagVarSignal as _tagVarSignal, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _x = /* @__PURE__ */_value("x", (_scope, x) => _tagVarSignal(_scope, x), void 0, _tagVarSignal); +const _setup = _scope => { + _x(_scope, 1); +}; +export const template = "child"; +export const walks = /* over(1) */"b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..d24de8d402 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/dom.expected/template.js @@ -0,0 +1,9 @@ +import { setup as _child, template as _child_template, walks as _child_walks } from "./components/child.marko"; +const _setup = _scope => { + _child(_scope["#childScope/0"]); +}; +export const template = `${_child_template}`; +export const walks = /* beginChild, _child_walks, endChild */`/${_child_walks}&`; +export const setup = _setup; +import { createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/html.expected/components/child.js b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/html.expected/components/child.js new file mode 100644 index 0000000000..a267ecd19e --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/html.expected/components/child.js @@ -0,0 +1,12 @@ +import { write as _write, 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(); + const x = 1; + _write("child"); + const _return = x; + _writeScope(_scope0_id, { + "/": _tagVar + }); + return _return; +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/components/child.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..e32b9573b8 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/html.expected/template.js @@ -0,0 +1,7 @@ +import _child from "./components/child.marko"; +import { 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(); + _child._({}); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/resume.expected.md diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/__snapshots__/ssr.expected.md diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/components/child.marko b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/components/child.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/components/child.marko rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/components/child.marko diff --git a/packages/translator/src/__tests__/fixtures/return-tag-no-var/template.marko b/packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag-no-var/template.marko rename to packages/translator-tags/src/__tests__/fixtures/return-tag-no-var/template.marko diff --git a/packages/translator/src/__tests__/fixtures/return-tag/__snapshots__/csr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/csr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag/__snapshots__/csr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/csr-sanitized.expected.md diff --git a/packages/translator/src/__tests__/fixtures/return-tag/__snapshots__/csr.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/csr.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag/__snapshots__/csr.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/csr.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..f368f957d4 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/dom.expected/template.js @@ -0,0 +1,17 @@ +import { tagVarSignal as _tagVarSignal, createRenderer as _createRenderer, register as _register, conditional as _conditional, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup$elseBody = _scope => { + _tagVarSignal(_scope, 2); +}; +const _elseBody = _register("packages/translator-tags/src/__tests__/fixtures/return-tag/template.marko_2_renderer", /* @__PURE__ */_createRenderer("", "", _setup$elseBody)); +const _setup$ifBody = _scope => { + _tagVarSignal(_scope, 1); +}; +const _ifBody = _register("packages/translator-tags/src/__tests__/fixtures/return-tag/template.marko_1_renderer", /* @__PURE__ */_createRenderer("", "", _setup$ifBody)); +const _if = /* @__PURE__ */_conditional("#text/0"); +const _input = /* @__PURE__ */_value("input", (_scope, input) => _if(_scope, input.show ? _ifBody : _elseBody)); +export const attrs = _input; +export { _input }; +export const template = ""; +export const walks = /* replace, over(1) */"%b"; +export const setup = function () {}; +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/return-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..4ef2e87f56 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/html.expected/template.js @@ -0,0 +1,28 @@ +import { serializedScope as _serializedScope, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, register as _register, markResumeControlSingleNodeEnd as _markResumeControlSingleNodeEnd, write as _write, createTemplate as _createTemplate } from "@marko/runtime-tags/src/html"; +const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { + const _scope0_id = _nextScopeId(); + let _ifScopeId, _scope1_, _ifRenderer; + if (input.show) { + const _scope1_id = _nextScopeId(); + const _return = 1; + _writeScope(_scope1_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/return-tag/template.marko_1_renderer"); + _ifScopeId = _scope1_id; + } else { + const _scope2_id = _nextScopeId(); + const _return2 = 2; + _writeScope(_scope2_id, _scope1_ = { + "_": _serializedScope(_scope0_id) + }); + _register(_ifRenderer = /* @__PURE__ */_createRenderer(() => {}), "packages/translator-tags/src/__tests__/fixtures/return-tag/template.marko_2_renderer"); + _ifScopeId = _scope2_id; + } + _write(`${_markResumeControlSingleNodeEnd(_scope0_id, "#text/0", _ifScopeId)}`); + _writeScope(_scope0_id, { + "#text/0!": _scope1_, + "#text/0(": _ifRenderer + }); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/return-tag/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/return-tag/__snapshots__/ssr-sanitized.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/ssr-sanitized.expected.md similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag/__snapshots__/ssr-sanitized.expected.md rename to packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/ssr-sanitized.expected.md diff --git a/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/ssr.expected.md b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/ssr.expected.md new file mode 100644 index 0000000000..3f037315f2 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/return-tag/__snapshots__/ssr.expected.md @@ -0,0 +1,26 @@ +# Write + + + +# Render "End" +```html + + + + + + + +``` + +# Mutations +``` +inserted #document/#comment0 +inserted #document/html1 +inserted #document/html1/head0 +inserted #document/html1/head0/script0 +inserted #document/html1/head0/script0/#text0 +inserted #document/html1/body1 +``` \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/return-tag/template.marko b/packages/translator-tags/src/__tests__/fixtures/return-tag/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag/template.marko rename to packages/translator-tags/src/__tests__/fixtures/return-tag/template.marko diff --git a/packages/translator/src/__tests__/fixtures/return-tag/test.ts b/packages/translator-tags/src/__tests__/fixtures/return-tag/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/return-tag/test.ts rename to packages/translator-tags/src/__tests__/fixtures/return-tag/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..7a61cb6973 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/__snapshots__/dom.expected/template.js @@ -0,0 +1,9 @@ +import myStyles from "virtual:./template.marko.module.css \n .content {\n color: green;\n }\n"; +import { classAttr as _classAttr, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup = _scope => { + _classAttr(_scope["#div/1"], myStyles.content); +}; +export const template = "
        Hello
        "; +export const walks = /* get, over(1) */" b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..14df6caa94 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/__snapshots__/html.expected/template.js @@ -0,0 +1,7 @@ +import myStyles from "virtual:./template.marko.module.css \n .content {\n color: green;\n }\n"; +import { classAttr as _classAttr, 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(); + _write(`Hello
        ${_markResumeNode(_scope0_id, "#div/1")}`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/style-tag-modules-default/template.marko b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/style-tag-modules-default/template.marko rename to packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/template.marko diff --git a/packages/translator/src/__tests__/fixtures/style-tag-modules-default/test.ts b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/style-tag-modules-default/test.ts rename to packages/translator-tags/src/__tests__/fixtures/style-tag-modules-default/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/__snapshots__/dom.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/__snapshots__/dom.expected/template.js new file mode 100644 index 0000000000..d5162768ef --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/__snapshots__/dom.expected/template.js @@ -0,0 +1,12 @@ +import _style from "virtual:./template.marko.module.css \n .content {\n color: green;\n }\n"; +const { + content +} = _style; +import { classAttr as _classAttr, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/src/dom"; +const _setup = _scope => { + _classAttr(_scope["#div/1"], content); +}; +export const template = "
        Hello
        "; +export const walks = /* get, over(1) */" b"; +export const setup = _setup; +export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(template, walks, setup), "packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/template.marko"); \ No newline at end of file diff --git a/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/__snapshots__/html.expected/template.js b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/__snapshots__/html.expected/template.js new file mode 100644 index 0000000000..ce64ff94e9 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/__snapshots__/html.expected/template.js @@ -0,0 +1,10 @@ +import _style from "virtual:./template.marko.module.css \n .content {\n color: green;\n }\n"; +import { classAttr as _classAttr, 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 { + content + } = _style; + _write(`Hello
        ${_markResumeNode(_scope0_id, "#div/1")}`); +}); +export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/template.marko"); \ No newline at end of file diff --git a/packages/translator/src/__tests__/fixtures/style-tag-modules-destructured/template.marko b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/template.marko similarity index 100% rename from packages/translator/src/__tests__/fixtures/style-tag-modules-destructured/template.marko rename to packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/template.marko diff --git a/packages/translator/src/__tests__/fixtures/style-tag-modules-destructured/test.ts b/packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/test.ts similarity index 100% rename from packages/translator/src/__tests__/fixtures/style-tag-modules-destructured/test.ts rename to packages/translator-tags/src/__tests__/fixtures/style-tag-modules-destructured/test.ts diff --git a/packages/translator-tags/src/__tests__/fixtures/style-tag-type-conflict/__snapshots__/dom.expected/template.error.txt b/packages/translator-tags/src/__tests__/fixtures/style-tag-type-conflict/__snapshots__/dom.expected/template.error.txt new file mode 100644 index 0000000000..99151516f0 --- /dev/null +++ b/packages/translator-tags/src/__tests__/fixtures/style-tag-type-conflict/__snapshots__/dom.expected/template.error.txt @@ -0,0 +1 @@ +packages/translator-tags/src/__tests__/fixtures/style-tag-type-conflict/template.marko: