@vitejs/plugin-react-swc 3.0.0 → 3.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,7 +24,7 @@ export default defineConfig({
24
24
 
25
25
  ## Caveats
26
26
 
27
- This plugin is only used in development and aims to be kept simple to enable good performances and be transpiler agnostic. Here is the list of non-configurable options that impact runtime behaviour:
27
+ This plugin has limited options to enable good performances and be transpiler agnostic. Here is the list of non-configurable options that impact runtime behaviour:
28
28
 
29
29
  - [useDefineForClassFields](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier) is always activated, as this matches the current ECMAScript spec
30
30
  - `jsx runtime` is always `automatic`
@@ -34,6 +34,32 @@ This plugin is only used in development and aims to be kept simple to enable goo
34
34
  - JS files are not transformed
35
35
  - tsconfig is not resolved, so properties other than the ones listed above behaves like TS defaults
36
36
 
37
+ ## Options
38
+
39
+ ### jsxImportSource
40
+
41
+ Control where the JSX factory is imported from.
42
+
43
+ ```ts
44
+ react({ jsxImportSource: "@emotion/react" });
45
+ ```
46
+
47
+ ### tsDecorators
48
+
49
+ Enable TypeScript decorators. Requires `experimentalDecorators` in tsconfig.
50
+
51
+ ```ts
52
+ react({ tsDecorators: true });
53
+ ```
54
+
55
+ ## plugins
56
+
57
+ Use SWC plugins. Enable SWC at build time.
58
+
59
+ ```ts
60
+ react({ plugins: [["@swc/plugin-styled-components", {}]] });
61
+ ```
62
+
37
63
  ## Consistent components exports
38
64
 
39
65
  For React refresh to work correctly, your file should only export React components. The best explanation I've read is the one from the [Gatsby docs](https://www.gatsbyjs.com/docs/reference/local-development/fast-refresh/#how-it-works).
package/index.cjs CHANGED
@@ -1,96 +1,61 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
1
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- default: () => src_default
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
2
  var import_fs = require("fs");
27
3
  var import_path = require("path");
28
4
  var import_url = require("url");
29
5
  var import_core = require("@swc/core");
6
+ var import_module = require("module");
30
7
  var import_meta = {};
31
8
  var runtimePublicPath = "/@react-refresh";
32
- var preambleCode = `import { injectIntoGlobalHook } from "${runtimePublicPath}";
9
+ var preambleCode = `import { injectIntoGlobalHook } from "__PATH__";
33
10
  injectIntoGlobalHook(window);
34
11
  window.$RefreshReg$ = () => {};
35
12
  window.$RefreshSig$ = () => (type) => type;`;
36
13
  var _dirname = typeof __dirname !== "undefined" ? __dirname : (0, import_path.dirname)((0, import_url.fileURLToPath)(import_meta.url));
14
+ var resolve = (0, import_module.createRequire)(
15
+ typeof __filename !== "undefined" ? __filename : import_meta.url
16
+ ).resolve;
37
17
  var refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
38
- var react = () => [
39
- {
40
- name: "vite:react-swc",
41
- apply: "serve",
42
- config: () => ({
43
- esbuild: false,
44
- optimizeDeps: { include: ["react/jsx-dev-runtime"] }
45
- }),
46
- resolveId: (id) => id === runtimePublicPath ? id : void 0,
47
- load: (id) => id === runtimePublicPath ? (0, import_fs.readFileSync)((0, import_path.join)(_dirname, "refresh-runtime.js"), "utf-8") : void 0,
48
- transformIndexHtml: () => [
49
- { tag: "script", attrs: { type: "module" }, children: preambleCode }
50
- ],
51
- async transform(code, id, transformOptions) {
52
- if (id.includes("node_modules"))
53
- return;
54
- const parser = id.endsWith(".tsx") ? { syntax: "typescript", tsx: true } : id.endsWith(".ts") ? { syntax: "typescript", tsx: false } : id.endsWith(".jsx") ? { syntax: "ecmascript", jsx: true } : void 0;
55
- if (!parser)
56
- return;
57
- let result;
58
- try {
59
- result = await (0, import_core.transform)(code, {
60
- filename: id,
61
- swcrc: false,
62
- configFile: false,
63
- sourceMaps: true,
64
- jsc: {
65
- target: "es2020",
66
- parser,
67
- transform: {
68
- useDefineForClassFields: true,
69
- react: {
70
- refresh: !(transformOptions == null ? void 0 : transformOptions.ssr),
71
- development: true,
72
- useBuiltins: true,
73
- runtime: "automatic"
74
- }
75
- }
76
- }
18
+ var react = (_options) => {
19
+ const options = {
20
+ jsxImportSource: _options == null ? void 0 : _options.jsxImportSource,
21
+ tsDecorators: _options == null ? void 0 : _options.tsDecorators,
22
+ plugins: (_options == null ? void 0 : _options.plugins) ? _options == null ? void 0 : _options.plugins.map((el) => [resolve(el[0]), el[1]]) : void 0
23
+ };
24
+ return [
25
+ {
26
+ name: "vite:react-swc",
27
+ apply: "serve",
28
+ config: () => ({
29
+ esbuild: false,
30
+ optimizeDeps: { include: ["react/jsx-dev-runtime"] }
31
+ }),
32
+ resolveId: (id) => id === runtimePublicPath ? id : void 0,
33
+ load: (id) => id === runtimePublicPath ? (0, import_fs.readFileSync)((0, import_path.join)(_dirname, "refresh-runtime.js"), "utf-8") : void 0,
34
+ transformIndexHtml: (_, config) => [
35
+ {
36
+ tag: "script",
37
+ attrs: { type: "module" },
38
+ children: preambleCode.replace(
39
+ "__PATH__",
40
+ config.server.config.base + runtimePublicPath.slice(1)
41
+ )
42
+ }
43
+ ],
44
+ async transform(code, _id, transformOptions) {
45
+ const id = _id.split("?")[0];
46
+ const result = await transformWithOptions(id, code, options, {
47
+ refresh: !(transformOptions == null ? void 0 : transformOptions.ssr),
48
+ development: true,
49
+ useBuiltins: true,
50
+ runtime: "automatic",
51
+ importSource: options == null ? void 0 : options.jsxImportSource
77
52
  });
78
- } catch (e) {
79
- const message = e.message;
80
- const fileStartIndex = message.indexOf("\u256D\u2500[");
81
- if (fileStartIndex !== -1) {
82
- const match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
83
- if (match) {
84
- e.line = match[1];
85
- e.column = match[2];
86
- }
53
+ if (!result)
54
+ return;
55
+ if ((transformOptions == null ? void 0 : transformOptions.ssr) || !refreshContentRE.test(result.code)) {
56
+ return result;
87
57
  }
88
- throw e;
89
- }
90
- if ((transformOptions == null ? void 0 : transformOptions.ssr) || !refreshContentRE.test(result.code)) {
91
- return result;
92
- }
93
- result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
58
+ result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
94
59
 
95
60
  if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
96
61
  const prevRefreshReg = window.$RefreshReg$;
@@ -102,30 +67,83 @@ var react = () => [
102
67
 
103
68
  window.$RefreshReg$ = prevRefreshReg;
104
69
  window.$RefreshSig$ = prevRefreshSig;
105
- import.meta.hot.accept((nextExports) => {
106
- if (!nextExports) return;
107
- import(/* @vite-ignore */ import.meta.url).then((current) => {
108
- const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(current, nextExports);
109
- if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
70
+ import(/* @vite-ignore */ import.meta.url).then((currentExports) => {
71
+ RefreshRuntime.registerExportsForReactRefresh("${id}", currentExports);
72
+ import.meta.hot.accept((nextExports) => {
73
+ if (!nextExports) return;
74
+ const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(currentExports, nextExports);
75
+ if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
76
+ });
110
77
  });
111
- });
112
78
  `;
113
- const sourceMap = JSON.parse(result.map);
114
- sourceMap.mappings = ";;;;;;;;" + sourceMap.mappings;
115
- return { code: result.code, map: sourceMap };
79
+ const sourceMap = JSON.parse(result.map);
80
+ sourceMap.mappings = ";;;;;;;;" + sourceMap.mappings;
81
+ return { code: result.code, map: sourceMap };
82
+ }
83
+ },
84
+ options.plugins ? {
85
+ name: "vite:react-swc",
86
+ apply: "build",
87
+ transform: (code, _id) => transformWithOptions(_id.split("?")[0], code, options, {
88
+ useBuiltins: true,
89
+ runtime: "automatic",
90
+ importSource: options == null ? void 0 : options.jsxImportSource
91
+ })
92
+ } : {
93
+ name: "vite:react-swc",
94
+ apply: "build",
95
+ config: () => ({
96
+ esbuild: {
97
+ jsx: "automatic",
98
+ jsxImportSource: options == null ? void 0 : options.jsxImportSource,
99
+ tsconfigRaw: {
100
+ compilerOptions: { useDefineForClassFields: true }
101
+ }
102
+ }
103
+ })
116
104
  }
