From bbd97b2da506673de665989cc6d001cd80e33818 Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Sat, 15 Apr 2023 18:42:18 +0545 Subject: [PATCH 01/12] single runtime bundle --- rollup.config.mjs | 241 +++++++++++++++++++++------------------------- 1 file changed, 108 insertions(+), 133 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 56ebdaa7558f..a29454852366 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,182 +1,157 @@ -import fs from 'node:fs'; -import { createRequire } from 'node:module'; -import replace from '@rollup/plugin-replace'; -import resolve from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; -import sucrase from '@rollup/plugin-sucrase'; -import typescript from '@rollup/plugin-typescript'; +import fs from "node:fs"; +import { createRequire } from "node:module"; +import replace from "@rollup/plugin-replace"; +import resolve from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import json from "@rollup/plugin-json"; +import sucrase from "@rollup/plugin-sucrase"; +import typescript from "@rollup/plugin-typescript"; const require = createRequire(import.meta.url); -const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')); +const pkg = JSON.parse(fs.readFileSync("package.json", "utf-8")); const is_publish = !!process.env.PUBLISH; const ts_plugin = is_publish ? typescript({ - typescript: require('typescript') - }) + typescript: require("typescript"), + }) : sucrase({ - transforms: ['typescript'] - }); + transforms: ["typescript"], + }); -// The following external and path logic is necessary so that the bundled runtime pieces and the index file -// reference each other correctly instead of bundling their references to each other +fs.writeFileSync( + `./compiler.d.ts`, + `export { compile, parse, preprocess, walk, VERSION } from './types/compiler/index';` +); -/** - * Ensures that relative imports inside `src/runtime` like `./internal` and `../store` are externalized correctly - */ -const external = (id, parent_id) => { - const parent_segments = parent_id.replace(/\\/g, '/').split('/'); - // TODO needs to be adjusted when we move to JS modules - if (parent_segments[parent_segments.length - 3] === 'runtime') { - return /\.\.\/\w+$/.test(id); - } else { - return id === './internal' && parent_segments[parent_segments.length - 2] === 'runtime'; - } -} - -/** - * Transforms externalized import paths like `../store` into correct relative imports with correct index file extension import - */ -const replace_relative_svelte_imports = (id, ending) => { - id = id.replace(/\\/g, '/'); - // TODO needs to be adjusted when we move to JS modules - return /src\/runtime\/\w+$/.test(id) && `../${id.split('/').pop()}/${ending}`; -} +const runtime_entrypoints = Object.fromEntries( + fs + .readdirSync("src/runtime", { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => [dirent.name, `src/runtime/${dirent.name}/index.ts`]) +); /** - * Transforms externalized `./internal` import path into correct relative import with correct index file extension import + * @type {import("rollup").RollupOptions[]} */ -const replace_relative_internal_import = (id, ending) => { - id = id.replace(/\\/g, '/'); - // TODO needs to be adjusted when we move to JS modules - return id.endsWith('src/runtime/internal') && `./internal/${ending}`; -} - -fs.writeFileSync(`./compiler.d.ts`, `export { compile, parse, preprocess, walk, VERSION } from './types/compiler/index';`); - export default [ - /* runtime */ { - input: `src/runtime/index.ts`, - output: [ - { - file: `index.mjs`, - format: 'esm', - paths: id => replace_relative_internal_import(id, 'index.mjs') - }, - { - file: `index.js`, - format: 'cjs', - paths: id => replace_relative_internal_import(id, 'index.js') - } - ], - external, - plugins: [ts_plugin] - }, + input: { + ...runtime_entrypoints, + index: "src/runtime/index.ts", + ssr: "src/runtime/ssr.ts", + }, + output: ["esm", "cjs"].map((format) => { + const ext = format === "esm" ? "mjs" : "cjs"; + return { + entryFileNames: (entry) => { + if (entry.isEntry) { + if (entry.name === "index") return `index.${ext}`; + else if (entry.name === "ssr") return `ssr.${ext}`; - { - input: `src/runtime/ssr.ts`, - output: [ - { - file: `ssr.mjs`, - format: 'esm', - paths: id => replace_relative_internal_import(id, 'index.mjs') - }, - { - file: `ssr.js`, - format: 'cjs', - paths: id => replace_relative_internal_import(id, 'index.js') - } - ], - external, - plugins: [ts_plugin] - }, - - ...fs.readdirSync('src/runtime') - .filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory()) - .map(dir => ({ - input: `src/runtime/${dir}/index.ts`, - output: [ - { - file: `${dir}/index.mjs`, - format: 'esm', - paths: id => replace_relative_svelte_imports(id, 'index.mjs') + return `${entry.name}/index.${ext}`; + } }, - { - file: `${dir}/index.js`, - format: 'cjs', - paths: id => replace_relative_svelte_imports(id, 'index.js') - } - ], - external, - plugins: [ - replace({ - __VERSION__: pkg.version - }), - ts_plugin, - { - writeBundle(_options, bundle) { - if (dir === 'internal') { - const mod = bundle['index.mjs']; + manualChunks: (id) => { + if (id.endsWith("internal/index.ts")) return "internal"; + }, + format, + dir: ".", + }; + }), + plugins: [ + replace({ + preventAssignment: true, + values: { + __VERSION__: pkg.version, + }, + }), + , + ts_plugin, + { + writeBundle(_options, bundle) { + for (const [_, entry] of Object.entries(bundle)) { + let dir = entry.name; + if (!entry.isEntry || !runtime_entrypoints[dir]) continue; + if (dir === "internal") { + const mod = bundle[`internal/index.mjs`]; if (mod) { - fs.writeFileSync('src/compiler/compile/internal_exports.ts', `// This file is automatically generated\nexport default new Set(${JSON.stringify(mod.exports)});`); + fs.writeFileSync( + "src/compiler/compile/internal_exports.ts", + `// This file is automatically generated\nexport default new Set(${JSON.stringify( + mod.exports + )});` + ); } } - fs.writeFileSync(`${dir}/package.json`, JSON.stringify({ - main: './index', - module: './index.mjs', - types: './index.d.ts' - }, null, ' ')); + fs.writeFileSync( + `${dir}/package.json`, + JSON.stringify( + { + main: "./index", + module: "./index.mjs", + types: "./index.d.ts", + }, + null, + " " + ) + ); - fs.writeFileSync(`${dir}/index.d.ts`, `export * from '../types/runtime/${dir}/index';`); + fs.writeFileSync( + `${dir}/index.d.ts`, + `export * from '../types/runtime/${dir}/index';` + ); } - } - ] - })), - + }, + }, + ], + }, /* compiler.js */ { - input: 'src/compiler/index.ts', + input: "src/compiler/index.ts", plugins: [ replace({ - __VERSION__: pkg.version, - 'process.env.NODE_DEBUG': false // appears inside the util package + preventAssignment: true, + values: { + __VERSION__: pkg.version, + "process.env.NODE_DEBUG": false, // appears inside the util package + }, }), { resolveId(id) { // util is a built-in module in Node.js, but we want a self-contained compiler bundle // that also works in the browser, so we load its polyfill instead - if (id === 'util') { - return require.resolve('./node_modules/util'); // just 'utils' would resolve this to the built-in module + if (id === "util") { + return require.resolve("./node_modules/util"); // just 'utils' would resolve this to the built-in module } - } + }, }, resolve(), commonjs({ - include: ['node_modules/**'] + include: ["node_modules/**"], }), json(), - ts_plugin + ts_plugin, ], output: [ { - file: 'compiler.js', - format: is_publish ? 'umd' : 'cjs', - name: 'svelte', + file: "compiler.mjs", + format: "esm", + name: "svelte", sourcemap: true, }, { - file: 'compiler.mjs', - format: 'esm', - name: 'svelte', + file: "compiler.cjs", + format: is_publish ? "umd" : "cjs", + name: "svelte", sourcemap: true, - } + }, ], external: is_publish ? [] - : id => id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree') - } + : (id) => + id === "acorn" || id === "magic-string" || id.startsWith("css-tree"), + }, ]; From 73d81b1ec7da2c31fc882cd24e06a52250681438 Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Sat, 15 Apr 2023 18:55:53 +0545 Subject: [PATCH 02/12] formatting --- rollup.config.mjs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index a29454852366..9269a1f07cd2 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -72,16 +72,15 @@ export default [ { writeBundle(_options, bundle) { for (const [_, entry] of Object.entries(bundle)) { - let dir = entry.name; + const dir = entry.name; if (!entry.isEntry || !runtime_entrypoints[dir]) continue; if (dir === "internal") { const mod = bundle[`internal/index.mjs`]; if (mod) { fs.writeFileSync( "src/compiler/compile/internal_exports.ts", - `// This file is automatically generated\nexport default new Set(${JSON.stringify( - mod.exports - )});` + `// This file is automatically generated` + + `export default new Set(${JSON.stringify(mod.exports)});` ); } } From da40e71f10fd629f4e25fce43436d37d9a71343a Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Sat, 15 Apr 2023 19:23:54 +0545 Subject: [PATCH 03/12] dedupe output options --- rollup.config.mjs | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 9269a1f07cd2..545b953d2c89 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -42,24 +42,30 @@ export default [ index: "src/runtime/index.ts", ssr: "src/runtime/ssr.ts", }, - output: ["esm", "cjs"].map((format) => { - const ext = format === "esm" ? "mjs" : "cjs"; - return { - entryFileNames: (entry) => { - if (entry.isEntry) { - if (entry.name === "index") return `index.${ext}`; - else if (entry.name === "ssr") return `ssr.${ext}`; + output: ["esm", "cjs"].map( + /** @returns {import('rollup').OutputOptions} */ + (format) => { + const ext = format === "esm" ? "mjs" : "cjs"; + return { + entryFileNames: (entry) => { + if (entry.isEntry) { + if (entry.name === "index") return `index.${ext}`; + else if (entry.name === "ssr") return `ssr.${ext}`; - return `${entry.name}/index.${ext}`; - } - }, - manualChunks: (id) => { - if (id.endsWith("internal/index.ts")) return "internal"; - }, - format, - dir: ".", - }; - }), + return `${entry.name}/index.${ext}`; + } + }, + + manualChunks: (id) => { + if (id.endsWith("internal/index.ts")) { + return "internal"; + } + }, + format, + dir: ".", + }; + } + ), plugins: [ replace({ preventAssignment: true, @@ -67,19 +73,19 @@ export default [ __VERSION__: pkg.version, }, }), - , ts_plugin, { writeBundle(_options, bundle) { for (const [_, entry] of Object.entries(bundle)) { const dir = entry.name; if (!entry.isEntry || !runtime_entrypoints[dir]) continue; + if (dir === "internal") { const mod = bundle[`internal/index.mjs`]; if (mod) { fs.writeFileSync( "src/compiler/compile/internal_exports.ts", - `// This file is automatically generated` + + `// This file is automatically generated\n` + `export default new Set(${JSON.stringify(mod.exports)});` ); } @@ -89,7 +95,7 @@ export default [ `${dir}/package.json`, JSON.stringify( { - main: "./index", + main: "./index.cjs", module: "./index.mjs", types: "./index.d.ts", }, From d1b6643394edce479a365fe0091315cbf677e07d Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Sat, 15 Apr 2023 19:57:02 +0545 Subject: [PATCH 04/12] fix tests apparently --- rollup.config.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 545b953d2c89..8f42e1967143 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -45,7 +45,7 @@ export default [ output: ["esm", "cjs"].map( /** @returns {import('rollup').OutputOptions} */ (format) => { - const ext = format === "esm" ? "mjs" : "cjs"; + const ext = format === "esm" ? "mjs" : "js"; return { entryFileNames: (entry) => { if (entry.isEntry) { @@ -95,7 +95,7 @@ export default [ `${dir}/package.json`, JSON.stringify( { - main: "./index.cjs", + main: "./index.js", module: "./index.mjs", types: "./index.d.ts", }, @@ -148,7 +148,7 @@ export default [ sourcemap: true, }, { - file: "compiler.cjs", + file: "compiler.js", format: is_publish ? "umd" : "cjs", name: "svelte", sourcemap: true, From df6839559d4c33ec72602d31e2d910c8639c82f6 Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Sat, 15 Apr 2023 20:57:34 +0545 Subject: [PATCH 05/12] skip writeBundle for cjs build --- rollup.config.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 8f42e1967143..06cf07bf8f84 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -42,10 +42,10 @@ export default [ index: "src/runtime/index.ts", ssr: "src/runtime/ssr.ts", }, - output: ["esm", "cjs"].map( + output: ["es", "cjs"].map( /** @returns {import('rollup').OutputOptions} */ (format) => { - const ext = format === "esm" ? "mjs" : "js"; + const ext = format === "es" ? "mjs" : "js"; return { entryFileNames: (entry) => { if (entry.isEntry) { @@ -75,8 +75,10 @@ export default [ }), ts_plugin, { - writeBundle(_options, bundle) { - for (const [_, entry] of Object.entries(bundle)) { + writeBundle(options, bundle) { + if (options.format !== "es") return; + + for (const entry of Object.values(bundle)) { const dir = entry.name; if (!entry.isEntry || !runtime_entrypoints[dir]) continue; From 81af2128fe41c2a2a4f2a5686dc5d00f24a271ea Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Sat, 15 Apr 2023 21:08:49 +0545 Subject: [PATCH 06/12] revert quotes --- rollup.config.mjs | 80 +++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 06cf07bf8f84..fafc4fb1a1e5 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,23 +1,23 @@ -import fs from "node:fs"; -import { createRequire } from "node:module"; -import replace from "@rollup/plugin-replace"; -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; -import json from "@rollup/plugin-json"; -import sucrase from "@rollup/plugin-sucrase"; -import typescript from "@rollup/plugin-typescript"; +import fs from 'node:fs'; +import { createRequire } from 'node:module'; +import replace from '@rollup/plugin-replace'; +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import sucrase from '@rollup/plugin-sucrase'; +import typescript from '@rollup/plugin-typescript'; const require = createRequire(import.meta.url); -const pkg = JSON.parse(fs.readFileSync("package.json", "utf-8")); +const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')); const is_publish = !!process.env.PUBLISH; const ts_plugin = is_publish ? typescript({ - typescript: require("typescript"), + typescript: require('typescript'), }) : sucrase({ - transforms: ["typescript"], + transforms: ['typescript'], }); fs.writeFileSync( @@ -27,7 +27,7 @@ fs.writeFileSync( const runtime_entrypoints = Object.fromEntries( fs - .readdirSync("src/runtime", { withFileTypes: true }) + .readdirSync('src/runtime', { withFileTypes: true }) .filter((dirent) => dirent.isDirectory()) .map((dirent) => [dirent.name, `src/runtime/${dirent.name}/index.ts`]) ); @@ -39,30 +39,30 @@ export default [ { input: { ...runtime_entrypoints, - index: "src/runtime/index.ts", - ssr: "src/runtime/ssr.ts", + index: 'src/runtime/index.ts', + ssr: 'src/runtime/ssr.ts', }, - output: ["es", "cjs"].map( + output: ['es', 'cjs'].map( /** @returns {import('rollup').OutputOptions} */ (format) => { - const ext = format === "es" ? "mjs" : "js"; + const ext = format === 'es' ? 'mjs' : 'js'; return { entryFileNames: (entry) => { if (entry.isEntry) { - if (entry.name === "index") return `index.${ext}`; - else if (entry.name === "ssr") return `ssr.${ext}`; + if (entry.name === 'index') return `index.${ext}`; + else if (entry.name === 'ssr') return `ssr.${ext}`; return `${entry.name}/index.${ext}`; } }, manualChunks: (id) => { - if (id.endsWith("internal/index.ts")) { - return "internal"; + if (id.endsWith('internal/index.ts')) { + return 'internal'; } }, format, - dir: ".", + dir: '.', }; } ), @@ -76,17 +76,17 @@ export default [ ts_plugin, { writeBundle(options, bundle) { - if (options.format !== "es") return; + if (options.format !== 'es') return; for (const entry of Object.values(bundle)) { const dir = entry.name; if (!entry.isEntry || !runtime_entrypoints[dir]) continue; - if (dir === "internal") { + if (dir === 'internal') { const mod = bundle[`internal/index.mjs`]; if (mod) { fs.writeFileSync( - "src/compiler/compile/internal_exports.ts", + 'src/compiler/compile/internal_exports.ts', `// This file is automatically generated\n` + `export default new Set(${JSON.stringify(mod.exports)});` ); @@ -97,12 +97,12 @@ export default [ `${dir}/package.json`, JSON.stringify( { - main: "./index.js", - module: "./index.mjs", - types: "./index.d.ts", + main: './index.js', + module: './index.mjs', + types: './index.d.ts', }, null, - " " + ' ' ) ); @@ -117,48 +117,48 @@ export default [ }, /* compiler.js */ { - input: "src/compiler/index.ts", + input: 'src/compiler/index.ts', plugins: [ replace({ preventAssignment: true, values: { __VERSION__: pkg.version, - "process.env.NODE_DEBUG": false, // appears inside the util package + 'process.env.NODE_DEBUG': false, // appears inside the util package }, }), { resolveId(id) { // util is a built-in module in Node.js, but we want a self-contained compiler bundle // that also works in the browser, so we load its polyfill instead - if (id === "util") { - return require.resolve("./node_modules/util"); // just 'utils' would resolve this to the built-in module + if (id === 'util') { + return require.resolve('./node_modules/util'); // just 'utils' would resolve this to the built-in module } }, }, resolve(), commonjs({ - include: ["node_modules/**"], + include: ['node_modules/**'], }), json(), ts_plugin, ], output: [ { - file: "compiler.mjs", - format: "esm", - name: "svelte", + file: 'compiler.js', + format: is_publish ? 'umd' : 'cjs', + name: 'svelte', sourcemap: true, }, { - file: "compiler.js", - format: is_publish ? "umd" : "cjs", - name: "svelte", + file: 'compiler.mjs', + format: 'esm', + name: 'svelte', sourcemap: true, }, ], external: is_publish ? [] : (id) => - id === "acorn" || id === "magic-string" || id.startsWith("css-tree"), + id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree'), }, ]; From edd3e318600dc5186f3b02657a2a06e3e3fc7671 Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Mon, 17 Apr 2023 07:20:42 +0545 Subject: [PATCH 07/12] remove manualChunks --- rollup.config.mjs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index fafc4fb1a1e5..de382a093e96 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -55,12 +55,7 @@ export default [ return `${entry.name}/index.${ext}`; } }, - - manualChunks: (id) => { - if (id.endsWith('internal/index.ts')) { - return 'internal'; - } - }, + chunkFileNames: `internal/[name]-[hash].${ext}`, format, dir: '.', }; From df4cad404ffdef08e12f4b4033967c3a275d84f9 Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Mon, 17 Apr 2023 07:28:13 +0545 Subject: [PATCH 08/12] some node16 module resolution compliance --- rollup.config.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index de382a093e96..1d73a13bbbfe 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -22,7 +22,7 @@ const ts_plugin = is_publish fs.writeFileSync( `./compiler.d.ts`, - `export { compile, parse, preprocess, walk, VERSION } from './types/compiler/index';` + `export { compile, parse, preprocess, walk, VERSION } from './types/compiler/index.js';` ); const runtime_entrypoints = Object.fromEntries( @@ -103,7 +103,7 @@ export default [ fs.writeFileSync( `${dir}/index.d.ts`, - `export * from '../types/runtime/${dir}/index';` + `export * from '../types/runtime/${dir}/index.js';` ); } }, From 890bcba92a06d75913a751a18321ca30a291f073 Mon Sep 17 00:00:00 2001 From: gtmnayan Date: Mon, 17 Apr 2023 07:43:37 +0545 Subject: [PATCH 09/12] disable minifyInternalExports doesn't really make sense for a library since users' build step will do it again anyway --- rollup.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/rollup.config.mjs b/rollup.config.mjs index 1d73a13bbbfe..ddaaa3082512 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -57,6 +57,7 @@ export default [ }, chunkFileNames: `internal/[name]-[hash].${ext}`, format, + minifyInternalExports: false, dir: '.', }; } From 1a670b6443d522bbae42f10e3775cc820b5e1d0d Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Tue, 18 Apr 2023 10:46:21 +0200 Subject: [PATCH 10/12] lessen diff --- rollup.config.mjs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index ddaaa3082512..6af8bad72ea2 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -10,7 +10,7 @@ import typescript from '@rollup/plugin-typescript'; const require = createRequire(import.meta.url); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')); -const is_publish = !!process.env.PUBLISH; +const is_publish = true;!!process.env.PUBLISH; const ts_plugin = is_publish ? typescript({ @@ -40,7 +40,7 @@ export default [ input: { ...runtime_entrypoints, index: 'src/runtime/index.ts', - ssr: 'src/runtime/ssr.ts', + ssr: 'src/runtime/ssr.ts' }, output: ['es', 'cjs'].map( /** @returns {import('rollup').OutputOptions} */ @@ -107,9 +107,9 @@ export default [ `export * from '../types/runtime/${dir}/index.js';` ); } - }, - }, - ], + } + } + ] }, /* compiler.js */ { @@ -133,28 +133,28 @@ export default [ }, resolve(), commonjs({ - include: ['node_modules/**'], + include: ['node_modules/**'] }), json(), - ts_plugin, + ts_plugin ], output: [ { file: 'compiler.js', format: is_publish ? 'umd' : 'cjs', name: 'svelte', - sourcemap: true, + sourcemap: true }, { file: 'compiler.mjs', format: 'esm', name: 'svelte', - sourcemap: true, - }, + sourcemap: true + } ], external: is_publish ? [] : (id) => - id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree'), - }, + id === 'acorn' || id === 'magic-string' || id.startsWith('css-tree') + } ]; From ad0198a5929ab6da6eb9d32f671d5b4f900ed2ad Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Tue, 18 Apr 2023 10:47:08 +0200 Subject: [PATCH 11/12] lol this is random --- rollup.config.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 6af8bad72ea2..d331433fca98 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -119,7 +119,7 @@ export default [ preventAssignment: true, values: { __VERSION__: pkg.version, - 'process.env.NODE_DEBUG': false, // appears inside the util package + 'process.env.NODE_DEBUG': false // appears inside the util package }, }), { @@ -143,13 +143,13 @@ export default [ file: 'compiler.js', format: is_publish ? 'umd' : 'cjs', name: 'svelte', - sourcemap: true + sourcemap: true, }, { file: 'compiler.mjs', format: 'esm', name: 'svelte', - sourcemap: true + sourcemap: true, } ], external: is_publish From fec880b7dd388767cf058c94c1dbc46e52661d14 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Tue, 18 Apr 2023 10:49:37 +0200 Subject: [PATCH 12/12] oops --- rollup.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index d331433fca98..d6a22733a401 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -10,7 +10,7 @@ import typescript from '@rollup/plugin-typescript'; const require = createRequire(import.meta.url); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')); -const is_publish = true;!!process.env.PUBLISH; +const is_publish = !!process.env.PUBLISH; const ts_plugin = is_publish ? typescript({