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

gatsby-module-loader

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-module-loader - npm Package Compare versions

Comparing version 1.1.0-alpha.22c8a6f1 to 1.1.0-alpha.2e1e7782

.babelrc

38

index.js
"use strict";
var _stringify = require("babel-runtime/core-js/json/stringify");
var _stringify2 = _interopRequireDefault(_stringify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*

@@ -9,4 +15,4 @@ Based on Tobias Koppers @sokra bundle-loader

*/
const loaderUtils = require(`loader-utils`);
const path = require(`path`);
var loaderUtils = require("loader-utils");
var path = require("path");

@@ -17,4 +23,4 @@ module.exports = function () {};

const query = loaderUtils.parseQuery(this.query);
let chunkName = ``;
var query = loaderUtils.parseQuery(this.query);
var chunkName = "";

@@ -26,28 +32,14 @@ if (query.name) {

});
chunkName = `, ${JSON.stringify(chunkName)}`;
chunkName = ", " + (0, _stringify2.default)(chunkName);
}
const request = loaderUtils.stringifyRequest(this, `!!` + remainingRequest);
var request = loaderUtils.stringifyRequest(this, "!!" + remainingRequest);
const callback = `function() { return require(` + request + `) }`;
var callback = "function() { return require(" + request + ") }";
const executor = `
return require.ensure([], function(_, error) {
if (error) {
console.log('bundle loading error', error)
cb(true)
} else {
cb(null, ${callback})
}
}${chunkName});
`;
var executor = "return require.ensure([], function(_, error) {\n if (error) {\n console.log('bundle loading error', error)\n cb(true)\n } else {\n cb(null, " + callback + ")\n }\n }" + chunkName + ");\n ";
const result = `
require(
${loaderUtils.stringifyRequest(this, `!${path.join(__dirname, `patch.js`)}`)}
);
module.exports = function(cb) { ${executor} }
`;
var result = "require(\n " + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "patch.js")) + "\n );\n module.exports = function(cb) { " + executor + " }\n ";
return result;
};
{
"name": "gatsby-module-loader",
"version": "1.1.0-alpha.22c8a6f1",
"version": "1.1.0-alpha.2e1e7782",
"description": "_Based on https://github.com/webpack/bundle-loader and https://github.com/NekR/async-module-loader_",

@@ -8,3 +8,5 @@ "main": "index.js",

"build": "babel src --out-dir . --ignore __tests__",
"test": "echo \"Error: no test specified\" && exit 1"
"watch": "babel -w src --out-dir . --ignore __tests__",
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "cross-env NODE_ENV=production npm run build"
},

@@ -14,7 +16,9 @@ "author": "Kyle Mathews <mathews.kyle@gmail.com>",

"dependencies": {
"babel-runtime": "^6.26.0",
"loader-utils": "^0.2.16"
},
"devDependencies": {
"babel-cli": "^6.24.1"
"babel-cli": "^6.26.0",
"cross-env": "^5.0.5"
}
}

@@ -6,3 +6,3 @@ "use strict";

function patch() {
var head = document.querySelector(`head`);
var head = document.querySelector("head");
var ensure = __webpack_require__.e;

@@ -16,3 +16,3 @@ var chunks = __webpack_require__.s;

var handler = function (error) {
var handler = function handler(error) {
if (!callback) return;

@@ -71,5 +71,5 @@

if (script.tagName !== `SCRIPT`) {
if (typeof console !== `undefined` && console.warn) {
console.warn(`Script is not a script`, script);
if (script.tagName !== "SCRIPT") {
if (typeof console !== "undefined" && console.warn) {
console.warn("Script is not a script", script);
}

@@ -76,0 +76,0 @@

@@ -5,11 +5,11 @@ "use strict";

module.exports.prototype.apply = function (compiler) {
compiler.plugin(`compilation`, function (compilation) {
compilation.mainTemplate.plugin(`require-extensions`, function (source, chunk, hash) {
compiler.plugin("compilation", function (compilation) {
compilation.mainTemplate.plugin("require-extensions", function (source, chunk, hash) {
if (chunk.chunks.length > 0) {
var buf = [];
buf.push(``);
buf.push(``);
buf.push(`// expose the chunks object`);
buf.push(this.requireFn + `.s = installedChunks;`);
buf.push("");
buf.push("");
buf.push("// expose the chunks object");
buf.push(this.requireFn + ".s = installedChunks;");

@@ -16,0 +16,0 @@ return source + this.asString(buf);

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