117
- },
118
- {
119
- name: "vite:react-swc",
120
- apply: "build",
121
- config: () => ({
122
- esbuild: {
123
- jsx: "automatic",
124
- tsconfigRaw: { compilerOptions: { useDefineForClassFields: true } }
105
+ ];
106
+ };
107
+ var transformWithOptions = async (id, code, options, reactConfig) => {
108
+ if (id.includes("node_modules"))
109
+ return;
110
+ const decorators = (options == null ? void 0 : options.tsDecorators) ?? false;
111
+ const parser = id.endsWith(".tsx") ? { syntax: "typescript", tsx: true, decorators } : id.endsWith(".ts") ? { syntax: "typescript", tsx: false, decorators } : id.endsWith(".jsx") ? { syntax: "ecmascript", jsx: true } : void 0;
112
+ if (!parser)
113
+ return;
114
+ let result;
115
+ try {
116
+ result = await (0, import_core.transform)(code, {
117
+ filename: id,
118
+ swcrc: false,
119
+ configFile: false,
120
+ sourceMaps: true,
121
+ jsc: {
122
+ target: "es2020",
123
+ parser,
124
+ experimental: { plugins: options.plugins },
125
+ transform: {
126
+ useDefineForClassFields: true,
127
+ react: reactConfig
128
+ }
125
129
  }
126
- })
130
+ });
131
+ } catch (e) {
132
+ const message = e.message;
133
+ const fileStartIndex = message.indexOf("\u256D\u2500[");
134
+ if (fileStartIndex !== -1) {
135
+ const match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
136
+ if (match) {
137
+ e.line = match[1];
138
+ e.column = match[2];
139
+ }
140
+ }
141
+ throw e;
127
142
  }
128
- ];
143
+ return result;
144
+ };
129
145
  var src_default = react;
