Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpack-dynamic-require

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-dynamic-require - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

98

lib/Dynamic.js

@@ -44,2 +44,36 @@ "use strict";

/*! onloadCSS. (onload callback for loadCSS) [c]2017 Filament Group, Inc. MIT License */
/* global navigator */
/* exported onloadCSS */
function onloadCSS(ss, callback) {
var called;
function newcb() {
if (!called && callback) {
called = true;
callback.call(ss);
}
}
if (ss.addEventListener) {
ss.addEventListener("load", newcb);
}
if (ss.attachEvent) {
ss.attachEvent("onload", newcb);
} // This code is for browsers that don’t support onload
// No support for onload (it'll bind but never fire):
// * Android 4.3 (Samsung Galaxy S4, Browserstack)
// * Android 4.2 Browser (Samsung Galaxy SIII Mini GT-I8200L)
// * Android 2.3 (Pantech Burst P9070)
// Weak inference targets Android < 4.4
if ("isApplicationInstalled" in navigator && "onloadcssdefined" in ss) {
ss.onloadcssdefined(newcb);
}
}
var jsonp = function jsonp(url) {

@@ -177,29 +211,45 @@ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

if (needComboCssChunk && needComboCssChunk.length) {
var comboCssChunks = needComboCssChunk.map(function (chunkName) {
return "deps/".concat(chunkName, ".css");
}).join();
var comboCssUrl = "".concat(baseUrl, "/??").concat(componentCss, ",").concat(comboCssChunks);
(0, _fgLoadcss.loadCSS)(comboCssUrl);
}
var ssPromise;
var comboCssChunks = needComboCssChunk.map(function (chunkName) {
return "deps/".concat(chunkName, ".css");
});
comboCssChunks.unshift(componentCss);
var comboCssUrl = "".concat(baseUrl, "/??").concat(comboCssChunks.join());
var ss = (0, _fgLoadcss.loadCSS)(comboCssUrl);
ssPromise = new Promise(function (resolve, reject) {
onloadCSS(ss, function () {
resolve();
});
setTimeout(reject, 5000);
}); // 并行加载js
if (needComboChunk && needComboChunk.length) {
var comboChunks = needComboChunk.map(function (chunkName) {
return "deps/".concat(chunkName, ".js");
}).join();
var comboUrl = "".concat(baseUrl, "/??").concat(componentChunks, ",").concat(comboChunks);
return new Promise(function (resolve, reject) {
(0, _scriptjs["default"])(comboUrl, function () {
try {
console.log('load combo js done', name);
var jsPromise;
var comboChunks = needComboChunk.map(function (chunkName) {
return "deps/".concat(chunkName, ".js");
});
comboChunks.unshift(componentChunks); // 补上必须的组件资源
var _module = g.webpackData(entryModuleName);
var comboUrl = "".concat(baseUrl, "/??").concat(comboChunks.join());
jsPromise = new Promise(function (resolve, reject) {
(0, _scriptjs["default"])(comboUrl, function () {
try {
console.log('load combo js done', name);
resolve(_module.a || _module);
} catch (e) {
reject(e);
}
});
var _module = g.webpackData(entryModuleName);
resolve(_module.a || _module);
} catch (e) {
reject(e);
}
});
}
});
return Promise.all([ssPromise, jsPromise]).then(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 2),
ss = _ref4[0],
module = _ref4[1];
return module;
})["catch"](function (e) {
console.warn('bootload module error', e);
});
})["catch"](function (error) {

@@ -210,2 +260,2 @@ console.warn('load remote error');

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9EeW5hbWljLnRzIl0sIm5hbWVzIjpbImciLCJ3aW5kb3ciLCJnbG9iYWwiLCJqc29ucCIsInVybCIsIm9wdCIsImZuIiwidGltZW91dCIsImNiS2V5IiwiY2JWYWwiLCJ0aW1lciIsIkRhdGUiLCJub3ciLCJzIiwic2xpY2UiLCJpbmRleE9mIiwic2NyaXB0IiwiZG9jdW1lbnQiLCJjcmVhdGVFbGVtZW50IiwicmVtb3ZlIiwiY2xlYXJUaW1lb3V0IiwiaGVhZCIsInJlbW92ZUNoaWxkIiwidW5kZWZpbmVkIiwic3JjIiwiZGF0YSIsImFwcGVuZENoaWxkIiwiUHJvbWlzZSIsInJlc29sdmUiLCJ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b21ib1VybCwgKCkgPT4ge1xuICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zb2xlLmxvZygnbG9hZCBjb21ibyBqcyBkb25lJywgbmFtZSk7XG4gICAgICAgICAgICBjb25zdCBtb2R1bGUgPSBnLndlYnBhY2tEYXRhKGVudHJ5TW9kdWxlTmFtZSk7XG4gICAgICAgICAgICByZXNvbHZlKG1vZHVsZS5hIHx8IG1vZHVsZSk7XG4gICAgICAgICAgfSBjYXRjaChlKSB7XG4gICAgICAgICAgICByZWplY3QoZSk7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgIH1cbiAgfSkuY2F0Y2goZnVuY3Rpb24oZXJyb3I6IGFueSkge1xuICAgIGNvbnNvbGUud2FybignbG9hZCByZW1vdGUgZXJyb3InKTtcbiAgICB0aHJvdyBlcnJvclxuICB9KVxufSJdfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9EeW5hbWljLnRzIl0sIm5hbWVzIjpbImciLCJ3aW5kb3ciLCJnbG9iYWwiLCJvbmxvYWRDU1MiLCJzcyIsImNhbGxiYWNrIiwiY2FsbGVkIiwibmV3Y2IiLCJjYWxsIiwiYWRkRXZlbnRMaXN0ZW5lciIsImF0dGFjaEV2ZW50IiwibmF2aWdhdG9yIiwib25sb2FkY3NzZGVmaW5lZCIsImpzb25wIiwidXJsIiwib3B0IiwiZm4iLCJ0aW1lb3V0IiwiY2JLZXkiLCJjYlZhbCIsInRpbWVyIiwiRGF0ZSIsIm5vdyIsInMiLCJzbGljZSIsImluZGV4T2YiLCJzY3JpcHQiLCJkb2N1bWVudCIsImNyZWF0ZUVsZW1lbnQiLCJyZW1vdmUiLCJjbGVhclRpbWVvdXQiLCJoZWFkIiwicmVtb3ZlQ2hpbGQiLCJ1bmRlZmluZWQiLCJzcmMiLCJkYXRhIiwiYXBwZW5kQ2hpbGQiLCJQcm9ta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AgcmVzb2x2ZShtb2R1bGUuYSB8fCBtb2R1bGUpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgcmVqZWN0KGUpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9KTtcbiAgICByZXR1cm4gUHJvbWlzZS5hbGwoW3NzUHJvbWlzZSwganNQcm9taXNlXSkudGhlbigoW3NzLCBtb2R1bGVdKSA9PiB7XG4gICAgICByZXR1cm4gbW9kdWxlO1xuICAgIH0pLmNhdGNoKGUgPT4ge1xuICAgICAgY29uc29sZS53YXJuKCdib290bG9hZCBtb2R1bGUgZXJyb3InLCBlKTtcbiAgICB9KVxuICB9KS5jYXRjaChmdW5jdGlvbiAoZXJyb3I6IGFueSkge1xuICAgIGNvbnNvbGUud2FybignbG9hZCByZW1vdGUgZXJyb3InKTtcbiAgICB0aHJvdyBlcnJvclxuICB9KVxufSJdfQ==
{
"name": "webpack-dynamic-require",
"version": "1.0.2",
"version": "1.0.3",
"description": "you can require cdn bundle dynamic",

@@ -5,0 +5,0 @@ "main": "lib/Dynamic.js",

@@ -27,3 +27,33 @@ import Scriptjs from 'scriptjs';

/*! onloadCSS. (onload callback for loadCSS) [c]2017 Filament Group, Inc. MIT License */
/* global navigator */
/* exported onloadCSS */
function onloadCSS(ss: any, callback?: () => void) {
let called: boolean | undefined;
function newcb() {
if (!called && callback) {
called = true;
callback.call(ss);
}
}
if (ss.addEventListener) {
ss.addEventListener("load", newcb);
}
if (ss.attachEvent) {
ss.attachEvent("onload", newcb);
}
// This code is for browsers that don’t support onload
// No support for onload (it'll bind but never fire):
// * Android 4.3 (Samsung Galaxy S4, Browserstack)
// * Android 4.2 Browser (Samsung Galaxy SIII Mini GT-I8200L)
// * Android 2.3 (Pantech Burst P9070)
// Weak inference targets Android < 4.4
if ("isApplicationInstalled" in navigator && "onloadcssdefined" in ss) {
ss.onloadcssdefined(newcb);
}
}
const jsonp = (url: string, opt: JSONOpt = {}, fn?: Function) => {

@@ -89,3 +119,3 @@

function getBlurVersion(version:string) {
function getBlurVersion(version: string) {
return version.split('.').map((v, i) => i > 0 ? 'x' : v).join('.');

@@ -112,3 +142,3 @@ }

cbVal: jsonpCallback
}).then(function(args) {
}).then(function (args) {
const modules: string[] = args[0];

@@ -127,2 +157,3 @@ const entry: string = args[1];

}
const componentChunks = 'vendor.js,component.js';

@@ -143,23 +174,36 @@ const componentCss = 'component.css';

// 先加载css
if (needComboCssChunk && needComboCssChunk.length) {
const comboCssChunks = needComboCssChunk.map(chunkName => `deps/${chunkName}.css`).join();
const comboCssUrl = `${baseUrl}/??${componentCss},${comboCssChunks}`;
loadCSS(comboCssUrl);
}
if (needComboChunk && needComboChunk.length) {
const comboChunks = needComboChunk.map(chunkName => `deps/${chunkName}.js`).join();
const comboUrl = `${baseUrl}/??${componentChunks},${comboChunks}`;
return new Promise((resolve, reject) => {
Scriptjs(comboUrl, () => {
try {
console.log('load combo js done', name);
const module = g.webpackData(entryModuleName);
resolve(module.a || module);
} catch(e) {
reject(e);
}
});
let ssPromise;
const comboCssChunks = needComboCssChunk.map(chunkName => `deps/${chunkName}.css`);
comboCssChunks.unshift(componentCss);
const comboCssUrl = `${baseUrl}/??${comboCssChunks.join()}`;
const ss = loadCSS(comboCssUrl);
ssPromise = new Promise((resolve, reject) => {
onloadCSS(ss, () => {
resolve();
});
}
}).catch(function(error: any) {
setTimeout(reject, 5000);
});
// 并行加载js
let jsPromise;
const comboChunks = needComboChunk.map(chunkName => `deps/${chunkName}.js`)
comboChunks.unshift(componentChunks); // 补上必须的组件资源
const comboUrl = `${baseUrl}/??${comboChunks.join()}`;
jsPromise = new Promise((resolve, reject) => {
Scriptjs(comboUrl, () => {
try {
console.log('load combo js done', name);
const module = g.webpackData(entryModuleName);
resolve(module.a || module);
} catch (e) {
reject(e);
}
});
});
return Promise.all([ssPromise, jsPromise]).then(([ss, module]) => {
return module;
}).catch(e => {
console.warn('bootload module error', e);
})
}).catch(function (error: any) {
console.warn('load remote error');

@@ -166,0 +210,0 @@ throw error

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc