diff options
Diffstat (limited to 'integration')
31 files changed, 149 insertions, 154 deletions
diff --git a/integration/bunjs-only-snippets/transpiler.test.js b/integration/bunjs-only-snippets/transpiler.test.js index 268ebfd8b..3d2064f72 100644 --- a/integration/bunjs-only-snippets/transpiler.test.js +++ b/integration/bunjs-only-snippets/transpiler.test.js @@ -124,6 +124,19 @@ describe("Bun.Transpiler", () => { }, platform: "browser", }); + const bunTranspiler = new Bun.Transpiler({ + loader: "tsx", + define: { + "process.env.NODE_ENV": JSON.stringify("development"), + user_undefined: "undefined", + }, + platform: "bun", + macro: { + react: { + bacon: `${import.meta.dir}/macro-check.js`, + }, + }, + }); const code = `import { useParams } from "remix"; import type { LoaderFunction, ActionFunction } from "remix"; @@ -344,12 +357,17 @@ describe("Bun.Transpiler", () => { }); }); - const parsed = (code, trim = true, autoExport = false) => { + const parsed = ( + code, + trim = true, + autoExport = false, + transpiler_ = transpiler + ) => { if (autoExport) { code = "export default (" + code + ")"; } - var out = transpiler.transformSync(code, "js"); + var out = transpiler_.transformSync(code, "js"); if (autoExport && out.startsWith("export default ")) { out = out.substring("export default ".length); } @@ -375,6 +393,10 @@ describe("Bun.Transpiler", () => { expect(parsed(code, !out.endsWith(";\n"), false)).toBe(out); }; + const expectBunPrinted_ = (code, out) => { + expect(parsed(code, !out.endsWith(";\n"), false, bunTranspiler)).toBe(out); + }; + const expectParseError = (code, message) => { try { parsed(code, false, false); @@ -567,6 +589,46 @@ describe("Bun.Transpiler", () => { ); }); + it("fold string addition", () => { + expectPrinted_( + `export const foo = "a" + "b";`, + `export const foo = "ab"` + ); + expectPrinted_( + `export const foo = "F" + "0" + "F" + "0123456789" + "ABCDEF" + "0123456789ABCDEFF0123456789ABCDEF00" + "b";`, + `export const foo = "F0F0123456789ABCDEF0123456789ABCDEFF0123456789ABCDEF00b"` + ); + expectPrinted_( + `export const foo = "a" + 1 + "b";`, + `export const foo = "a" + 1 + "b"` + ); + expectPrinted_( + `export const foo = "a" + "b" + 1 + "b";`, + `export const foo = "ab" + 1 + "b"` + ); + expectPrinted_( + `export const foo = "a" + "b" + 1 + "b" + "c";`, + `export const foo = "ab" + 1 + "bc"` + ); + }); + + it("numeric constants", () => { + expectBunPrinted_("export const foo = 1 + 2", "export const foo = 3"); + expectBunPrinted_("export const foo = 1 - 2", "export const foo = -1"); + expectBunPrinted_("export const foo = 1 * 2", "export const foo = 2"); + }); + + it("rewrite string to length", () => { + expectPrinted_( + `export const foo = "a".length + "b".length;`, + `export const foo = 1 + 1` + ); + expectBunPrinted_( + `export const foo = "a".length + "b".length;`, + `export const foo = 2` + ); + }); + it("define", () => { expectPrinted_( `export default typeof user_undefined === 'undefined';`, diff --git a/integration/snapshots/array-args-with-default-values.hmr.js b/integration/snapshots/array-args-with-default-values.hmr.js index f539090a3..3c8997b54 100644 --- a/integration/snapshots/array-args-with-default-values.hmr.js +++ b/integration/snapshots/array-args-with-default-values.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(3474597122, "array-args-with-default-values.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var lines; const data = () => lines.map(([a = null, b = null, c = null, d = null]) => ({ diff --git a/integration/snapshots/bundled-entry-point.hmr.js b/integration/snapshots/bundled-entry-point.hmr.js index 492099250..b4fb5e46f 100644 --- a/integration/snapshots/bundled-entry-point.hmr.js +++ b/integration/snapshots/bundled-entry-point.hmr.js @@ -1,20 +1,18 @@ import { __require as require -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; -import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +} from "http://localhost:3000/bun:wrap"; +import * as $bbcd215f from "http://localhost:3000/node_modules/react/index.js"; var hmr = new FastHMR(3012834585, "bundled-entry-point.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { return testDone(import.meta.url); @@ -32,4 +30,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/bundled-entry-point.js.map +//# sourceMappingURL=http://localhost:3000/bundled-entry-point.js.map diff --git a/integration/snapshots/caught-require.hmr.js b/integration/snapshots/caught-require.hmr.js index 6fb4d1c03..8a63f51a0 100644 --- a/integration/snapshots/caught-require.hmr.js +++ b/integration/snapshots/caught-require.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __require as require } from "http://localhost:8080/bun:wrap"; @@ -13,7 +12,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(2398506918, "caught-require.js", FastRefresh), exports = hmr.exports; - await (hmr._load = async function() { try { require((() => { throw (new Error(`Cannot require module '"this-package-should-not-exist"'`)); } )()); diff --git a/integration/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.js b/integration/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.js index eff074b6a..b74b8c2b7 100644 --- a/integration/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.js +++ b/integration/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.js @@ -1,21 +1,19 @@ import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; -import _login from "http://localhost:8080/_login.js"; -import _auth from "http://localhost:8080/_auth.js"; -import * as _loginReally from "http://localhost:8080/_login.js"; -import * as _loginReally2 from "http://localhost:8080/_login.js"; -import * as _authReally from "http://localhost:8080/_auth.js"; +} from "http://localhost:3000/bun:wrap"; +import _login from "http://localhost:3000/_login.js"; +import _auth from "http://localhost:3000/_auth.js"; +import * as _loginReally from "http://localhost:3000/_login.js"; +import * as _loginReally2 from "http://localhost:3000/_login.js"; +import * as _authReally from "http://localhost:3000/_auth.js"; var hmr = new FastHMR(3878252498, "cjs-transform-shouldnt-have-static-imports-in-cjs-function.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { return testDone(import.meta.url); @@ -44,4 +42,4 @@ export { $$hmr_bar as bar }; -//# sourceMappingURL=http://localhost:8080/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js.map +//# sourceMappingURL=http://localhost:3000/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js.map diff --git a/integration/snapshots/code-simplification-neql-define.hmr.js b/integration/snapshots/code-simplification-neql-define.hmr.js index 258d04714..6d521b01d 100644 --- a/integration/snapshots/code-simplification-neql-define.hmr.js +++ b/integration/snapshots/code-simplification-neql-define.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(726376257, "code-simplification-neql-define.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var testFailed = false; const invariant = () => { @@ -25,7 +23,7 @@ var hmr = new FastHMR(726376257, "code-simplification-neql-define.js", FastRefre var RelayQueryResponseCache = function() { var foo = function RelayQueryResponseCache(_ref) { var size = _ref.size, ttl = _ref.ttl; - !(size > 0) && invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size); + !(size > 0) && invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got `%s`.", size); !(ttl > 0) && invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl); }; foo({ size: 100, ttl: 3600 }); diff --git a/integration/snapshots/custom-emotion-jsx/file.hmr.jsx b/integration/snapshots/custom-emotion-jsx/file.hmr.jsx index 22ceaf1a7..d26b0a16d 100644 --- a/integration/snapshots/custom-emotion-jsx/file.hmr.jsx +++ b/integration/snapshots/custom-emotion-jsx/file.hmr.jsx @@ -5,7 +5,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __require as require } from "http://localhost:8080/bun:wrap"; @@ -15,11 +14,9 @@ __FastRefreshModule as FastHMR import * as $72625799 from "http://localhost:8080/node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js"; var JSX = require($72625799); var jsx = require(JSX).jsxDEV; - import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js"; var ReactDOM = require($5b3cea55); var hmr = new FastHMR(2497996991, "custom-emotion-jsx/file.jsx", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var Foo = () => jsx("div", { css: { content: '"it worked!"' } diff --git a/integration/snapshots/export-default-module-hot.hmr.js b/integration/snapshots/export-default-module-hot.hmr.js index 39d1c3095..3dadccd28 100644 --- a/integration/snapshots/export-default-module-hot.hmr.js +++ b/integration/snapshots/export-default-module-hot.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(2909748314, "export-default-module-hot.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var export_default_module_hot_default = typeof module !== "undefined" && module.id; function test() { diff --git a/integration/snapshots/export.hmr.js b/integration/snapshots/export.hmr.js index d79b77817..73d6db2d4 100644 --- a/integration/snapshots/export.hmr.js +++ b/integration/snapshots/export.hmr.js @@ -1,18 +1,16 @@ import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; -import what from "http://localhost:8080/_auth.js"; -import * as where from "http://localhost:8080/_auth.js"; +} from "http://localhost:3000/bun:wrap"; +import what from "http://localhost:3000/_auth.js"; +import * as where from "http://localhost:3000/_auth.js"; var hmr = new FastHMR(1879780259, "export.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var yoyoyo = "yoyoyo"; function hey() { @@ -72,9 +70,9 @@ export { $$hmr_booop as booop, $$hmr_test as test }; -export { default as auth } from "http://localhost:8080/_auth.js"; -export { default as login } from "http://localhost:8080/_login.js"; -export * from "http://localhost:8080/_bacon.js"; -export { } from "http://localhost:8080/_bacon.js"; +export { default as auth } from "http://localhost:3000/_auth.js"; +export { default as login } from "http://localhost:3000/_login.js"; +export * from "http://localhost:3000/_bacon.js"; +export { } from "http://localhost:3000/_bacon.js"; -//# sourceMappingURL=http://localhost:8080/export.js.map +//# sourceMappingURL=http://localhost:3000/export.js.map diff --git a/integration/snapshots/forbid-in-is-correct.hmr.js b/integration/snapshots/forbid-in-is-correct.hmr.js index db6b9d7bd..ae3714d04 100644 --- a/integration/snapshots/forbid-in-is-correct.hmr.js +++ b/integration/snapshots/forbid-in-is-correct.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(346837007, "forbid-in-is-correct.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var foo = () => { var D = (i, r) => () => (r || i((r = { exports: {} }).exports, r), r.exports); diff --git a/integration/snapshots/global-is-remapped-to-globalThis.hmr.js b/integration/snapshots/global-is-remapped-to-globalThis.hmr.js index ea90abd67..a0e28b60a 100644 --- a/integration/snapshots/global-is-remapped-to-globalThis.hmr.js +++ b/integration/snapshots/global-is-remapped-to-globalThis.hmr.js @@ -1,16 +1,14 @@ import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; var hmr = new FastHMR(713665787, "global-is-remapped-to-globalThis.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { console.assert(globalThis === globalThis); @@ -29,4 +27,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/global-is-remapped-to-globalThis.js.map +//# sourceMappingURL=http://localhost:3000/global-is-remapped-to-globalThis.js.map diff --git a/integration/snapshots/jsx-entities.hmr.jsx b/integration/snapshots/jsx-entities.hmr.jsx index 5f0bece67..3bad6ca8d 100644 --- a/integration/snapshots/jsx-entities.hmr.jsx +++ b/integration/snapshots/jsx-entities.hmr.jsx @@ -5,7 +5,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __require as require } from "http://localhost:8080/bun:wrap"; @@ -17,11 +16,9 @@ var JSX = require($2f488e5b); import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; - import * as $1f6f0e67 from "http://localhost:8080/node_modules/react-dom/server.browser.js"; var ReactDOM = require($1f6f0e67); var hmr = new FastHMR(817082122, "jsx-entities.jsx", FastRefresh), exports = hmr.exports; - (hmr._load = function() { const elements = { [ReactDOM.renderToString(jsx(JSXFrag, { diff --git a/integration/snapshots/jsx-spacing.hmr.jsx b/integration/snapshots/jsx-spacing.hmr.jsx index 34ac4d74d..59287257b 100644 --- a/integration/snapshots/jsx-spacing.hmr.jsx +++ b/integration/snapshots/jsx-spacing.hmr.jsx @@ -5,7 +5,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __require as require } from "http://localhost:8080/bun:wrap"; @@ -15,11 +14,9 @@ __FastRefreshModule as FastHMR import * as $2f488e5b from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; var JSX = require($2f488e5b); var jsx = require(JSX).jsxDEV; - import * as $1f6f0e67 from "http://localhost:8080/node_modules/react-dom/server.browser.js"; var ReactDOM = require($1f6f0e67); var hmr = new FastHMR(3614189736, "jsx-spacing.jsx", FastRefresh), exports = hmr.exports; - (hmr._load = function() { const ReturnDescriptionAsString = ({ description }) => description; function test() { diff --git a/integration/snapshots/latin1-chars-in-regexp.hmr.js b/integration/snapshots/latin1-chars-in-regexp.hmr.js index d92429751..afd3b813e 100644 --- a/integration/snapshots/latin1-chars-in-regexp.hmr.js +++ b/integration/snapshots/latin1-chars-in-regexp.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(1430071586, "latin1-chars-in-regexp.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; var re_btou = new RegExp([ diff --git a/integration/snapshots/lodash-regexp.hmr.js b/integration/snapshots/lodash-regexp.hmr.js index b79ab4aca..e5d6b9130 100644 --- a/integration/snapshots/lodash-regexp.hmr.js +++ b/integration/snapshots/lodash-regexp.hmr.js @@ -1,21 +1,19 @@ import { __require as require -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; -import * as $60f52dc2 from "http://localhost:8080/node_modules/lodash/lodash.js"; +} from "http://localhost:3000/bun:wrap"; +import * as $60f52dc2 from "http://localhost:3000/node_modules/lodash/lodash.js"; var { shuffle} = require($60f52dc2); var hmr = new FastHMR(2158065009, "lodash-regexp.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { const foo = [1, 2, 3, 4, 6]; @@ -44,4 +42,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/lodash-regexp.js.map +//# sourceMappingURL=http://localhost:3000/lodash-regexp.js.map diff --git a/integration/snapshots/multiple-imports.hmr.js b/integration/snapshots/multiple-imports.hmr.js index 1d15c1783..59d620c07 100644 --- a/integration/snapshots/multiple-imports.hmr.js +++ b/integration/snapshots/multiple-imports.hmr.js @@ -1,27 +1,24 @@ import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __require as require -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; -import * as $2f488e5b from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; +} from "http://localhost:3000/bun:wrap"; +import * as $2f488e5b from "http://localhost:3000/node_modules/react/jsx-dev-runtime.js"; var JSX = require($2f488e5b); -import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +import * as $bbcd215f from "http://localhost:3000/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; - var { default: React} = require($bbcd215f); var { default: React2} = require($bbcd215f); var hmr = new FastHMR(2165509932, "multiple-imports.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { const bacon = React; const bacon2 = jsx(JSXFrag, { @@ -47,4 +44,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/multiple-imports.js.map +//# sourceMappingURL=http://localhost:3000/multiple-imports.js.map diff --git a/integration/snapshots/multiple-var.hmr.js b/integration/snapshots/multiple-var.hmr.js index f791cee85..3acb5b8d3 100644 --- a/integration/snapshots/multiple-var.hmr.js +++ b/integration/snapshots/multiple-var.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(2883558553, "multiple-var.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var foo = true; globalThis.TRUE_BUT_WE_CANT_TREESHAKE_IT = true; diff --git a/integration/snapshots/number-literal-bug.hmr.js b/integration/snapshots/number-literal-bug.hmr.js index ee23fe6cd..cdb63994d 100644 --- a/integration/snapshots/number-literal-bug.hmr.js +++ b/integration/snapshots/number-literal-bug.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(583570002, "number-literal-bug.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { const precision = 10; diff --git a/integration/snapshots/optional-chain-with-function.hmr.js b/integration/snapshots/optional-chain-with-function.hmr.js index ee7e10bc1..e9a89a827 100644 --- a/integration/snapshots/optional-chain-with-function.hmr.js +++ b/integration/snapshots/optional-chain-with-function.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(3608848620, "optional-chain-with-function.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { try { diff --git a/integration/snapshots/package-json-exports/index.hmr.js b/integration/snapshots/package-json-exports/index.hmr.js index 66b751eb0..69efa5194 100644 --- a/integration/snapshots/package-json-exports/index.hmr.js +++ b/integration/snapshots/package-json-exports/index.hmr.js @@ -1,27 +1,25 @@ import { __require as require -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; -import * as $4068f25b from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/index.js"; +} from "http://localhost:3000/bun:wrap"; +import * as $4068f25b from "http://localhost:3000/package-json-exports/node_modules/inexact/browser/index.js"; var InexactRoot = require($4068f25b); -import * as $d2a171d2 from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/dir/file.js"; +import * as $d2a171d2 from "http://localhost:3000/package-json-exports/node_modules/inexact/browser/dir/file.js"; var InexactFile = require($d2a171d2); -import * as $522c6d1f from "http://localhost:8080/package-json-exports/node_modules/inexact/browser/foo.js"; +import * as $522c6d1f from "http://localhost:3000/package-json-exports/node_modules/inexact/browser/foo.js"; var ExactFile = require($522c6d1f); -import * as $fce83cd7 from "http://localhost:8080/package-json-exports/node_modules/js-only-exports/browser/js-file.js"; +import * as $fce83cd7 from "http://localhost:3000/package-json-exports/node_modules/js-only-exports/browser/js-file.js"; var JSFileExtensionOnly = require($fce83cd7); var hmr = new FastHMR(1953708113, "package-json-exports/index.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { async function test() { console.assert(InexactRoot.target === "browser"); @@ -43,4 +41,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/package-json-exports/index.js.map +//# sourceMappingURL=http://localhost:3000/package-json-exports/index.js.map diff --git a/integration/snapshots/package-json-utf8.hmr.js b/integration/snapshots/package-json-utf8.hmr.js index 1d9d2be54..5676d6477 100644 --- a/integration/snapshots/package-json-utf8.hmr.js +++ b/integration/snapshots/package-json-utf8.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -11,7 +10,6 @@ __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import pkg from "http://localhost:8080/utf8-package-json.json"; var hmr = new FastHMR(4111115104, "package-json-utf8.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { console.assert(!!pkg.author); diff --git a/integration/snapshots/react-context-value-func.hmr.tsx b/integration/snapshots/react-context-value-func.hmr.tsx index 9f594d3d3..0c751a7a9 100644 --- a/integration/snapshots/react-context-value-func.hmr.tsx +++ b/integration/snapshots/react-context-value-func.hmr.tsx @@ -5,7 +5,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __require as require } from "http://localhost:8080/bun:wrap"; @@ -15,11 +14,9 @@ __FastRefreshModule as FastHMR import * as $2f488e5b from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; var JSX = require($2f488e5b); var jsx = require(JSX).jsxDEV; - import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var { default: React} = require($bbcd215f); var hmr = new FastHMR(3514348331, "react-context-value-func.tsx", FastRefresh), exports = hmr.exports; - (hmr._load = function() { const Context = React.createContext({}); const ContextProvider = ({ children }) => { diff --git a/integration/snapshots/spread_with_key.hmr.tsx b/integration/snapshots/spread_with_key.hmr.tsx index a17a21ef6..37cb57b34 100644 --- a/integration/snapshots/spread_with_key.hmr.tsx +++ b/integration/snapshots/spread_with_key.hmr.tsx @@ -5,7 +5,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __require as require } from "http://localhost:8080/bun:wrap"; @@ -17,10 +16,8 @@ var JSX = require($2f488e5b); import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, jsxEl = require(JSXClassic).createElement; - var { default: React} = require($bbcd215f); var hmr = new FastHMR(2717584935, "spread_with_key.tsx", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function SpreadWithTheKey({ className }) { const rest = {}; diff --git a/integration/snapshots/string-escapes.hmr.js b/integration/snapshots/string-escapes.hmr.js index b9ec134a7..5847bdf97 100644 --- a/integration/snapshots/string-escapes.hmr.js +++ b/integration/snapshots/string-escapes.hmr.js @@ -1,23 +1,21 @@ import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __require as require -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; -import * as $2f488e5b from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; +} from "http://localhost:3000/bun:wrap"; +import * as $2f488e5b from "http://localhost:3000/node_modules/react/jsx-dev-runtime.js"; var JSX = require($2f488e5b); -import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; +import * as $bbcd215f from "http://localhost:3000/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; - var hmr = new FastHMR(2482749838, "string-escapes.js", FastRefresh), exports = hmr.exports; (hmr._load = function() { var tab = "\t"; @@ -489,4 +487,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/string-escapes.js.map +//# sourceMappingURL=http://localhost:3000/string-escapes.js.map diff --git a/integration/snapshots/styledcomponents-output.hmr.js b/integration/snapshots/styledcomponents-output.hmr.js index 3d7a8b0f2..b39adb87c 100644 --- a/integration/snapshots/styledcomponents-output.hmr.js +++ b/integration/snapshots/styledcomponents-output.hmr.js @@ -5,7 +5,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __require as require } from "http://localhost:8080/bun:wrap"; @@ -15,7 +14,6 @@ __FastRefreshModule as FastHMR import * as $2f488e5b from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; var JSX = require($2f488e5b); var jsx = require(JSX).jsxDEV; - import * as $d4051a2e from "http://localhost:8080/node_modules/styled-components/dist/styled-components.browser.esm.js"; var { default: styled} = require($d4051a2e); import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; @@ -23,7 +21,6 @@ var { default: React} = require($bbcd215f); import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js"; var { default: ReactDOM} = require($5b3cea55); var hmr = new FastHMR(1290604342, "styledcomponents-output.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { const ErrorScreenRoot = styled.div` font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, diff --git a/integration/snapshots/template-literal.hmr.js b/integration/snapshots/template-literal.hmr.js index 93ccb1317..0baee2be1 100644 --- a/integration/snapshots/template-literal.hmr.js +++ b/integration/snapshots/template-literal.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(2201713056, "template-literal.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { const css = (templ) => templ.toString(); const fooNoBracesUTF8 = css` diff --git a/integration/snapshots/ts-fallback-rewrite-works.hmr.js b/integration/snapshots/ts-fallback-rewrite-works.hmr.js index f679abc01..09f26c952 100644 --- a/integration/snapshots/ts-fallback-rewrite-works.hmr.js +++ b/integration/snapshots/ts-fallback-rewrite-works.hmr.js @@ -1,13 +1,11 @@ import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __HMRModule as HMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; var hmr = new HMR(421762902, "ts-fallback-rewrite-works.ts"), exports = hmr.exports; - (hmr._load = function() { function test() { return testDone(import.meta.url); @@ -25,4 +23,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/ts-fallback-rewrite-works.js.map +//# sourceMappingURL=http://localhost:3000/ts-fallback-rewrite-works.js.map diff --git a/integration/snapshots/tsx-fallback-rewrite-works.hmr.js b/integration/snapshots/tsx-fallback-rewrite-works.hmr.js index 178bc9ab3..b33df25c4 100644 --- a/integration/snapshots/tsx-fallback-rewrite-works.hmr.js +++ b/integration/snapshots/tsx-fallback-rewrite-works.hmr.js @@ -1,16 +1,14 @@ import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; var hmr = new FastHMR(2117426367, "tsx-fallback-rewrite-works.tsx", FastRefresh), exports = hmr.exports; - (hmr._load = function() { function test() { return testDone(import.meta.url); @@ -28,4 +26,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/tsx-fallback-rewrite-works.js.map +//# sourceMappingURL=http://localhost:3000/tsx-fallback-rewrite-works.js.map diff --git a/integration/snapshots/type-only-imports.hmr.ts b/integration/snapshots/type-only-imports.hmr.ts index ab75aaeb9..f732881b7 100644 --- a/integration/snapshots/type-only-imports.hmr.ts +++ b/integration/snapshots/type-only-imports.hmr.ts @@ -1,13 +1,11 @@ import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __HMRModule as HMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; var hmr = new HMR(650094581, "type-only-imports.ts"), exports = hmr.exports; - (hmr._load = function() { var baconator = true; var SilentSymbolCollisionsAreOkayInTypeScript = true; @@ -35,4 +33,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/type-only-imports.ts.map +//# sourceMappingURL=http://localhost:3000/type-only-imports.ts.map diff --git a/integration/snapshots/unicode-identifiers.hmr.js b/integration/snapshots/unicode-identifiers.hmr.js index fb62e80ef..be84e436e 100644 --- a/integration/snapshots/unicode-identifiers.hmr.js +++ b/integration/snapshots/unicode-identifiers.hmr.js @@ -1,16 +1,14 @@ import { __HMRClient as Bun -} from "http://localhost:8080/bun:wrap"; -Bun.activate(false); - +} from "http://localhost:3000/bun:wrap"; +Bun.activate(true); import { __FastRefreshModule as FastHMR -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; import { __FastRefreshRuntime as FastRefresh -} from "http://localhost:8080/bun:wrap"; +} from "http://localhost:3000/bun:wrap"; var hmr = new FastHMR(1398361736, "unicode-identifiers.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var ε = 0.000001; var ε2 = ε * ε; @@ -40,4 +38,4 @@ export { $$hmr_test as test }; -//# sourceMappingURL=http://localhost:8080/unicode-identifiers.js.map +//# sourceMappingURL=http://localhost:3000/unicode-identifiers.js.map diff --git a/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js index 55b85fced..f2a1dbf18 100644 --- a/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js +++ b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.js @@ -2,7 +2,6 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(false); - import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -10,7 +9,6 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; var hmr = new FastHMR(635901064, "void-shouldnt-delete-call-expressions.js", FastRefresh), exports = hmr.exports; - (hmr._load = function() { var was_called = false; function thisShouldBeCalled() { |