130
- // Annotate the CommonJS export names for ESM import in node:
131
- 0 && (module.exports = {});
146
+
147
+ // <stdin>
148
+ module.exports = src_default;
149
+ module.exports.default = src_default;
package/index.d.ts CHANGED
@@ -1,3 +1,20 @@
1
1
  import { PluginOption } from "vite";
2
- declare const react: () => PluginOption[];
2
+ type Options = {
3
+ /**
4
+ * Control where the JSX factory is imported from.
5
+ * @default "react"
6
+ */
7
+ jsxImportSource?: string;
8
+ /**
9
+ * Enable TypeScript decorators. Requires experimentalDecorators in tsconfig.
10
+ * @default false
11
+ */
12
+ tsDecorators?: boolean;
13
+ /**
14
+ * Use SWC plugins. Enable SWC at build time.
15
+ * @default undefined
16
+ */
17
+ plugins?: [string, Record<string, any>][];
18
+ };
19
+ declare const react: (_options?: Options) => PluginOption[];
3
20
  export default react;
package/index.mjs CHANGED
@@ -3,69 +3,58 @@ import { readFileSync } from "fs";
3
3
  import { dirname, join } from "path";
4
4
  import { fileURLToPath } from "url";
5
5
  import { transform } from "@swc/core";
6
+ import { createRequire } from "module";
6
7
  var runtimePublicPath = "/@react-refresh";
