imports-loader
Advanced tools
Comparing version 2.0.0 to 3.0.0
"use strict"; | ||
const loader = require('./index'); | ||
const loader = require("./index"); | ||
module.exports = loader.default; |
@@ -20,7 +20,7 @@ "use strict"; | ||
*/ | ||
const HEADER = '/*** IMPORTS FROM imports-loader ***/\n'; | ||
const HEADER = "/*** IMPORTS FROM imports-loader ***/\n"; | ||
function loader(content, sourceMap) { | ||
const options = this.getOptions(_options.default); | ||
const type = options.type || 'module'; | ||
const type = options.type || "module"; | ||
const callback = this.async(); | ||
@@ -30,3 +30,3 @@ let importsCode = HEADER; | ||
if (typeof options.imports !== 'undefined') { | ||
if (typeof options.imports !== "undefined") { | ||
try { | ||
@@ -41,12 +41,12 @@ imports = (0, _utils.getImports)(type, options.imports); | ||
const directive = (0, _utils.sourceHasUseStrict)(content); | ||
importsCode += Object.entries(imports).reduce((accumulator, item) => `${accumulator}${(0, _utils.renderImports)(this, type, item[0], item[1])}\n`, directive ? "'use strict';\n" : ''); | ||
importsCode += Object.entries(imports).reduce((accumulator, item) => `${accumulator}${(0, _utils.renderImports)(this, type, item[0], item[1])}\n`, directive ? "'use strict';\n" : ""); | ||
} | ||
if (typeof options.additionalCode !== 'undefined') { | ||
if (typeof options.additionalCode !== "undefined") { | ||
importsCode += `\n${options.additionalCode}\n`; | ||
} | ||
let codeAfterModule = ''; | ||
let codeAfterModule = ""; | ||
if (typeof options.wrapper !== 'undefined') { | ||
if (typeof options.wrapper !== "undefined") { | ||
let thisArg; | ||
@@ -56,10 +56,10 @@ let args; | ||
if (typeof options.wrapper === 'boolean') { | ||
thisArg = ''; | ||
params = ''; | ||
args = ''; | ||
} else if (typeof options.wrapper === 'string') { | ||
if (typeof options.wrapper === "boolean") { | ||
thisArg = ""; | ||
params = ""; | ||
args = ""; | ||
} else if (typeof options.wrapper === "string") { | ||
thisArg = options.wrapper; | ||
params = ''; | ||
args = ''; | ||
params = ""; | ||
args = ""; | ||
} else { | ||
@@ -72,7 +72,7 @@ ({ | ||
if (Array.isArray(args)) { | ||
params = args.join(', '); | ||
params = args.join(", "); | ||
args = params; | ||
} else { | ||
params = Object.keys(args).join(', '); | ||
args = Object.values(args).join(', '); | ||
params = Object.keys(args).join(", "); | ||
args = Object.values(args).join(", "); | ||
} | ||
@@ -82,3 +82,3 @@ } | ||
importsCode += `\n(function(${params}) {`; | ||
codeAfterModule += `\n}.call(${thisArg}${args ? `, ${args}` : ''}));\n`; | ||
codeAfterModule += `\n}.call(${thisArg}${args ? `, ${args}` : ""}));\n`; | ||
} | ||
@@ -85,0 +85,0 @@ |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _loaderUtils = require("loader-utils"); | ||
var _path = _interopRequireDefault(require("path")); | ||
@@ -17,4 +17,45 @@ var _stripComments = _interopRequireDefault(require("strip-comments")); | ||
const matchRelativePath = /^\.\.?[/\\]/; | ||
function isAbsolutePath(str) { | ||
return _path.default.posix.isAbsolute(str) || _path.default.win32.isAbsolute(str); | ||
} | ||
function isRelativePath(str) { | ||
return matchRelativePath.test(str); | ||
} | ||
function stringifyRequest(loaderContext, request) { | ||
const splitted = request.split("!"); | ||
const { | ||
context | ||
} = loaderContext; | ||
return JSON.stringify(splitted.map(part => { | ||
// First, separate singlePath from query, because the query might contain paths again | ||
const splittedPart = part.match(/^(.*?)(\?.*)/); | ||
const query = splittedPart ? splittedPart[2] : ""; | ||
let singlePath = splittedPart ? splittedPart[1] : part; | ||
if (isAbsolutePath(singlePath) && context) { | ||
singlePath = _path.default.relative(context, singlePath); | ||
if (isAbsolutePath(singlePath)) { | ||
// If singlePath still matches an absolute path, singlePath was on a different drive than context. | ||
// In this case, we leave the path platform-specific without replacing any separators. | ||
// @see https://github.com/webpack/loader-utils/pull/14 | ||
return singlePath + query; | ||
} | ||
if (isRelativePath(singlePath) === false) { | ||
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules). | ||
singlePath = `./${singlePath}`; | ||
} | ||
} | ||
return singlePath.replace(/\\/g, "/") + query; | ||
}).join("!")); | ||
} | ||
function forError(item) { | ||
return typeof item === 'string' ? item : `\n${JSON.stringify(item, null, ' ')}\n`; | ||
return typeof item === "string" ? item : `\n${JSON.stringify(item, null, " ")}\n`; | ||
} | ||
@@ -28,3 +69,3 @@ | ||
function splitCommand(command) { | ||
const result = command.split('|').map(item => item.split(' ')).reduce((acc, val) => acc.concat(val), []); | ||
const result = command.split("|").map(item => item.split(" ")).reduce((acc, val) => acc.concat(val), []); | ||
@@ -41,6 +82,6 @@ for (const item of result) { | ||
function resolveImports(type, item) { | ||
const defaultSyntax = type === 'module' ? 'default' : 'single'; | ||
const defaultSyntax = type === "module" ? "default" : "single"; | ||
let result; | ||
if (typeof item === 'string') { | ||
if (typeof item === "string") { | ||
const noWhitespaceItem = item.trim(); | ||
@@ -82,23 +123,23 @@ | ||
if (result.syntax === defaultSyntax && typeof result.name === 'undefined') { | ||
if (result.syntax === defaultSyntax && typeof result.name === "undefined") { | ||
result.name = result.moduleName; | ||
} | ||
if (['default', 'side-effects', 'single', 'pure'].includes(result.syntax) && typeof result.alias !== 'undefined') { | ||
if (["default", "side-effects", "single", "pure"].includes(result.syntax) && typeof result.alias !== "undefined") { | ||
throw new Error(`The "${result.syntax}" syntax does not support "${result.alias}" alias in "${forError(item)}" value`); | ||
} | ||
if (['side-effects', 'pure'].includes(result.syntax) && typeof result.name !== 'undefined') { | ||
if (["side-effects", "pure"].includes(result.syntax) && typeof result.name !== "undefined") { | ||
throw new Error(`The "${result.syntax}" syntax does not support "${result.name}" name in "${forError(item)}" value`); | ||
} | ||
if (['default', 'namespace', 'named', 'side-effects'].includes(result.syntax) && type === 'commonjs') { | ||
if (["default", "namespace", "named", "side-effects"].includes(result.syntax) && type === "commonjs") { | ||
throw new Error(`The "${type}" type does not support the "${result.syntax}" syntax in "${forError(item)}" value`); | ||
} | ||
if (['single', 'multiple', 'pure'].includes(result.syntax) && type === 'module') { | ||
if (["single", "multiple", "pure"].includes(result.syntax) && type === "module") { | ||
throw new Error(`The "${type}" format does not support the "${result.syntax}" syntax in "${forError(item)}" value`); | ||
} | ||
if (['namespace', 'named', 'multiple'].includes(result.syntax) && typeof result.name === 'undefined') { | ||
if (["namespace", "named", "multiple"].includes(result.syntax) && typeof result.name === "undefined") { | ||
throw new Error(`The "${result.syntax}" syntax needs the "name" option in "${forError(item)}" value`); | ||
@@ -112,5 +153,5 @@ } | ||
return array.reduce((accumulator, item) => { | ||
if (typeof item.alias !== 'undefined') { | ||
if (typeof item.alias !== "undefined") { | ||
accumulator.push({ | ||
type: 'alias', | ||
type: "alias", | ||
value: item.alias | ||
@@ -121,5 +162,5 @@ }); | ||
if (typeof item.name !== 'undefined') { | ||
if (typeof item.name !== "undefined") { | ||
accumulator.push({ | ||
type: 'name', | ||
type: "name", | ||
value: item.name | ||
@@ -139,5 +180,5 @@ }); | ||
let result; | ||
const importItems = typeof imports === 'string' && imports.includes(',') ? imports.split(',') : imports; | ||
const importItems = typeof imports === "string" && imports.includes(",") ? imports.split(",") : imports; | ||
if (typeof importItems === 'string') { | ||
if (typeof importItems === "string") { | ||
result = [resolveImports(type, importItems)]; | ||
@@ -149,6 +190,6 @@ } else { | ||
const identifiers = getIdentifiers(result); | ||
const duplicates = duplicateBy(identifiers, 'value'); | ||
const duplicates = duplicateBy(identifiers, "value"); | ||
if (duplicates.length > 0) { | ||
throw new Error(`Duplicate ${duplicates.map(identifier => `"${identifier.value}" (as "${identifier.type}")`).join(', ')} identifiers found in "\n${JSON.stringify(importItems, null, ' ')}\n" value`); | ||
throw new Error(`Duplicate ${duplicates.map(identifier => `"${identifier.value}" (as "${identifier.type}")`).join(", ")} identifiers found in "\n${JSON.stringify(importItems, null, " ")}\n" value`); | ||
} | ||
@@ -183,13 +224,13 @@ | ||
function renderImports(loaderContext, type, moduleName, imports) { | ||
let code = ''; | ||
let code = ""; | ||
if (type === 'commonjs') { | ||
if (type === "commonjs") { | ||
const pure = imports.filter(({ | ||
syntax | ||
}) => syntax === 'pure'); // Pure | ||
}) => syntax === "pure"); // Pure | ||
if (pure.length > 0) { | ||
pure.forEach((_, i) => { | ||
const needNewline = i < pure.length - 1 ? '\n' : ''; | ||
code += `require(${(0, _loaderUtils.stringifyRequest)(loaderContext, moduleName)});${needNewline}`; | ||
const needNewline = i < pure.length - 1 ? "\n" : ""; | ||
code += `require(${stringifyRequest(loaderContext, moduleName)});${needNewline}`; | ||
}); | ||
@@ -200,6 +241,6 @@ } | ||
syntax | ||
}) => syntax === 'single'); // Single | ||
}) => syntax === "single"); // Single | ||
if (singleImports.length > 0) { | ||
code += pure.length > 0 ? '\n' : ''; | ||
code += pure.length > 0 ? "\n" : ""; | ||
singleImports.forEach((singleImport, i) => { | ||
@@ -209,4 +250,4 @@ const { | ||
} = singleImport; | ||
const needNewline = i < singleImports.length - 1 ? '\n' : ''; | ||
code += `var ${name} = require(${(0, _loaderUtils.stringifyRequest)(loaderContext, moduleName)});${needNewline}`; | ||
const needNewline = i < singleImports.length - 1 ? "\n" : ""; | ||
code += `var ${name} = require(${stringifyRequest(loaderContext, moduleName)});${needNewline}`; | ||
}); | ||
@@ -217,9 +258,9 @@ } | ||
syntax | ||
}) => syntax === 'multiple'); // Multiple | ||
}) => syntax === "multiple"); // Multiple | ||
if (multipleImports.length > 0) { | ||
code += pure.length > 0 || singleImports.length > 0 ? '\n' : ''; | ||
code += pure.length > 0 || singleImports.length > 0 ? "\n" : ""; | ||
code += `var { `; | ||
multipleImports.forEach((multipleImport, i) => { | ||
const needComma = i > 0 ? ', ' : ''; | ||
const needComma = i > 0 ? ", " : ""; | ||
const { | ||
@@ -229,6 +270,6 @@ name, | ||
} = multipleImport; | ||
const separator = ': '; | ||
const separator = ": "; | ||
code += alias ? `${needComma}${name}${separator}${alias}` : `${needComma}${name}`; | ||
}); | ||
code += ` } = require(${(0, _loaderUtils.stringifyRequest)(loaderContext, moduleName)});`; | ||
code += ` } = require(${stringifyRequest(loaderContext, moduleName)});`; | ||
} | ||
@@ -241,8 +282,8 @@ | ||
syntax | ||
}) => syntax === 'side-effects'); // Side-effects | ||
}) => syntax === "side-effects"); // Side-effects | ||
if (sideEffectsImports.length > 0) { | ||
sideEffectsImports.forEach((_, i) => { | ||
const needNewline = i < sideEffectsImports.length - 1 ? '\n' : ''; | ||
code += `import ${(0, _loaderUtils.stringifyRequest)(loaderContext, moduleName)};${needNewline}`; | ||
const needNewline = i < sideEffectsImports.length - 1 ? "\n" : ""; | ||
code += `import ${stringifyRequest(loaderContext, moduleName)};${needNewline}`; | ||
}); | ||
@@ -254,9 +295,9 @@ return code; | ||
syntax | ||
}) => syntax === 'default'); | ||
}) => syntax === "default"); | ||
const namedImports = imports.filter(({ | ||
syntax | ||
}) => syntax === 'named'); | ||
}) => syntax === "named"); | ||
const namespaceImports = imports.filter(({ | ||
syntax | ||
}) => syntax === 'namespace'); // Default | ||
}) => syntax === "namespace"); // Default | ||
@@ -268,4 +309,4 @@ if (defaultImports.length > 0) { | ||
} = defaultImport; | ||
const needNewline = i < defaultImports.length - 1 ? '\n' : ''; | ||
code += `import ${name} from ${(0, _loaderUtils.stringifyRequest)(loaderContext, moduleName)};${needNewline}`; | ||
const needNewline = i < defaultImports.length - 1 ? "\n" : ""; | ||
code += `import ${name} from ${stringifyRequest(loaderContext, moduleName)};${needNewline}`; | ||
}); | ||
@@ -276,6 +317,6 @@ } // Named | ||
if (namedImports.length > 0) { | ||
code += defaultImports.length > 0 ? '\n' : ''; | ||
code += 'import { '; | ||
code += defaultImports.length > 0 ? "\n" : ""; | ||
code += "import { "; | ||
namedImports.forEach((namedImport, i) => { | ||
const needComma = i > 0 ? ', ' : ''; | ||
const needComma = i > 0 ? ", " : ""; | ||
const { | ||
@@ -285,6 +326,6 @@ name, | ||
} = namedImport; | ||
const separator = ' as '; | ||
const separator = " as "; | ||
code += alias ? `${needComma}${name}${separator}${alias}` : `${needComma}${name}`; | ||
}); | ||
code += ` } from ${(0, _loaderUtils.stringifyRequest)(loaderContext, moduleName)};`; | ||
code += ` } from ${stringifyRequest(loaderContext, moduleName)};`; | ||
} // Namespace | ||
@@ -294,3 +335,3 @@ | ||
if (namespaceImports.length > 0) { | ||
code += defaultImports.length > 0 || namedImports.length > 0 ? '\n' : ''; | ||
code += defaultImports.length > 0 || namedImports.length > 0 ? "\n" : ""; | ||
namespaceImports.forEach((namespaceImport, i) => { | ||
@@ -300,4 +341,4 @@ const { | ||
} = namespaceImport; | ||
const needNewline = i < namespaceImports.length - 1 ? '\n' : ''; | ||
code += `import * as ${name} from ${(0, _loaderUtils.stringifyRequest)(loaderContext, moduleName)};${needNewline}`; | ||
const needNewline = i < namespaceImports.length - 1 ? "\n" : ""; | ||
code += `import * as ${name} from ${stringifyRequest(loaderContext, moduleName)};${needNewline}`; | ||
}); | ||
@@ -304,0 +345,0 @@ } |
{ | ||
"name": "imports-loader", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "imports loader module for webpack", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 10.13.0" | ||
"node": ">= 12.13.0" | ||
}, | ||
@@ -34,5 +34,4 @@ "scripts": { | ||
"test": "npm run test:coverage", | ||
"prepare": "npm run build", | ||
"release": "standard-version", | ||
"defaults": "webpack-defaults" | ||
"prepare": "husky install && npm run build", | ||
"release": "standard-version" | ||
}, | ||
@@ -46,3 +45,2 @@ "files": [ | ||
"dependencies": { | ||
"loader-utils": "^2.0.0", | ||
"source-map": "^0.6.1", | ||
@@ -52,8 +50,7 @@ "strip-comments": "^2.0.1" | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.10", | ||
"@babel/core": "^7.12.10", | ||
"@babel/preset-env": "^7.12.11", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@webpack-contrib/defaults": "^6.3.0", | ||
"@babel/cli": "^7.14.3", | ||
"@babel/core": "^7.14.3", | ||
"@babel/preset-env": "^7.14.2", | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
@@ -65,13 +62,13 @@ "babel-jest": "^26.6.3", | ||
"del-cli": "^3.0.1", | ||
"eslint": "^7.17.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"husky": "^4.3.7", | ||
"eslint": "^7.26.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.2", | ||
"husky": "^6.0.0", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^10.5.3", | ||
"memfs": "^3.2.0", | ||
"lint-staged": "^11.0.0", | ||
"memfs": "^3.2.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.2.1", | ||
"standard-version": "^9.1.0", | ||
"webpack": "^5.13.0" | ||
"prettier": "^2.3.0", | ||
"standard-version": "^9.3.0", | ||
"webpack": "^5.37.0" | ||
}, | ||
@@ -78,0 +75,0 @@ "keywords": [ |
208
README.md
@@ -42,3 +42,3 @@ <div align="center"> | ||
```js | ||
$('img').doSomeAwesomeJqueryPluginStuff(); | ||
$("img").doSomeAwesomeJqueryPluginStuff(); | ||
``` | ||
@@ -61,3 +61,3 @@ | ||
// `%20` is space in a query string, equivalently `default jquery $` | ||
import myLib from 'imports-loader?imports=default|jquery|$!./example.js'; | ||
import myLib from "imports-loader?imports=default|jquery|$!./example.js"; | ||
// Adds the following code to the beginning of example.js: | ||
@@ -73,3 +73,3 @@ // | ||
```js | ||
import myLib from 'imports-loader?imports=default|jquery|$,angular!./example.js'; | ||
import myLib from "imports-loader?imports=default|jquery|$,angular!./example.js"; | ||
// `|` is separator in a query string, equivalently `default|jquery|$` and `angular` | ||
@@ -87,3 +87,3 @@ // Adds the following code to the beginning of example.js: | ||
```js | ||
import myLib from 'imports-loader?imports=named|library|myMethod,angular!./example.js'; | ||
import myLib from "imports-loader?imports=named|library|myMethod,angular!./example.js"; | ||
// `|` is separator in a query string, equivalently `named|library|myMethod` and `angular` | ||
@@ -128,3 +128,3 @@ // Adds the following code to the beginning of example.js: | ||
```js | ||
import myLib from 'imports-loader?additionalCode=var%20myVariable%20=%20false;!./example.js'; | ||
import myLib from "imports-loader?additionalCode=var%20myVariable%20=%20false;!./example.js"; | ||
// Adds the following code to the beginning of example.js: | ||
@@ -150,18 +150,18 @@ // | ||
// test: /example\.js/$ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: [ | ||
'default jquery $', | ||
'default lib_2 lib_2_default', | ||
'named lib_3 lib2_method_1', | ||
'named lib_3 lib2_method_2 lib_2_method_2_short', | ||
'namespace lib_4 my_namespace', | ||
'side-effects lib_5', | ||
"default jquery $", | ||
"default lib_2 lib_2_default", | ||
"named lib_3 lib2_method_1", | ||
"named lib_3 lib2_method_2 lib_2_method_2_short", | ||
"namespace lib_4 my_namespace", | ||
"side-effects lib_5", | ||
{ | ||
syntax: 'default', | ||
moduleName: 'angular', | ||
name: 'angular', | ||
syntax: "default", | ||
moduleName: "angular", | ||
name: "angular", | ||
}, | ||
@@ -181,8 +181,8 @@ ], | ||
```js | ||
import $ from 'jquery'; | ||
import lib_2_default from 'lib_2'; | ||
import { lib2_method_1, lib2_method_2 as lib_2_method_2_short } from 'lib_3'; | ||
import * as my_namespace from 'lib_4'; | ||
import 'lib_5'; | ||
import angular from 'angular'; | ||
import $ from "jquery"; | ||
import lib_2_default from "lib_2"; | ||
import { lib2_method_1, lib2_method_2 as lib_2_method_2_short } from "lib_3"; | ||
import * as my_namespace from "lib_4"; | ||
import "lib_5"; | ||
import angular from "angular"; | ||
``` | ||
@@ -219,8 +219,8 @@ | ||
{ | ||
test: require.resolve('example.js'), | ||
loader: 'imports-loader', | ||
test: require.resolve("example.js"), | ||
loader: "imports-loader", | ||
options: { | ||
syntax: 'default', | ||
type: 'commonjs', | ||
imports: 'Foo', | ||
syntax: "default", | ||
type: "commonjs", | ||
imports: "Foo", | ||
}, | ||
@@ -236,3 +236,3 @@ }, | ||
```js | ||
var Foo = require('Foo'); | ||
var Foo = require("Foo"); | ||
@@ -253,7 +253,7 @@ // ... | ||
{ | ||
test: require.resolve('example.js'), | ||
loader: 'imports-loader', | ||
test: require.resolve("example.js"), | ||
loader: "imports-loader", | ||
options: { | ||
type: 'module', | ||
imports: 'Foo', | ||
type: "module", | ||
imports: "Foo", | ||
}, | ||
@@ -269,3 +269,3 @@ }, | ||
```js | ||
import Foo from 'Foo'; | ||
import Foo from "Foo"; | ||
@@ -338,6 +338,6 @@ // ... | ||
{ | ||
test: require.resolve('./path/to/example.js'), | ||
loader: 'imports-loader', | ||
test: require.resolve("./path/to/example.js"), | ||
loader: "imports-loader", | ||
options: { | ||
imports: 'default lib myName', | ||
imports: "default lib myName", | ||
}, | ||
@@ -353,3 +353,3 @@ }, | ||
```js | ||
import myName from 'lib'; | ||
import myName from "lib"; | ||
@@ -370,7 +370,7 @@ // ... | ||
{ | ||
test: require.resolve('./path/to/example.js'), | ||
loader: 'imports-loader', | ||
test: require.resolve("./path/to/example.js"), | ||
loader: "imports-loader", | ||
options: { | ||
type: 'commonjs', | ||
imports: 'single lib myName', | ||
type: "commonjs", | ||
imports: "single lib myName", | ||
}, | ||
@@ -386,3 +386,3 @@ }, | ||
```js | ||
var myName = require('lib'); | ||
var myName = require("lib"); | ||
@@ -420,12 +420,12 @@ // ... | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: { | ||
syntax: 'named', | ||
moduleName: 'lib_2', | ||
name: 'lib2_method_2', | ||
alias: 'lib_2_method_2_alias', | ||
syntax: "named", | ||
moduleName: "lib_2", | ||
name: "lib2_method_2", | ||
alias: "lib_2_method_2_alias", | ||
}, | ||
@@ -444,3 +444,3 @@ }, | ||
```js | ||
import { lib2_method_2 as lib_2_method_2_alias } from 'lib_2'; | ||
import { lib2_method_2 as lib_2_method_2_alias } from "lib_2"; | ||
@@ -466,21 +466,21 @@ // ... | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: [ | ||
{ | ||
moduleName: 'angular', | ||
moduleName: "angular", | ||
}, | ||
{ | ||
syntax: 'default', | ||
moduleName: 'jquery', | ||
name: '$', | ||
syntax: "default", | ||
moduleName: "jquery", | ||
name: "$", | ||
}, | ||
'default lib_2 lib_2_default', | ||
'named lib_2 lib2_method_1', | ||
'named lib_2 lib2_method_2 lib_2_method_2_alias', | ||
'namespace lib_3 lib_3_all', | ||
'side-effects lib_4', | ||
"default lib_2 lib_2_default", | ||
"named lib_2 lib2_method_1", | ||
"named lib_2 lib2_method_2 lib_2_method_2_alias", | ||
"namespace lib_3 lib_3_all", | ||
"side-effects lib_4", | ||
], | ||
@@ -499,8 +499,8 @@ }, | ||
```js | ||
import angular from 'angular'; | ||
import $ from 'jquery'; | ||
import lib_2_default from 'lib_2'; | ||
import { lib2_method_1, lib2_method_2 as lib_2_method_2_alias } from 'lib_2'; | ||
import * as lib_3_all from 'lib_3'; | ||
import 'lib_4'; | ||
import angular from "angular"; | ||
import $ from "jquery"; | ||
import lib_2_default from "lib_2"; | ||
import { lib2_method_1, lib2_method_2 as lib_2_method_2_alias } from "lib_2"; | ||
import * as lib_3_all from "lib_3"; | ||
import "lib_4"; | ||
@@ -530,10 +530,10 @@ // ... | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: { | ||
moduleName: 'jquery', | ||
name: '$', | ||
moduleName: "jquery", | ||
name: "$", | ||
}, | ||
@@ -553,3 +553,3 @@ wrapper: true, | ||
```js | ||
import $ from 'jquery'; | ||
import $ from "jquery"; | ||
@@ -572,12 +572,12 @@ (function () { | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: { | ||
moduleName: 'jquery', | ||
name: '$', | ||
moduleName: "jquery", | ||
name: "$", | ||
}, | ||
wrapper: 'window', | ||
wrapper: "window", | ||
}, | ||
@@ -595,3 +595,3 @@ }, | ||
```js | ||
import $ from 'jquery'; | ||
import $ from "jquery"; | ||
@@ -614,14 +614,14 @@ (function () { | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: { | ||
moduleName: 'jquery', | ||
name: '$', | ||
moduleName: "jquery", | ||
name: "$", | ||
}, | ||
wrapper: { | ||
thisArg: 'window', | ||
args: ['myVariable', 'myOtherVariable'], | ||
thisArg: "window", | ||
args: ["myVariable", "myOtherVariable"], | ||
}, | ||
@@ -640,3 +640,3 @@ }, | ||
```js | ||
import $ from 'jquery'; | ||
import $ from "jquery"; | ||
@@ -659,16 +659,16 @@ (function (myVariable, myOtherVariable) { | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: { | ||
moduleName: 'jquery', | ||
name: '$', | ||
moduleName: "jquery", | ||
name: "$", | ||
}, | ||
wrapper: { | ||
thisArg: 'window', | ||
thisArg: "window", | ||
args: { | ||
myVariable: 'var1', | ||
myOtherVariable: 'var2', | ||
myVariable: "var1", | ||
myOtherVariable: "var2", | ||
}, | ||
@@ -688,3 +688,3 @@ }, | ||
```js | ||
import $ from 'jquery'; | ||
import $ from "jquery"; | ||
@@ -716,12 +716,12 @@ (function (var1, var2) { | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: { | ||
moduleName: 'jquery', | ||
name: '$', | ||
moduleName: "jquery", | ||
name: "$", | ||
}, | ||
additionalCode: 'var myVariable = false;', | ||
additionalCode: "var myVariable = false;", | ||
}, | ||
@@ -739,3 +739,3 @@ }, | ||
```js | ||
import $ from 'jquery'; | ||
import $ from "jquery"; | ||
@@ -758,13 +758,13 @@ var myVariable = false; | ||
{ | ||
test: require.resolve('example.js'), | ||
test: require.resolve("example.js"), | ||
use: [ | ||
{ | ||
loader: 'imports-loader', | ||
loader: "imports-loader", | ||
options: { | ||
imports: { | ||
moduleName: 'jquery', | ||
name: '$', | ||
moduleName: "jquery", | ||
name: "$", | ||
}, | ||
additionalCode: | ||
'var define = false; /* Disable AMD for misbehaving libraries */', | ||
"var define = false; /* Disable AMD for misbehaving libraries */", | ||
}, | ||
@@ -782,3 +782,3 @@ }, | ||
```js | ||
import $ from 'jquery'; | ||
import $ from "jquery"; | ||
@@ -785,0 +785,0 @@ var define = false; /* Disable AMD for misbehaving libraries */ |
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
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
3
22
462
35399
7
- Removedloader-utils@^2.0.0
- Removedbig.js@5.2.2(transitive)
- Removedemojis-list@3.0.0(transitive)
- Removedjson5@2.2.3(transitive)
- Removedloader-utils@2.0.4(transitive)