@atlaspack/runtime-browser-hmr
Advanced tools
Comparing version 2.12.1-dev.3367 to 2.12.1-dev.3398
"use strict"; | ||
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __atlaspack__import__, __atlaspack__importScripts__, ServiceWorkerGlobalScope */ | ||
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ | ||
/*:: | ||
@@ -9,14 +9,14 @@ import type { | ||
} from '@atlaspack/reporter-dev-server/src/HMRServer.js'; | ||
interface AtlaspackRequire { | ||
interface ParcelRequire { | ||
(string): mixed; | ||
cache: {|[string]: AtlaspackModule|}; | ||
cache: {|[string]: ParcelModule|}; | ||
hotData: {|[string]: mixed|}; | ||
Module: any; | ||
parent: ?AtlaspackRequire; | ||
isAtlaspackRequire: true; | ||
parent: ?ParcelRequire; | ||
isParcelRequire: true; | ||
modules: {|[string]: [Function, {|[string]: string|}]|}; | ||
HMR_BUNDLE_ID: string; | ||
root: AtlaspackRequire; | ||
root: ParcelRequire; | ||
} | ||
interface AtlaspackModule { | ||
interface ParcelModule { | ||
hot: {| | ||
@@ -39,3 +39,3 @@ data: mixed, | ||
} | ||
declare var module: {bundle: AtlaspackRequire, ...}; | ||
declare var module: {bundle: ParcelRequire, ...}; | ||
declare var HMR_HOST: string; | ||
@@ -48,8 +48,8 @@ declare var HMR_PORT: string; | ||
declare var browser: ExtensionContext; | ||
declare var __atlaspack__import__: (string) => Promise<void>; | ||
declare var __atlaspack__importScripts__: (string) => Promise<void>; | ||
declare var __parcel__import__: (string) => Promise<void>; | ||
declare var __parcel__importScripts__: (string) => Promise<void>; | ||
declare var globalThis: typeof self; | ||
declare var ServiceWorkerGlobalScope: Object; | ||
*/ | ||
var OVERLAY_ID = '__atlaspack__error__overlay__'; | ||
var OVERLAY_ID = '__parcel__error__overlay__'; | ||
var OldModule = module.bundle.Module; | ||
@@ -73,3 +73,3 @@ function Module(moduleName) { | ||
module.bundle.hotData = {}; | ||
var checkedAssets /*: {|[string]: boolean|} */, assetsToDispose /*: Array<[AtlaspackRequire, string]> */, assetsToAccept /*: Array<[AtlaspackRequire, string]> */; | ||
var checkedAssets /*: {|[string]: boolean|} */, assetsToDispose /*: Array<[ParcelRequire, string]> */, assetsToAccept /*: Array<[ParcelRequire, string]> */; | ||
@@ -85,3 +85,3 @@ function getHostname() { | ||
var parent = module.bundle.parent; | ||
if ((!parent || !parent.isAtlaspackRequire) && typeof WebSocket !== 'undefined') { | ||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { | ||
var hostname = getHostname(); | ||
@@ -92,3 +92,3 @@ var port = getPort(); | ||
if (HMR_USE_SSE) { | ||
ws = new EventSource('/__atlaspack_hmr'); | ||
ws = new EventSource('/__parcel_hmr'); | ||
} else { | ||
@@ -141,3 +141,3 @@ try { | ||
if (typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') { | ||
window.dispatchEvent(new CustomEvent('atlaspackhmraccept')); | ||
window.dispatchEvent(new CustomEvent('parcelhmraccept')); | ||
} | ||
@@ -168,6 +168,6 @@ await hmrApplyUpdates(assets); | ||
if (data.type === 'error') { | ||
// Log atlaspack errors to console | ||
// Log parcel errors to console | ||
for (let ansiDiagnostic of data.diagnostics.ansi) { | ||
let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack; | ||
console.error('🚨 [atlaspack]: ' + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n')); | ||
console.error('🚨 [parcel]: ' + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n')); | ||
} | ||
@@ -190,3 +190,3 @@ if (typeof document !== 'undefined') { | ||
ws.onclose = function () { | ||
console.warn('[atlaspack] 🚨 Connection to the HMR server was lost'); | ||
console.warn('[parcel] 🚨 Connection to the HMR server was lost'); | ||
}; | ||
@@ -199,3 +199,3 @@ } | ||
overlay.remove(); | ||
console.log('[atlaspack] ✨ Error resolved'); | ||
console.log('[parcel] ✨ Error resolved'); | ||
} | ||
@@ -210,3 +210,3 @@ } | ||
return `${p} | ||
<a href="/__atlaspack_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a> | ||
<a href="/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a> | ||
${frame.code}`; | ||
@@ -238,3 +238,3 @@ }, '') : diagnostic.stack; | ||
} | ||
function getParents(bundle, id) /*: Array<[AtlaspackRequire, string]> */{ | ||
function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */{ | ||
var modules = bundle.modules; | ||
@@ -314,7 +314,7 @@ if (!modules) { | ||
if (asset.outputFormat === 'esmodule') { | ||
return __atlaspack__import__(asset.url + '?t=' + Date.now()); | ||
return __parcel__import__(asset.url + '?t=' + Date.now()); | ||
} else { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
__atlaspack__importScripts__(asset.url + '?t=' + Date.now()); | ||
__parcel__importScripts__(asset.url + '?t=' + Date.now()); | ||
resolve(); | ||
@@ -330,3 +330,3 @@ } catch (err) { | ||
async function hmrApplyUpdates(assets) { | ||
global.atlaspackHotUpdate = Object.create(null); | ||
global.parcelHotUpdate = Object.create(null); | ||
let scriptsToRemove; | ||
@@ -358,3 +358,3 @@ try { | ||
} finally { | ||
delete global.atlaspackHotUpdate; | ||
delete global.parcelHotUpdate; | ||
if (scriptsToRemove) { | ||
@@ -370,3 +370,3 @@ scriptsToRemove.forEach(script => { | ||
} | ||
function hmrApply(bundle /*: AtlaspackRequire */, asset /*: HMRAsset */) { | ||
function hmrApply(bundle /*: ParcelRequire */, asset /*: HMRAsset */) { | ||
var modules = bundle.modules; | ||
@@ -402,3 +402,3 @@ if (!modules) { | ||
// $FlowFixMe | ||
let fn = global.atlaspackHotUpdate[asset.id]; | ||
let fn = global.parcelHotUpdate[asset.id]; | ||
modules[asset.id] = [fn, deps]; | ||
@@ -438,3 +438,3 @@ } else if (bundle.parent) { | ||
} | ||
function hmrAcceptCheck(bundle /*: AtlaspackRequire */, id /*: string */, depsByBundle /*: ?{ [string]: { [string]: string } }*/) { | ||
function hmrAcceptCheck(bundle /*: ParcelRequire */, id /*: string */, depsByBundle /*: ?{ [string]: { [string]: string } }*/) { | ||
if (hmrAcceptCheckOne(bundle, id, depsByBundle)) { | ||
@@ -466,3 +466,3 @@ return true; | ||
} | ||
function hmrAcceptCheckOne(bundle /*: AtlaspackRequire */, id /*: string */, depsByBundle /*: ?{ [string]: { [string]: string } }*/) { | ||
function hmrAcceptCheckOne(bundle /*: ParcelRequire */, id /*: string */, depsByBundle /*: ?{ [string]: { [string]: string } }*/) { | ||
var modules = bundle.modules; | ||
@@ -491,3 +491,3 @@ if (!modules) { | ||
} | ||
function hmrDispose(bundle /*: AtlaspackRequire */, id /*: string */) { | ||
function hmrDispose(bundle /*: ParcelRequire */, id /*: string */) { | ||
var cached = bundle.cache[id]; | ||
@@ -505,3 +505,3 @@ bundle.hotData[id] = {}; | ||
} | ||
function hmrAccept(bundle /*: AtlaspackRequire */, id /*: string */) { | ||
function hmrAccept(bundle /*: ParcelRequire */, id /*: string */) { | ||
// Execute the module. | ||
@@ -508,0 +508,0 @@ bundle(id); |
{ | ||
"name": "@atlaspack/runtime-browser-hmr", | ||
"version": "2.12.1-dev.3367+07fefed65", | ||
"version": "2.12.1-dev.3398+81c73b3cd", | ||
"license": "MIT", | ||
@@ -16,9 +16,9 @@ "publishConfig": { | ||
"node": ">= 16.0.0", | ||
"atlaspack": "^2.12.1-dev.3367+07fefed65" | ||
"parcel": "^2.12.1-dev.3398+81c73b3cd" | ||
}, | ||
"dependencies": { | ||
"@atlaspack/plugin": "2.12.1-dev.3367+07fefed65", | ||
"@atlaspack/utils": "2.12.1-dev.3367+07fefed65" | ||
"@atlaspack/plugin": "2.12.1-dev.3398+81c73b3cd", | ||
"@atlaspack/utils": "2.12.1-dev.3398+81c73b3cd" | ||
}, | ||
"gitHead": "07fefed65a9a4d7bd0bdc9c45b39704ee4ca70dd" | ||
"gitHead": "81c73b3cdf93adf8b0013be9fed5422579bd5910" | ||
} |
// @flow | ||
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __atlaspack__import__, __atlaspack__importScripts__, ServiceWorkerGlobalScope */ | ||
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ | ||
@@ -9,14 +9,14 @@ /*:: | ||
} from '@atlaspack/reporter-dev-server/src/HMRServer.js'; | ||
interface AtlaspackRequire { | ||
interface ParcelRequire { | ||
(string): mixed; | ||
cache: {|[string]: AtlaspackModule|}; | ||
cache: {|[string]: ParcelModule|}; | ||
hotData: {|[string]: mixed|}; | ||
Module: any; | ||
parent: ?AtlaspackRequire; | ||
isAtlaspackRequire: true; | ||
parent: ?ParcelRequire; | ||
isParcelRequire: true; | ||
modules: {|[string]: [Function, {|[string]: string|}]|}; | ||
HMR_BUNDLE_ID: string; | ||
root: AtlaspackRequire; | ||
root: ParcelRequire; | ||
} | ||
interface AtlaspackModule { | ||
interface ParcelModule { | ||
hot: {| | ||
@@ -39,3 +39,3 @@ data: mixed, | ||
} | ||
declare var module: {bundle: AtlaspackRequire, ...}; | ||
declare var module: {bundle: ParcelRequire, ...}; | ||
declare var HMR_HOST: string; | ||
@@ -48,4 +48,4 @@ declare var HMR_PORT: string; | ||
declare var browser: ExtensionContext; | ||
declare var __atlaspack__import__: (string) => Promise<void>; | ||
declare var __atlaspack__importScripts__: (string) => Promise<void>; | ||
declare var __parcel__import__: (string) => Promise<void>; | ||
declare var __parcel__importScripts__: (string) => Promise<void>; | ||
declare var globalThis: typeof self; | ||
@@ -55,3 +55,3 @@ declare var ServiceWorkerGlobalScope: Object; | ||
var OVERLAY_ID = '__atlaspack__error__overlay__'; | ||
var OVERLAY_ID = '__parcel__error__overlay__'; | ||
@@ -79,4 +79,4 @@ var OldModule = module.bundle.Module; | ||
var checkedAssets /*: {|[string]: boolean|} */, | ||
assetsToDispose /*: Array<[AtlaspackRequire, string]> */, | ||
assetsToAccept /*: Array<[AtlaspackRequire, string]> */; | ||
assetsToDispose /*: Array<[ParcelRequire, string]> */, | ||
assetsToAccept /*: Array<[ParcelRequire, string]> */; | ||
@@ -96,6 +96,3 @@ function getHostname() { | ||
var parent = module.bundle.parent; | ||
if ( | ||
(!parent || !parent.isAtlaspackRequire) && | ||
typeof WebSocket !== 'undefined' | ||
) { | ||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { | ||
var hostname = getHostname(); | ||
@@ -112,3 +109,3 @@ var port = getPort(); | ||
if (HMR_USE_SSE) { | ||
ws = new EventSource('/__atlaspack_hmr'); | ||
ws = new EventSource('/__parcel_hmr'); | ||
} else { | ||
@@ -179,3 +176,3 @@ try { | ||
) { | ||
window.dispatchEvent(new CustomEvent('atlaspackhmraccept')); | ||
window.dispatchEvent(new CustomEvent('parcelhmraccept')); | ||
} | ||
@@ -210,3 +207,3 @@ | ||
if (data.type === 'error') { | ||
// Log atlaspack errors to console | ||
// Log parcel errors to console | ||
for (let ansiDiagnostic of data.diagnostics.ansi) { | ||
@@ -218,3 +215,3 @@ let stack = ansiDiagnostic.codeframe | ||
console.error( | ||
'🚨 [atlaspack]: ' + | ||
'🚨 [parcel]: ' + | ||
ansiDiagnostic.message + | ||
@@ -245,3 +242,3 @@ '\n' + | ||
if (process.env.ATLASPACK_BUILD_ENV !== 'test') { | ||
console.warn('[atlaspack] 🚨 Connection to the HMR server was lost'); | ||
console.warn('[parcel] 🚨 Connection to the HMR server was lost'); | ||
} | ||
@@ -256,3 +253,3 @@ }; | ||
overlay.remove(); | ||
console.log('[atlaspack] ✨ Error resolved'); | ||
console.log('[parcel] ✨ Error resolved'); | ||
} | ||
@@ -272,3 +269,3 @@ } | ||
return `${p} | ||
<a href="/__atlaspack_launch_editor?file=${encodeURIComponent( | ||
<a href="/__parcel_launch_editor?file=${encodeURIComponent( | ||
frame.location, | ||
@@ -315,3 +312,3 @@ )}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${ | ||
function getParents(bundle, id) /*: Array<[AtlaspackRequire, string]> */ { | ||
function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ { | ||
var modules = bundle.modules; | ||
@@ -411,7 +408,7 @@ if (!modules) { | ||
if (asset.outputFormat === 'esmodule') { | ||
return __atlaspack__import__(asset.url + '?t=' + Date.now()); | ||
return __parcel__import__(asset.url + '?t=' + Date.now()); | ||
} else { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
__atlaspack__importScripts__(asset.url + '?t=' + Date.now()); | ||
__parcel__importScripts__(asset.url + '?t=' + Date.now()); | ||
resolve(); | ||
@@ -428,3 +425,3 @@ } catch (err) { | ||
async function hmrApplyUpdates(assets) { | ||
global.atlaspackHotUpdate = Object.create(null); | ||
global.parcelHotUpdate = Object.create(null); | ||
@@ -464,3 +461,3 @@ let scriptsToRemove; | ||
} finally { | ||
delete global.atlaspackHotUpdate; | ||
delete global.parcelHotUpdate; | ||
@@ -477,3 +474,3 @@ if (scriptsToRemove) { | ||
function hmrApply(bundle /*: AtlaspackRequire */, asset /*: HMRAsset */) { | ||
function hmrApply(bundle /*: ParcelRequire */, asset /*: HMRAsset */) { | ||
var modules = bundle.modules; | ||
@@ -511,3 +508,3 @@ if (!modules) { | ||
// $FlowFixMe | ||
let fn = global.atlaspackHotUpdate[asset.id]; | ||
let fn = global.parcelHotUpdate[asset.id]; | ||
modules[asset.id] = [fn, deps]; | ||
@@ -551,3 +548,3 @@ } else if (bundle.parent) { | ||
function hmrAcceptCheck( | ||
bundle /*: AtlaspackRequire */, | ||
bundle /*: ParcelRequire */, | ||
id /*: string */, | ||
@@ -585,3 +582,3 @@ depsByBundle /*: ?{ [string]: { [string]: string } }*/, | ||
function hmrAcceptCheckOne( | ||
bundle /*: AtlaspackRequire */, | ||
bundle /*: ParcelRequire */, | ||
id /*: string */, | ||
@@ -620,3 +617,3 @@ depsByBundle /*: ?{ [string]: { [string]: string } }*/, | ||
function hmrDispose(bundle /*: AtlaspackRequire */, id /*: string */) { | ||
function hmrDispose(bundle /*: ParcelRequire */, id /*: string */) { | ||
var cached = bundle.cache[id]; | ||
@@ -637,3 +634,3 @@ bundle.hotData[id] = {}; | ||
function hmrAccept(bundle /*: AtlaspackRequire */, id /*: string */) { | ||
function hmrAccept(bundle /*: ParcelRequire */, id /*: string */) { | ||
// Execute the module. | ||
@@ -640,0 +637,0 @@ bundle(id); |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
50847
1168