7
- var preambleCode = `import { injectIntoGlobalHook } from "${runtimePublicPath}";
8
+ var preambleCode = `import { injectIntoGlobalHook } from "__PATH__";
8
9
  injectIntoGlobalHook(window);
9
10
  window.$RefreshReg$ = () => {};
10
11
  window.$RefreshSig$ = () => (type) => type;`;
11
12
  var _dirname = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
13
+ var resolve = createRequire(
14
+ typeof __filename !== "undefined" ? __filename : import.meta.url
15
+ ).resolve;
12
16
  var refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
13
- var react = () => [
14
- {
15
- name: "vite:react-swc",
16
- apply: "serve",
17
- config: () => ({
18
- esbuild: false,
19
- optimizeDeps: { include: ["react/jsx-dev-runtime"] }
20
- }),
21
- resolveId: (id) => id === runtimePublicPath ? id : void 0,
22
- load: (id) => id === runtimePublicPath ? readFileSync(join(_dirname, "refresh-runtime.js"), "utf-8") : void 0,
23
- transformIndexHtml: () => [
24
- { tag: "script", attrs: { type: "module" }, children: preambleCode }
25
- ],
26
- async transform(code, id, transformOptions) {
27
- if (id.includes("node_modules"))
28
- return;
29
- const parser = id.endsWith(".tsx") ? { syntax: "typescript", tsx: true } : id.endsWith(".ts") ? { syntax: "typescript", tsx: false } : id.endsWith(".jsx") ? { syntax: "ecmascript", jsx: true } : void 0;
30
- if (!parser)
31
- return;
32
- let result;
33
- try {
34
- result = await transform(code, {
35
- filename: id,
36
- swcrc: false,
37
- configFile: false,
38
- sourceMaps: true,
39
- jsc: {
40
- target: "es2020",
41
- parser,
42
- transform: {
43
- useDefineForClassFields: true,
44
- react: {
45
- refresh: !(transformOptions == null ? void 0 : transformOptions.ssr),
46
- development: true,
47
- useBuiltins: true,
48
- runtime: "automatic"
49
- }
50
- }
51
- }
17
+ var react = (_options) => {
18
+ const options = {
19
+ jsxImportSource: _options == null ? void 0 : _options.jsxImportSource,
20
+ tsDecorators: _options == null ? void 0 : _options.tsDecorators,
21
+ plugins: (_options == null ? void 0 : _options.plugins) ? _options == null ? void 0 : _options.plugins.map((el) => [resolve(el[0]), el[1]]) : void 0
22
+ };
23
+ return [
24
+ {
25
+ name: "vite:react-swc",
26
+ apply: "serve",
27
+ config: () => ({
28
+ esbuild: false,
29
+ optimizeDeps: { include: ["react/jsx-dev-runtime"] }
30
+ }),
31
+ resolveId: (id) => id === runtimePublicPath ? id : void 0,
32
+ load: (id) => id === runtimePublicPath ? readFileSync(join(_dirname, "refresh-runtime.js"), "utf-8") : void 0,
33
+ transformIndexHtml: (_, config) => [
34
+ {
35
+ tag: "script",
36
+ attrs: { type: "module" },
37
+ children: preambleCode.replace(
38
+ "__PATH__",
39
+ config.server.config.base + runtimePublicPath.slice(1)
40
+ )
41
+ }
42
+ ],
43
+ async transform(code, _id, transformOptions) {
44
+ const id = _id.split("?")[0];
45
+ const result = await transformWithOptions(id, code, options, {
46
+ refresh: !(transformOptions == null ? void 0 : transformOptions.ssr),
47
+ development: true,
48
+ useBuiltins: true,
49
+ runtime: "automatic",
50
+ importSource: options == null ? void 0 : options.jsxImportSource
52
51
  });
53
- } catch (e) {
54
- const message = e.message;
55
- const fileStartIndex = message.indexOf("\u256D\u2500[");
56
- if (fileStartIndex !== -1) {
57
- const match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
58
- if (match) {
59
- e.line = match[1];
60
- e.column = match[2];
61
- }
52
+ if (!result)
53
+ return;
54
+ if ((transformOptions == null ? void 0 : transformOptions.ssr) || !refreshContentRE.test(result.code)) {
55
+ return result;
62
56
  }
63
- throw e;
64
- }
65
- if ((transformOptions == null ? void 0 : transformOptions.ssr) || !refreshContentRE.test(result.code)) {
66
- return result;
67
- }
68
- result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
57
+ result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
69
58
 
70
59
  if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
71
60
  const prevRefreshReg = window.$RefreshReg$;
@@ -77,30 +66,81 @@ var react = () => [
77
66
 
78
67
  window.$RefreshReg$ = prevRefreshReg;
79
68
  window.$RefreshSig$ = prevRefreshSig;
80
- import.meta.hot.accept((nextExports) => {
81
- if (!nextExports) return;
82
- import(/* @vite-ignore */ import.meta.url).then((current) => {
83
- const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(current, nextExports);
84
- if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
69
+ import(/* @vite-ignore */ import.meta.url).then((currentExports) => {
70
+ RefreshRuntime.registerExportsForReactRefresh("${id}", currentExports);
71
+ import.meta.hot.accept((nextExports) => {
72
+ if (!nextExports) return;
73
+ const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(currentExports, nextExports);
74
+ if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
75
+ });
85
76
  });
86
- });
87
77
  `;
