Add .gitignore to exclude all node packages and lock files
This commit is contained in:
Generated
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
declare function registerExportsForReactRefresh(moduleExports: unknown, moduleID: unknown): void;
|
||||
declare function isReactRefreshBoundary(moduleExports: unknown): boolean;
|
||||
declare function getRefreshBoundarySignature(moduleExports: unknown): any[];
|
||||
declare function shouldInvalidateReactRefreshBoundary(prevExports: unknown, nextExports: unknown): boolean;
|
||||
declare function scheduleUpdate(): void;
|
||||
declare const _default: {
|
||||
registerExportsForReactRefresh: typeof registerExportsForReactRefresh;
|
||||
isReactRefreshBoundary: typeof isReactRefreshBoundary;
|
||||
shouldInvalidateReactRefreshBoundary: typeof shouldInvalidateReactRefreshBoundary;
|
||||
getRefreshBoundarySignature: typeof getRefreshBoundarySignature;
|
||||
scheduleUpdate: typeof scheduleUpdate;
|
||||
};
|
||||
export default _default;
|
||||
Generated
Vendored
+146
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// This file is copied from the Metro JavaScript bundler, with minor tweaks for
|
||||
// webpack compatibility.
|
||||
//
|
||||
// https://github.com/facebook/metro/blob/d6b9685c730d0d63577db40f41369157f28dfa3a/packages/metro/src/lib/polyfills/require.js
|
||||
const RefreshRuntime = require('react-refresh/runtime');
|
||||
function isSafeExport(key) {
|
||||
return (key === '__esModule' ||
|
||||
key === '__N_SSG' ||
|
||||
key === '__N_SSP' ||
|
||||
key === 'config');
|
||||
}
|
||||
function registerExportsForReactRefresh(moduleExports, moduleID) {
|
||||
RefreshRuntime.register(moduleExports, moduleID + ' %exports%');
|
||||
if (moduleExports === null ||
|
||||
moduleExports === undefined ||
|
||||
typeof moduleExports !== 'object') {
|
||||
// Exit if we can't iterate over exports.
|
||||
// (This is important for legacy environments.)
|
||||
return;
|
||||
}
|
||||
for (const key in moduleExports) {
|
||||
if (isSafeExport(key)) {
|
||||
continue;
|
||||
}
|
||||
// @ts-expect-error
|
||||
const exportValue = moduleExports[key];
|
||||
const typeID = moduleID + ' %exports% ' + key;
|
||||
RefreshRuntime.register(exportValue, typeID);
|
||||
}
|
||||
}
|
||||
function isReactRefreshBoundary(moduleExports) {
|
||||
if (RefreshRuntime.isLikelyComponentType(moduleExports)) {
|
||||
return true;
|
||||
}
|
||||
if (moduleExports === null ||
|
||||
moduleExports === undefined ||
|
||||
typeof moduleExports !== 'object') {
|
||||
// Exit if we can't iterate over exports.
|
||||
return false;
|
||||
}
|
||||
let hasExports = false;
|
||||
let areAllExportsComponents = true;
|
||||
for (const key in moduleExports) {
|
||||
hasExports = true;
|
||||
if (isSafeExport(key)) {
|
||||
continue;
|
||||
}
|
||||
// @ts-expect-error
|
||||
const exportValue = moduleExports[key];
|
||||
if (!RefreshRuntime.isLikelyComponentType(exportValue)) {
|
||||
areAllExportsComponents = false;
|
||||
}
|
||||
}
|
||||
return hasExports && areAllExportsComponents;
|
||||
}
|
||||
function getRefreshBoundarySignature(moduleExports) {
|
||||
const signature = [];
|
||||
signature.push(RefreshRuntime.getFamilyByType(moduleExports));
|
||||
if (moduleExports === null ||
|
||||
moduleExports === undefined ||
|
||||
typeof moduleExports !== 'object') {
|
||||
// Exit if we can't iterate over exports.
|
||||
// (This is important for legacy environments.)
|
||||
return signature;
|
||||
}
|
||||
for (const key in moduleExports) {
|
||||
if (isSafeExport(key)) {
|
||||
continue;
|
||||
}
|
||||
// @ts-expect-error
|
||||
const exportValue = moduleExports[key];
|
||||
signature.push(key);
|
||||
signature.push(RefreshRuntime.getFamilyByType(exportValue));
|
||||
}
|
||||
return signature;
|
||||
}
|
||||
function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
|
||||
const prevSignature = getRefreshBoundarySignature(prevExports);
|
||||
const nextSignature = getRefreshBoundarySignature(nextExports);
|
||||
if (prevSignature.length !== nextSignature.length) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < nextSignature.length; i++) {
|
||||
if (prevSignature[i] !== nextSignature[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function scheduleUpdate() {
|
||||
var _a, _b;
|
||||
const execute = () => {
|
||||
try {
|
||||
RefreshRuntime.performReactRefresh();
|
||||
}
|
||||
catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Warning: Failed to re-render. We will retry on the next Fast Refresh event.\n' +
|
||||
err);
|
||||
}
|
||||
};
|
||||
// Only trigger refresh if the webpack HMR state is idle
|
||||
if (((_a = __webpack_module__.hot) === null || _a === void 0 ? void 0 : _a.status()) === 'idle') {
|
||||
return;
|
||||
}
|
||||
(_b = __webpack_module__.hot) === null || _b === void 0 ? void 0 : _b.addStatusHandler((status) => {
|
||||
if (status === 'idle') {
|
||||
execute();
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.default = {
|
||||
registerExportsForReactRefresh,
|
||||
isReactRefreshBoundary,
|
||||
shouldInvalidateReactRefreshBoundary,
|
||||
getRefreshBoundarySignature,
|
||||
scheduleUpdate,
|
||||
};
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Vercel, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import type webpack from 'webpack';
|
||||
export declare class ReactFreshWebpackPlugin {
|
||||
apply(compiler: webpack.Compiler): void;
|
||||
}
|
||||
Generated
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReactFreshWebpackPlugin = void 0;
|
||||
const webpack_1 = require("webpack");
|
||||
class ReactRefreshRuntimeModule extends webpack_1.RuntimeModule {
|
||||
constructor() {
|
||||
super('react refresh', 5);
|
||||
}
|
||||
generate() {
|
||||
const { runtimeTemplate } = this.compilation;
|
||||
return webpack_1.Template.asString([
|
||||
`${webpack_1.RuntimeGlobals.interceptModuleExecution}.push(${runtimeTemplate.basicFunction('options', [
|
||||
`const originalFactory = options.factory;`,
|
||||
`options.factory = ${runtimeTemplate.basicFunction('moduleObject, moduleExports, webpackRequire', [
|
||||
// Legacy CSS implementations will `eval` browser code in a Node.js
|
||||
// context to extract CSS. For backwards compatibility, we need to check
|
||||
// we're in a browser context before continuing.
|
||||
`const hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$;`,
|
||||
`const cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : () => {};`,
|
||||
'try {',
|
||||
webpack_1.Template.indent('originalFactory.call(this, moduleObject, moduleExports, webpackRequire);'),
|
||||
'} finally {',
|
||||
webpack_1.Template.indent(`cleanup();`),
|
||||
'}',
|
||||
])}`,
|
||||
])})`,
|
||||
]);
|
||||
}
|
||||
}
|
||||
class ReactFreshWebpackPlugin {
|
||||
apply(compiler) {
|
||||
const webpackMajorVersion = parseInt(webpack_1.version !== null && webpack_1.version !== void 0 ? webpack_1.version : '', 10);
|
||||
if (webpackMajorVersion < 5) {
|
||||
throw new Error(`ReactFreshWebpackPlugin does not support webpack v${webpackMajorVersion}.`);
|
||||
}
|
||||
compiler.hooks.compilation.tap(this.constructor.name, (compilation) => {
|
||||
compilation.mainTemplate.hooks.localVars.tap(this.constructor.name, (source) => webpack_1.Template.asString([
|
||||
source,
|
||||
'',
|
||||
'// noop fns to prevent runtime errors during initialization',
|
||||
'if (typeof self !== "undefined") {',
|
||||
webpack_1.Template.indent('self.$RefreshReg$ = function () {};'),
|
||||
webpack_1.Template.indent('self.$RefreshSig$ = function () {'),
|
||||
webpack_1.Template.indent(webpack_1.Template.indent('return function (type) {')),
|
||||
webpack_1.Template.indent(webpack_1.Template.indent(webpack_1.Template.indent('return type;'))),
|
||||
webpack_1.Template.indent(webpack_1.Template.indent('};')),
|
||||
webpack_1.Template.indent('};'),
|
||||
'}',
|
||||
]));
|
||||
compilation.hooks.additionalTreeRuntimeRequirements.tap(this.constructor.name, (chunk) => {
|
||||
compilation.addRuntimeModule(chunk, new ReactRefreshRuntimeModule());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ReactFreshWebpackPlugin = ReactFreshWebpackPlugin;
|
||||
Generated
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* ⚠️ Be careful when refactoring this file!
|
||||
* This gets injected into every file of the browser.
|
||||
* You cannot have returns, optional chains, inverse the if statement etc.
|
||||
* Check the Typescript output in dist/ to see that no extra `var` statements were produced
|
||||
*/
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Vercel, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import type { LoaderDefinition } from 'webpack';
|
||||
declare global {
|
||||
const __webpack_hash__: unknown;
|
||||
interface HotNotifierInfo {
|
||||
type: 'self-declined' | 'declined' | 'unaccepted' | 'accepted' | 'disposed' | 'accept-errored' | 'self-accept-errored' | 'self-accept-error-handler-errored';
|
||||
/**
|
||||
* The module in question.
|
||||
*/
|
||||
moduleId: number;
|
||||
/**
|
||||
* For errors: the module id owning the accept handler.
|
||||
*/
|
||||
dependencyId?: number | undefined;
|
||||
/**
|
||||
* For declined/accepted/unaccepted: the chain from where the update was propagated.
|
||||
*/
|
||||
chain?: number[] | undefined;
|
||||
/**
|
||||
* For declined: the module id of the declining parent
|
||||
*/
|
||||
parentId?: number | undefined;
|
||||
/**
|
||||
* For accepted: the modules that are outdated and will be disposed
|
||||
*/
|
||||
outdatedModules?: number[] | undefined;
|
||||
/**
|
||||
* For accepted: The location of accept handlers that will handle the update
|
||||
*/
|
||||
outdatedDependencies?: {
|
||||
[dependencyId: number]: number[];
|
||||
} | undefined;
|
||||
/**
|
||||
* For errors: the thrown error
|
||||
*/
|
||||
error?: Error | undefined;
|
||||
/**
|
||||
* For self-accept-error-handler-errored: the error thrown by the module
|
||||
* before the error handler tried to handle it.
|
||||
*/
|
||||
originalError?: Error | undefined;
|
||||
}
|
||||
interface AcceptOptions {
|
||||
/**
|
||||
* If true the update process continues even if some modules are not accepted (and would bubble to the entry point).
|
||||
*/
|
||||
ignoreUnaccepted?: boolean | undefined;
|
||||
/**
|
||||
* Ignore changes made to declined modules.
|
||||
*/
|
||||
ignoreDeclined?: boolean | undefined;
|
||||
/**
|
||||
* Ignore errors throw in accept handlers, error handlers and while reevaluating module.
|
||||
*/
|
||||
ignoreErrored?: boolean | undefined;
|
||||
/**
|
||||
* Notifier for declined modules.
|
||||
*/
|
||||
onDeclined?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for unaccepted modules.
|
||||
*/
|
||||
onUnaccepted?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for accepted modules.
|
||||
*/
|
||||
onAccepted?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for disposed modules.
|
||||
*/
|
||||
onDisposed?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Notifier for errors.
|
||||
*/
|
||||
onErrored?: ((info: HotNotifierInfo) => void) | undefined;
|
||||
/**
|
||||
* Indicates that apply() is automatically called by check function
|
||||
*/
|
||||
autoApply?: boolean | undefined;
|
||||
}
|
||||
const __webpack_module__: {
|
||||
id: string;
|
||||
exports: unknown;
|
||||
hot: {
|
||||
accept: () => void;
|
||||
dispose: (onDispose: (data: Record<string, unknown>) => void) => void;
|
||||
invalidate: () => void;
|
||||
data?: Record<string, unknown>;
|
||||
addStatusHandler(callback: (status: string) => void): void;
|
||||
status(): string;
|
||||
apply(options?: AcceptOptions): Promise<ModuleId[]>;
|
||||
check(autoApply?: boolean): Promise<null | ModuleId[]>;
|
||||
};
|
||||
};
|
||||
type ModuleId = string | number;
|
||||
}
|
||||
declare const ReactRefreshLoader: LoaderDefinition;
|
||||
export default ReactRefreshLoader;
|
||||
Generated
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
/**
|
||||
* ⚠️ Be careful when refactoring this file!
|
||||
* This gets injected into every file of the browser.
|
||||
* You cannot have returns, optional chains, inverse the if statement etc.
|
||||
* Check the Typescript output in dist/ to see that no extra `var` statements were produced
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// This file is copied from the @vercel/next.js, with removed TS annotations
|
||||
//
|
||||
// https://github.com/vercel/next.js/blob/canary/packages/react-refresh-utils/loader.ts
|
||||
// This function gets unwrapped into global scope, which is why we don't invert
|
||||
// if-blocks. Also, you cannot use `return`.
|
||||
function RefreshModuleRuntime() {
|
||||
var _a, _b;
|
||||
// Legacy CSS implementations will `eval` browser code in a Node.js context
|
||||
// to extract CSS. For backwards compatibility, we need to check we're in a
|
||||
// browser context before continuing.
|
||||
if (typeof self !== 'undefined' &&
|
||||
// AMP / No-JS mode does not inject these helpers:
|
||||
'$RefreshHelpers$' in self) {
|
||||
const currentExports = __webpack_module__.exports;
|
||||
const prevExports = (_b = (_a = __webpack_module__.hot.data) === null || _a === void 0 ? void 0 : _a.prevExports) !== null && _b !== void 0 ? _b : null;
|
||||
// This cannot happen in MainTemplate because the exports mismatch between
|
||||
// templating and execution.
|
||||
self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports, __webpack_module__.id);
|
||||
// A module can be accepted automatically based on its exports, e.g. when
|
||||
// it is a Refresh Boundary.
|
||||
if (self.$RefreshHelpers$.isReactRefreshBoundary(currentExports)) {
|
||||
// Save the previous exports on update so we can compare the boundary
|
||||
// signatures.
|
||||
__webpack_module__.hot.dispose((data) => {
|
||||
data.prevExports = currentExports;
|
||||
});
|
||||
// Unconditionally accept an update to this module, we'll check if it's
|
||||
// still a Refresh Boundary later.
|
||||
__webpack_module__.hot.accept();
|
||||
// This field is set when the previous version of this module was a
|
||||
// Refresh Boundary, letting us know we need to check for invalidation or
|
||||
// enqueue an update.
|
||||
if (prevExports !== null) {
|
||||
// A boundary can become ineligible if its exports are incompatible
|
||||
// with the previous exports.
|
||||
//
|
||||
// For example, if you add/remove/change exports, we'll want to
|
||||
// re-execute the importing modules, and force those components to
|
||||
// re-render. Similarly, if you convert a class component to a
|
||||
// function, we want to invalidate the boundary.
|
||||
if (self.$RefreshHelpers$.shouldInvalidateReactRefreshBoundary(prevExports, currentExports)) {
|
||||
__webpack_module__.hot.invalidate();
|
||||
}
|
||||
else {
|
||||
self.$RefreshHelpers$.scheduleUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Since we just executed the code for the module, it's possible that the
|
||||
// new exports made it ineligible for being a boundary.
|
||||
// We only care about the case when we were _previously_ a boundary,
|
||||
// because we already accepted this update (accidental side effect).
|
||||
const isNoLongerABoundary = prevExports !== null;
|
||||
if (isNoLongerABoundary) {
|
||||
__webpack_module__.hot.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let refreshModuleRuntime = RefreshModuleRuntime.toString();
|
||||
refreshModuleRuntime = refreshModuleRuntime.slice(refreshModuleRuntime.indexOf('{') + 1, refreshModuleRuntime.lastIndexOf('}'));
|
||||
const ReactRefreshLoader = function (source, inputSourceMap) {
|
||||
// Importing a module that declares the global variables _a and _b
|
||||
// will conflict with the global variables that React Fast Refresh uses.
|
||||
// https://github.com/remotion-dev/remotion/issues/3699
|
||||
const renamedSymbols = refreshModuleRuntime
|
||||
.replace(/_a/g, '_remotion_globalVariableA')
|
||||
.replace(/_b/g, '_remotion_globalVariableB');
|
||||
this.callback(null, `${source}\n;${renamedSymbols}`, inputSourceMap);
|
||||
};
|
||||
exports.default = ReactRefreshLoader;
|
||||
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Vercel, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
declare global {
|
||||
interface Window {
|
||||
$RefreshReg$: (type: string, id?: string) => void;
|
||||
$RefreshSig$: () => (type: string) => unknown;
|
||||
$RefreshHelpers$: typeof RefreshHelpers;
|
||||
$RefreshInterceptModuleExecution$: (webpackId: unknown) => () => void;
|
||||
}
|
||||
}
|
||||
import RefreshHelpers from './helpers';
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
/// <reference lib="dom" />
|
||||
/// <reference lib="dom.iterable" />
|
||||
/**
|
||||
* Source code is adapted from https://github.com/WebHotelier/webpack-fast-refresh#readme and rewritten in Typescript. This file is MIT licensed.
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const RefreshRuntime = require('react-refresh/runtime');
|
||||
const helpers_1 = __importDefault(require("./helpers"));
|
||||
// Hook into ReactDOM initialization
|
||||
RefreshRuntime.injectIntoGlobalHook(self);
|
||||
// noop fns to prevent runtime errors during initialization
|
||||
self.$RefreshReg$ = () => undefined;
|
||||
self.$RefreshSig$ = () => (type) => type;
|
||||
// Register global helpers
|
||||
self.$RefreshHelpers$ = helpers_1.default;
|
||||
// Register a helper for module execution interception
|
||||
self.$RefreshInterceptModuleExecution$ = function (webpackModuleId) {
|
||||
const prevRefreshReg = self.$RefreshReg$;
|
||||
const prevRefreshSig = self.$RefreshSig$;
|
||||
self.$RefreshReg$ = (type, id) => {
|
||||
RefreshRuntime.register(type, webpackModuleId + ' ' + id);
|
||||
};
|
||||
self.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
||||
// Modeled after `useEffect` cleanup pattern:
|
||||
return () => {
|
||||
self.$RefreshReg$ = prevRefreshReg;
|
||||
self.$RefreshSig$ = prevRefreshSig;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user