@parcel/runtime-js
Advanced tools
Comparing version 2.0.0-nightly.87 to 2.0.0-nightly.88
@@ -30,5 +30,17 @@ "use strict"; | ||
return ('' + url).replace(/^((?:https?|file|ftp):\/\/.+)\/[^/]+$/, '$1') + '/'; | ||
} // TODO: Replace uses with `new URL(url).origin` when ie11 is no longer supported. | ||
function getOrigin(url) { | ||
let matches = ('' + url).match(/(https?|file|ftp):\/\/[^/]+/); | ||
if (!matches) { | ||
throw new Error('Origin not found'); | ||
} | ||
return matches[0]; | ||
} | ||
exports.getBundleURL = getBundleURLCached; | ||
exports.getBaseURL = getBaseURL; | ||
exports.getBaseURL = getBaseURL; | ||
exports.getOrigin = getOrigin; |
@@ -172,9 +172,19 @@ "use strict"; | ||
function getURLRuntime(dependency, bundle, externalBundle) { | ||
let relativePath = (0, _utils.relativeBundlePath)(bundle, externalBundle, { | ||
leadingDotSlash: false | ||
}); | ||
if (dependency.meta.webworker === true) { | ||
return { | ||
filePath: __filename, | ||
code: `module.exports = require('./get-worker-url')(${JSON.stringify(relativePath)});`, | ||
dependency | ||
}; | ||
} | ||
return { | ||
filePath: __filename, | ||
code: `module.exports = require('./bundle-url').getBundleURL() + ${JSON.stringify((0, _utils.relativeBundlePath)(bundle, externalBundle, { | ||
leadingDotSlash: false | ||
}))}`, | ||
code: `module.exports = require('./bundle-url').getBundleURL() + ${JSON.stringify(relativePath)}`, | ||
dependency | ||
}; | ||
} |
{ | ||
"name": "@parcel/runtime-js", | ||
"version": "2.0.0-nightly.87+fc51ae3d", | ||
"version": "2.0.0-nightly.88+7f447bec", | ||
"license": "MIT", | ||
@@ -19,6 +19,6 @@ "publishConfig": { | ||
"dependencies": { | ||
"@parcel/plugin": "2.0.0-nightly.87+fc51ae3d", | ||
"@parcel/utils": "2.0.0-nightly.87+fc51ae3d" | ||
"@parcel/plugin": "2.0.0-nightly.88+7f447bec", | ||
"@parcel/utils": "2.0.0-nightly.88+7f447bec" | ||
}, | ||
"gitHead": "fc51ae3db26fed5c400ef0c02d4f2a0a6623b9aa" | ||
"gitHead": "7f447bec1eaf6d16b64114658b0be67ae042bea5" | ||
} |
@@ -30,3 +30,13 @@ var bundleURL = null; | ||
// TODO: Replace uses with `new URL(url).origin` when ie11 is no longer supported. | ||
function getOrigin(url) { | ||
let matches = ('' + url).match(/(https?|file|ftp):\/\/[^/]+/); | ||
if (!matches) { | ||
throw new Error('Origin not found'); | ||
} | ||
return matches[0]; | ||
} | ||
exports.getBundleURL = getBundleURLCached; | ||
exports.getBaseURL = getBaseURL; | ||
exports.getOrigin = getOrigin; |
@@ -188,8 +188,20 @@ // @flow strict-local | ||
): RuntimeAsset { | ||
let relativePath = relativeBundlePath(bundle, externalBundle, { | ||
leadingDotSlash: false, | ||
}); | ||
if (dependency.meta.webworker === true) { | ||
return { | ||
filePath: __filename, | ||
code: `module.exports = require('./get-worker-url')(${JSON.stringify( | ||
relativePath, | ||
)});`, | ||
dependency, | ||
}; | ||
} | ||
return { | ||
filePath: __filename, | ||
code: `module.exports = require('./bundle-url').getBundleURL() + ${JSON.stringify( | ||
relativeBundlePath(bundle, externalBundle, { | ||
leadingDotSlash: false, | ||
}), | ||
relativePath, | ||
)}`, | ||
@@ -196,0 +208,0 @@ dependency, |
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
27310
29
743