88
- const sourceMap = JSON.parse(result.map);
89
- sourceMap.mappings = ";;;;;;;;" + sourceMap.mappings;
90
- return { code: result.code, map: sourceMap };
78
+ const sourceMap = JSON.parse(result.map);
79
+ sourceMap.mappings = ";;;;;;;;" + sourceMap.mappings;
80
+ return { code: result.code, map: sourceMap };
81
+ }
82
+ },
83
+ options.plugins ? {
84
+ name: "vite:react-swc",
85
+ apply: "build",
86
+ transform: (code, _id) => transformWithOptions(_id.split("?")[0], code, options, {
87
+ useBuiltins: true,
88
+ runtime: "automatic",
89
+ importSource: options == null ? void 0 : options.jsxImportSource
90
+ })
91
+ } : {
92
+ name: "vite:react-swc",
93
+ apply: "build",
94
+ config: () => ({
95
+ esbuild: {
96
+ jsx: "automatic",
97
+ jsxImportSource: options == null ? void 0 : options.jsxImportSource,
98
+ tsconfigRaw: {
99
+ compilerOptions: { useDefineForClassFields: true }
100
+ }
101
+ }
102
+ })
91
103
  }
92
- },
93
- {
94
- name: "vite:react-swc",
95
- apply: "build",
96
- config: () => ({
97
- esbuild: {
98
- jsx: "automatic",
99
- tsconfigRaw: { compilerOptions: { useDefineForClassFields: true } }
104
+ ];
105
+ };
106
+ var transformWithOptions = async (id, code, options, reactConfig) => {
107
+ if (id.includes("node_modules"))
108
+ return;
109
+ const decorators = (options == null ? void 0 : options.tsDecorators) ?? false;
110
+ const parser = id.endsWith(".tsx") ? { syntax: "typescript", tsx: true, decorators } : id.endsWith(".ts") ? { syntax: "typescript", tsx: false, decorators } : id.endsWith(".jsx") ? { syntax: "ecmascript", jsx: true } : void 0;
111
+ if (!parser)
112
+ return;
113
+ let result;
114
+ try {
115
+ result = await transform(code, {
116
+ filename: id,
117
+ swcrc: false,
118
+ configFile: false,
119
+ sourceMaps: true,
120
+ jsc: {
121
+ target: "es2020",
122
+ parser,
123
+ experimental: { plugins: options.plugins },
124
+ transform: {
125
+ useDefineForClassFields: true,
126
+ react: reactConfig
127
+ }
100
128
  }
101
- })
129
+ });
130
+ } catch (e) {
131
+ const message = e.message;
132
+ const fileStartIndex = message.indexOf("\u256D\u2500[");
133
+ if (fileStartIndex !== -1) {
134
+ const match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
135
+ if (match) {
136
+ e.line = match[1];
137
+ e.column = match[2];
138
+ }
139
+ }
140
+ throw e;
102
141
  }
103
- ];
142
+ return result;
143
+ };
104
144
  var src_default = react;
