@parcel/runtime-js
Advanced tools
Comparing version 2.0.0-nightly.239 to 2.0.0-nightly.242
"use strict"; | ||
/* globals document:readonly */ | ||
var bundleURL = null; | ||
@@ -14,3 +15,2 @@ | ||
function getBundleURL() { | ||
// Attempt to find the URL of the current script and use that as the base URL | ||
try { | ||
@@ -17,0 +17,0 @@ throw new Error(); |
@@ -135,8 +135,10 @@ "use strict"; | ||
let bundleGroup = resolved.value; | ||
let bundlesInGroup = bundleGraph.getBundlesInBundleGroup(bundleGroup); | ||
let [firstBundle] = bundlesInGroup; | ||
let mainBundle = (0, _nullthrows.default)(bundleGraph.getBundlesInBundleGroup(bundleGroup).find(b => { | ||
let main = b.getMainEntry(); | ||
return main && bundleGroup.entryAssetId === main.id; | ||
})); | ||
if (firstBundle.isInline) { | ||
if (mainBundle.isInline) { | ||
assets.push({ | ||
filePath: _path.default.join(__dirname, `/bundles/${firstBundle.id}.js`), | ||
filePath: _path.default.join(__dirname, `/bundles/${mainBundle.id}.js`), | ||
code: `module.exports = ${JSON.stringify(dependency.id)};`, | ||
@@ -149,3 +151,3 @@ dependency | ||
assets.push(getURLRuntime(dependency, bundle, firstBundle)); | ||
assets.push(getURLRuntime(dependency, bundle, mainBundle)); | ||
} | ||
@@ -152,0 +154,0 @@ |
{ | ||
"name": "@parcel/runtime-js", | ||
"version": "2.0.0-nightly.239+df509222", | ||
"version": "2.0.0-nightly.242+ac5e8071", | ||
"license": "MIT", | ||
@@ -19,7 +19,7 @@ "publishConfig": { | ||
"dependencies": { | ||
"@parcel/plugin": "2.0.0-nightly.239+df509222", | ||
"@parcel/utils": "2.0.0-nightly.239+df509222", | ||
"@parcel/plugin": "2.0.0-nightly.242+ac5e8071", | ||
"@parcel/utils": "2.0.0-nightly.242+ac5e8071", | ||
"nullthrows": "^1.1.1" | ||
}, | ||
"gitHead": "df509222e6808e49009e77bff8f4f9bdc94865bc" | ||
"gitHead": "ac5e807141df2ab1d83853b631551b28643b5869" | ||
} |
@@ -0,1 +1,3 @@ | ||
/* globals document:readonly */ | ||
var bundleURL = null; | ||
@@ -12,2 +14,8 @@ function getBundleURLCached() { | ||
// Attempt to find the URL of the current script and use that as the base URL | ||
if (process.env.PARCEL_BUILD_ENV === 'test') { | ||
if (typeof document !== 'undefined' && 'currentScript' in document) { | ||
return getBaseURL(document.currentScript.src); | ||
} | ||
} | ||
try { | ||
@@ -14,0 +22,0 @@ throw new Error(); |
@@ -136,8 +136,12 @@ // @flow strict-local | ||
let bundleGroup = resolved.value; | ||
let bundlesInGroup = bundleGraph.getBundlesInBundleGroup(bundleGroup); | ||
let mainBundle = nullthrows( | ||
bundleGraph.getBundlesInBundleGroup(bundleGroup).find(b => { | ||
let main = b.getMainEntry(); | ||
return main && bundleGroup.entryAssetId === main.id; | ||
}), | ||
); | ||
let [firstBundle] = bundlesInGroup; | ||
if (firstBundle.isInline) { | ||
if (mainBundle.isInline) { | ||
assets.push({ | ||
filePath: path.join(__dirname, `/bundles/${firstBundle.id}.js`), | ||
filePath: path.join(__dirname, `/bundles/${mainBundle.id}.js`), | ||
code: `module.exports = ${JSON.stringify(dependency.id)};`, | ||
@@ -150,3 +154,3 @@ dependency, | ||
// URL dependency or not, fall back to including a runtime that exports the url | ||
assets.push(getURLRuntime(dependency, bundle, firstBundle)); | ||
assets.push(getURLRuntime(dependency, bundle, mainBundle)); | ||
} | ||
@@ -153,0 +157,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
41812
1206