diff options
author | 2022-04-23 03:15:27 -0700 | |
---|---|---|
committer | 2022-04-23 03:15:27 -0700 | |
commit | 683b171c3ffc54957e1f02952938ff010fdcbbe0 (patch) | |
tree | 9ff186957214f6bccc696f5093cb88b0e39a40aa | |
parent | ea241fcec7add6187ec915ed0b3983f3be0529f9 (diff) | |
download | bun-683b171c3ffc54957e1f02952938ff010fdcbbe0.tar.gz bun-683b171c3ffc54957e1f02952938ff010fdcbbe0.tar.zst bun-683b171c3ffc54957e1f02952938ff010fdcbbe0.zip |
:camera:
35 files changed, 139 insertions, 113 deletions
diff --git a/integration/bunjs-only-snippets/response.file.test.js b/integration/bunjs-only-snippets/response.file.test.js index f05c875f0..2d0b6506e 100644 --- a/integration/bunjs-only-snippets/response.file.test.js +++ b/integration/bunjs-only-snippets/response.file.test.js @@ -107,7 +107,7 @@ it("Bun.file", async () => { }); it("Bun.file as a Blob", async () => { - const filePath = path.join(import.meta.url, "../fetch.js.txt"); + const filePath = path.join(import.meta.path, "../fetch.js.txt"); const fixture = fs.readFileSync(filePath, "utf8"); // this is a Blob object with the same interface as the one returned by fetch // internally, instead of a byte array, it stores the file path! diff --git a/integration/bunjs-only-snippets/transpiler.test.js b/integration/bunjs-only-snippets/transpiler.test.js index 4759b17c9..268ebfd8b 100644 --- a/integration/bunjs-only-snippets/transpiler.test.js +++ b/integration/bunjs-only-snippets/transpiler.test.js @@ -23,7 +23,7 @@ describe("Bun.Transpiler", () => { // Explicitly remove the top-level export, even if it is in use by // another part of the file - eliminate: ["loader"], + eliminate: ["loader", "localVarToRemove"], }, /* only per-file for now, so this isn't good yet */ treeShaking: true, @@ -36,8 +36,6 @@ describe("Bun.Transpiler", () => { }); it("a deletes dead exports and any imports only referenced in dead regions", () => { - console.log("b"); - const out = transpiler.transformSync(` import {getUserById} from './my-database'; @@ -50,9 +48,6 @@ describe("Bun.Transpiler", () => { return <div id='user'>{user.name}</div>; } `); - - // when all three flags are set, it means - console.log(out); }); it("deletes dead exports and any imports only referenced in dead regions", () => { @@ -104,7 +99,6 @@ describe("Bun.Transpiler", () => { require("bar"); } `); - console.log(output); expect(output.includes("loader")).toBe(false); expect(output.includes("react")).toBe(false); expect(output.includes("deadFS")).toBe(false); diff --git a/integration/snapshots/array-args-with-default-values.hmr.debug.js b/integration/snapshots/array-args-with-default-values.hmr.debug.js index 94cb3c8cf..e219cbd9a 100644 --- a/integration/snapshots/array-args-with-default-values.hmr.debug.js +++ b/integration/snapshots/array-args-with-default-values.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/bundled-entry-point.hmr.debug.js index ef62991a4..622b6b75b 100644 --- a/integration/snapshots/bundled-entry-point.hmr.debug.js +++ b/integration/snapshots/bundled-entry-point.hmr.debug.js @@ -4,6 +4,8 @@ __require as require import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -11,9 +13,8 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; -Bun.activate(true); - var hmr = new FastHMR(3012834585, "bundled-entry-point.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { function test() { return testDone(import.meta.url); diff --git a/integration/snapshots/caught-require.hmr.debug.js b/integration/snapshots/caught-require.hmr.debug.js index 123cd1d0b..5beecb99b 100644 --- a/integration/snapshots/caught-require.hmr.debug.js +++ b/integration/snapshots/caught-require.hmr.debug.js @@ -1,8 +1,10 @@ import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -10,9 +12,8 @@ __FastRefreshModule as FastHMR import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.debug.js index 614797836..f685557dc 100644 --- a/integration/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.debug.js +++ b/integration/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.debug.js @@ -1,6 +1,8 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -12,9 +14,8 @@ 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"; -Bun.activate(true); - 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); diff --git a/integration/snapshots/code-simplification-neql-define.hmr.debug.js b/integration/snapshots/code-simplification-neql-define.hmr.debug.js index 3b271905c..8d4f82052 100644 --- a/integration/snapshots/code-simplification-neql-define.hmr.debug.js +++ b/integration/snapshots/code-simplification-neql-define.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - var hmr = new FastHMR(726376257, "code-simplification-neql-define.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { var testFailed = false; const invariant = () => { diff --git a/integration/snapshots/custom-emotion-jsx/file.hmr.debug.jsx b/integration/snapshots/custom-emotion-jsx/file.hmr.debug.jsx index 0f99c6c56..a046f2e1c 100644 --- a/integration/snapshots/custom-emotion-jsx/file.hmr.debug.jsx +++ b/integration/snapshots/custom-emotion-jsx/file.hmr.debug.jsx @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -16,9 +18,8 @@ var jsx = require(JSX).jsxDEV; import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js"; var ReactDOM = require($5b3cea55); -Bun.activate(true); - 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.debug.js b/integration/snapshots/export-default-module-hot.debug.js index e0d02d271..a9de546d5 100644 --- a/integration/snapshots/export-default-module-hot.debug.js +++ b/integration/snapshots/export-default-module-hot.debug.js @@ -1,19 +1,6 @@ -import { -__cJS2eSM -} from "http://localhost:8080/bun:wrap"; -import { -__exportDefault -} from "http://localhost:8080/bun:wrap"; -export default __cJS2eSM(function(module, exports) { - __exportDefault(module.exports, module.id); - - function test() { - testDone(import.meta.url); - } - Object.defineProperty(module.exports,"test",{get: () => test, enumerable: true, configurable: true}); -}, "export-default-module-hot.js"); - - - +export default typeof module !== "undefined" && module.id; +export function test() { + testDone(import.meta.url); +} //# sourceMappingURL=http://localhost:8080/export-default-module-hot.js.map diff --git a/integration/snapshots/export-default-module-hot.hmr.debug.js b/integration/snapshots/export-default-module-hot.hmr.debug.js index e0d02d271..6230c29a1 100644 --- a/integration/snapshots/export-default-module-hot.hmr.debug.js +++ b/integration/snapshots/export-default-module-hot.hmr.debug.js @@ -1,19 +1,35 @@ import { -__cJS2eSM +__HMRClient as Bun +} from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + +import { +__FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { -__exportDefault +__FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -export default __cJS2eSM(function(module, exports) { - __exportDefault(module.exports, module.id); +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() { testDone(import.meta.url); } - Object.defineProperty(module.exports,"test",{get: () => test, enumerable: true, configurable: true}); -}, "export-default-module-hot.js"); - - + hmr.exportAll({ + default: () => export_default_module_hot_default, + test: () => test + }); +})(); +var $$hmr_default = hmr.exports.default, $$hmr_test = hmr.exports.test; +hmr._update = function(exports) { + $$hmr_default = exports.default; + $$hmr_test = exports.test; +}; +export { + $$hmr_default as default, + $$hmr_test as test +}; //# sourceMappingURL=http://localhost:8080/export-default-module-hot.js.map diff --git a/integration/snapshots/export.hmr.debug.js b/integration/snapshots/export.hmr.debug.js index f5025db35..4bcc6ef59 100644 --- a/integration/snapshots/export.hmr.debug.js +++ b/integration/snapshots/export.hmr.debug.js @@ -1,6 +1,8 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -9,9 +11,8 @@ __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"; -Bun.activate(true); - var hmr = new FastHMR(1879780259, "export.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { var yoyoyo = "yoyoyo"; function hey() { diff --git a/integration/snapshots/forbid-in-is-correct.hmr.debug.js b/integration/snapshots/forbid-in-is-correct.hmr.debug.js index 7beb65f90..83a447fc4 100644 --- a/integration/snapshots/forbid-in-is-correct.hmr.debug.js +++ b/integration/snapshots/forbid-in-is-correct.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/global-is-remapped-to-globalThis.hmr.debug.js index 74ec1cf67..1f6619161 100644 --- a/integration/snapshots/global-is-remapped-to-globalThis.hmr.debug.js +++ b/integration/snapshots/global-is-remapped-to-globalThis.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - var hmr = new FastHMR(713665787, "global-is-remapped-to-globalThis.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { function test() { console.assert(globalThis === globalThis); diff --git a/integration/snapshots/jsx-entities.hmr.debug.jsx b/integration/snapshots/jsx-entities.hmr.debug.jsx index 3fec5114c..07915e50a 100644 --- a/integration/snapshots/jsx-entities.hmr.debug.jsx +++ b/integration/snapshots/jsx-entities.hmr.debug.jsx @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -18,9 +20,8 @@ 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); -Bun.activate(true); - 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.debug.jsx b/integration/snapshots/jsx-spacing.hmr.debug.jsx index 274cf9bce..d9ec4e204 100644 --- a/integration/snapshots/jsx-spacing.hmr.debug.jsx +++ b/integration/snapshots/jsx-spacing.hmr.debug.jsx @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -16,9 +18,8 @@ var jsx = require(JSX).jsxDEV; import * as $1f6f0e67 from "http://localhost:8080/node_modules/react-dom/server.browser.js"; var ReactDOM = require($1f6f0e67); -Bun.activate(true); - 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.debug.js b/integration/snapshots/latin1-chars-in-regexp.hmr.debug.js index 33504d3dd..fee5714a2 100644 --- a/integration/snapshots/latin1-chars-in-regexp.hmr.debug.js +++ b/integration/snapshots/latin1-chars-in-regexp.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/lodash-regexp.hmr.debug.js index af65c1b5b..959e9e9c1 100644 --- a/integration/snapshots/lodash-regexp.hmr.debug.js +++ b/integration/snapshots/lodash-regexp.hmr.debug.js @@ -4,6 +4,8 @@ __require as require import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -12,9 +14,8 @@ __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import * as $60f52dc2 from "http://localhost:8080/node_modules/lodash/lodash.js"; var { shuffle} = require($60f52dc2); -Bun.activate(true); - var hmr = new FastHMR(2158065009, "lodash-regexp.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { function test() { const foo = [1, 2, 3, 4, 6]; diff --git a/integration/snapshots/multiple-imports.hmr.debug.js b/integration/snapshots/multiple-imports.hmr.debug.js index 2073d0a37..5cca375b2 100644 --- a/integration/snapshots/multiple-imports.hmr.debug.js +++ b/integration/snapshots/multiple-imports.hmr.debug.js @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -18,9 +20,8 @@ var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; var { default: React} = require($bbcd215f); var { default: React2} = require($bbcd215f); -Bun.activate(true); - var hmr = new FastHMR(2165509932, "multiple-imports.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { const bacon = React; const bacon2 = jsx(JSXFrag, { diff --git a/integration/snapshots/multiple-var.hmr.debug.js b/integration/snapshots/multiple-var.hmr.debug.js index 0dd025c7e..a5298f462 100644 --- a/integration/snapshots/multiple-var.hmr.debug.js +++ b/integration/snapshots/multiple-var.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/number-literal-bug.hmr.debug.js index 7030ee92b..852aef372 100644 --- a/integration/snapshots/number-literal-bug.hmr.debug.js +++ b/integration/snapshots/number-literal-bug.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/optional-chain-with-function.hmr.debug.js index 42eb7c742..e7f97cb3f 100644 --- a/integration/snapshots/optional-chain-with-function.hmr.debug.js +++ b/integration/snapshots/optional-chain-with-function.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/package-json-exports/index.hmr.debug.js index 9899da4e9..e6cdaefba 100644 --- a/integration/snapshots/package-json-exports/index.hmr.debug.js +++ b/integration/snapshots/package-json-exports/index.hmr.debug.js @@ -4,6 +4,8 @@ __require as require import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -18,9 +20,8 @@ import * as $522c6d1f from "http://localhost:8080/package-json-exports/node_modu var ExactFile = require($522c6d1f); import * as $fce83cd7 from "http://localhost:8080/package-json-exports/node_modules/js-only-exports/browser/js-file.js"; var JSFileExtensionOnly = require($fce83cd7); -Bun.activate(true); - 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"); diff --git a/integration/snapshots/package-json-utf8.hmr.debug.js b/integration/snapshots/package-json-utf8.hmr.debug.js index 5f8ac8d0c..fe11070c2 100644 --- a/integration/snapshots/package-json-utf8.hmr.debug.js +++ b/integration/snapshots/package-json-utf8.hmr.debug.js @@ -1,6 +1,8 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; @@ -8,9 +10,8 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import pkg from "http://localhost:8080/utf8-package-json.json"; -Bun.activate(true); - 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.debug.tsx b/integration/snapshots/react-context-value-func.hmr.debug.tsx index 76d5214d3..d17a8fa88 100644 --- a/integration/snapshots/react-context-value-func.hmr.debug.tsx +++ b/integration/snapshots/react-context-value-func.hmr.debug.tsx @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -16,9 +18,8 @@ var jsx = require(JSX).jsxDEV; import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var { default: React} = require($bbcd215f); -Bun.activate(true); - 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.debug.tsx b/integration/snapshots/spread_with_key.hmr.debug.tsx index f96095524..0123867ee 100644 --- a/integration/snapshots/spread_with_key.hmr.debug.tsx +++ b/integration/snapshots/spread_with_key.hmr.debug.tsx @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -17,9 +19,8 @@ var JSXClassic = require($bbcd215f); var jsx = require(JSX).jsxDEV, jsxEl = require(JSXClassic).createElement; var { default: React} = require($bbcd215f); -Bun.activate(true); - 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.debug.js b/integration/snapshots/string-escapes.debug.js index f79d78ae2..9084bc362 100644 --- a/integration/snapshots/string-escapes.debug.js +++ b/integration/snapshots/string-escapes.debug.js @@ -24,7 +24,7 @@ var obj = { "\uD83D\uDD75\uD83C\uDFFD\u200D\u2642\uFE0F": "\uD83D\uDD75\uD83C\uDFFD\u200D\u2642\uFE0F", "\u32E1": "\u32E1", "\u263A": "\u263A", - シ: "\u30B7", + "シ": "\u30B7", "\uD83D\uDC4B": "\uD83D\uDC4B", f, "\u2639": "\u2639", diff --git a/integration/snapshots/string-escapes.hmr.debug.js b/integration/snapshots/string-escapes.hmr.debug.js index cdee09d5b..a247fc16d 100644 --- a/integration/snapshots/string-escapes.hmr.debug.js +++ b/integration/snapshots/string-escapes.hmr.debug.js @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -16,7 +18,6 @@ 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; -Bun.activate(true); var hmr = new FastHMR(2482749838, "string-escapes.js", FastRefresh), exports = hmr.exports; (hmr._load = function() { var tab = "\t"; @@ -36,7 +37,7 @@ var hmr = new FastHMR(2482749838, "string-escapes.js", FastRefresh), exports = h "\uD83D\uDD75\uD83C\uDFFD\u200D\u2642\uFE0F": "\uD83D\uDD75\uD83C\uDFFD\u200D\u2642\uFE0F", "\u32E1": "\u32E1", "\u263A": "\u263A", - シ: "\u30B7", + "シ": "\u30B7", "\uD83D\uDC4B": "\uD83D\uDC4B", f, "\u2639": "\u2639", diff --git a/integration/snapshots/styledcomponents-output.hmr.debug.js b/integration/snapshots/styledcomponents-output.hmr.debug.js index 244528956..027d5f35b 100644 --- a/integration/snapshots/styledcomponents-output.hmr.debug.js +++ b/integration/snapshots/styledcomponents-output.hmr.debug.js @@ -2,10 +2,12 @@ import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; import { -__require as require +__HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { -__HMRClient as Bun +__require as require } from "http://localhost:8080/bun:wrap"; import { __FastRefreshModule as FastHMR @@ -20,9 +22,8 @@ import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var { default: React} = require($bbcd215f); import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js"; var { default: ReactDOM} = require($5b3cea55); -Bun.activate(true); - 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.debug.js b/integration/snapshots/template-literal.hmr.debug.js index 25c6900a7..b5a8ac52b 100644 --- a/integration/snapshots/template-literal.hmr.debug.js +++ b/integration/snapshots/template-literal.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - 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.debug.js b/integration/snapshots/ts-fallback-rewrite-works.hmr.debug.js index 361871dbb..1d59ba0d5 100644 --- a/integration/snapshots/ts-fallback-rewrite-works.hmr.debug.js +++ b/integration/snapshots/ts-fallback-rewrite-works.hmr.debug.js @@ -1,12 +1,13 @@ import { -__HMRModule as HMR -} from "http://localhost:8080/bun:wrap"; -import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(true); +import { +__HMRModule as HMR +} from "http://localhost:8080/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); diff --git a/integration/snapshots/tsx-fallback-rewrite-works.hmr.debug.js b/integration/snapshots/tsx-fallback-rewrite-works.hmr.debug.js index 2a62fd719..ea15fc922 100644 --- a/integration/snapshots/tsx-fallback-rewrite-works.hmr.debug.js +++ b/integration/snapshots/tsx-fallback-rewrite-works.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - var hmr = new FastHMR(2117426367, "tsx-fallback-rewrite-works.tsx", FastRefresh), exports = hmr.exports; + (hmr._load = function() { function test() { return testDone(import.meta.url); diff --git a/integration/snapshots/type-only-imports.hmr.debug.ts b/integration/snapshots/type-only-imports.hmr.debug.ts index 05f02664d..ff8f4864b 100644 --- a/integration/snapshots/type-only-imports.hmr.debug.ts +++ b/integration/snapshots/type-only-imports.hmr.debug.ts @@ -1,12 +1,13 @@ import { -__HMRModule as HMR -} from "http://localhost:8080/bun:wrap"; -import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; Bun.activate(true); +import { +__HMRModule as HMR +} from "http://localhost:8080/bun:wrap"; var hmr = new HMR(650094581, "type-only-imports.ts"), exports = hmr.exports; + (hmr._load = function() { var baconator = true; var SilentSymbolCollisionsAreOkayInTypeScript = true; diff --git a/integration/snapshots/unicode-identifiers.hmr.debug.js b/integration/snapshots/unicode-identifiers.hmr.debug.js index 4c92288c6..53fbb30d5 100644 --- a/integration/snapshots/unicode-identifiers.hmr.debug.js +++ b/integration/snapshots/unicode-identifiers.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - var hmr = new FastHMR(1398361736, "unicode-identifiers.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { var ε = 0.000001; var ε2 = ε * ε; diff --git a/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.debug.js b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.debug.js index 96ed59f94..bbb0a451c 100644 --- a/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.debug.js +++ b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.debug.js @@ -1,15 +1,16 @@ import { __HMRClient as Bun } from "http://localhost:8080/bun:wrap"; +Bun.activate(true); + import { __FastRefreshModule as FastHMR } from "http://localhost:8080/bun:wrap"; import { __FastRefreshRuntime as FastRefresh } from "http://localhost:8080/bun:wrap"; -Bun.activate(true); - var hmr = new FastHMR(635901064, "void-shouldnt-delete-call-expressions.js", FastRefresh), exports = hmr.exports; + (hmr._load = function() { var was_called = false; function thisShouldBeCalled() { diff --git a/integration/snippets/export-default-module-hot.js b/integration/snippets/export-default-module-hot.js index d6bb5a6a1..aee4e2468 100644 --- a/integration/snippets/export-default-module-hot.js +++ b/integration/snippets/export-default-module-hot.js @@ -1,5 +1,5 @@ // This test passes if there's no syntax error -export default module.id; +export default typeof module !== "undefined" && module.id; export function test() { testDone(import.meta.url); |