105
145
  export {
106
146
  src_default as default
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-react-swc",
3
3
  "description": "Speed up your Vite dev server with SWC",
4
- "version": "3.0.0",
4
+ "version": "3.1.0-beta.2",
5
5
  "author": "Arnaud Barré (https://github.com/ArnaudBarre)",
6
6
  "license": "MIT",
7
7
  "repository": "github:vitejs/vite-plugin-react-swc",
@@ -24,9 +24,9 @@
24
24
  "fast refresh"
25
25
  ],
26
26
  "peerDependencies": {
27
- "vite": "^4.0.0"
27
+ "vite": "^4"
28
28
  },
29
29
  "dependencies": {
30
- "@swc/core": "^1.3.21"
30
+ "@swc/core": "^1.3.26"
31
31
  }
32
32
  }
@@ -111,7 +111,9 @@ function performReactRefresh() {
111
111
  });
112
112
  let update = {
113
113
  updatedFamilies,
114
+ // Families that will re-render preserving state
114
115
  staleFamilies
116
+ // Families that will be remounted
115
117
  };
116
118
  helpersByRendererID.forEach(function(helpers) {
117
119
  helpers.setRefreshHandler(resolveFamily);
@@ -375,6 +377,16 @@ function isLikelyComponentType(type) {
375
377
  }
376
378
  }
377
379
  }
380
+ function registerExportsForReactRefresh(filename, moduleExports) {
381
+ for (const key in moduleExports) {
382
+ if (key === "__esModule")
383
+ continue;
384
+ const exportValue = moduleExports[key];
385
+ if (isLikelyComponentType(exportValue)) {
386
+ register(exportValue, filename + " " + key);
387
+ }
388
+ }
389
+ }
378
390
  function validateRefreshBoundaryAndEnqueueUpdate(prevExports, nextExports) {
379
391
  if (!predicateOnExport(prevExports, (key) => !!nextExports[key])) {
380
392
  return "Could not Fast Refresh (export removed)";
@@ -409,9 +421,12 @@ function predicateOnExport(moduleExports, predicate) {
409
421
  }
410
422
  return true;
411
423
  }
424
+ var refresh_runtime_default = { injectIntoGlobalHook };
412
425
  export {
413
426
  createSignatureFunctionForTransform,
427
+ refresh_runtime_default as default,
414
428
  getRefreshReg,
415
429
  injectIntoGlobalHook,
430
+ registerExportsForReactRefresh,
416
431
  validateRefreshBoundaryAndEnqueueUpdate
417
432
  };