weboptimizer 2.0.1085 → 2.0.1089
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +1 -1
- package/configurator.js +21 -28
- package/ejsLoader.d.ts +7 -4
- package/ejsLoader.js +11 -8
- package/helper.d.ts +56 -20
- package/helper.js +77 -48
- package/index.js +25 -25
- package/package.json +33 -21
- package/tsconfig.json +1 -1
- package/type.d.ts +29 -16
- package/type.js +1 -1
- package/webpackConfigurator.js +85 -86
package/browser.js
CHANGED
|
@@ -24,7 +24,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
|
25
25
|
value: true
|
|
26
26
|
});
|
|
27
|
-
exports["default"] = exports.
|
|
27
|
+
exports.getInitializedBrowser = exports["default"] = exports.browser = void 0;
|
|
28
28
|
|
|
29
29
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
30
30
|
|
package/configurator.js
CHANGED
|
@@ -24,15 +24,15 @@ var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
|
25
25
|
value: true
|
|
26
26
|
});
|
|
27
|
-
exports["default"] =
|
|
27
|
+
exports.resolvedConfiguration = exports["default"] = void 0;
|
|
28
28
|
|
|
29
29
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
30
30
|
|
|
31
31
|
var _clientnode = _interopRequireWildcard(require("clientnode"));
|
|
32
32
|
|
|
33
|
-
var _fs =
|
|
33
|
+
var _fs = _interopRequireWildcard(require("fs"));
|
|
34
34
|
|
|
35
|
-
var _path =
|
|
35
|
+
var _path = _interopRequireWildcard(require("path"));
|
|
36
36
|
|
|
37
37
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
38
38
|
|
|
@@ -61,11 +61,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
61
61
|
_package.configuration["default"].path.context = __dirname;
|
|
62
62
|
|
|
63
63
|
while (true) {
|
|
64
|
-
_package.configuration["default"].path.context = _path
|
|
65
|
-
if (_path
|
|
64
|
+
_package.configuration["default"].path.context = (0, _path.resolve)(_package.configuration["default"].path.context, '../../');
|
|
65
|
+
if ((0, _path.basename)((0, _path.dirname)(_package.configuration["default"].path.context)) !== 'node_modules') break;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
if (_path
|
|
68
|
+
if ((0, _path.basename)((0, _path.dirname)(process.cwd())) === 'node_modules' || (0, _path.basename)((0, _path.dirname)(process.cwd())) === '.staging' && (0, _path.basename)((0, _path.dirname)((0, _path.dirname)(process.cwd()))) === 'node_modules') {
|
|
69
69
|
/*
|
|
70
70
|
NOTE: If we are dealing was a dependency project use current directory
|
|
71
71
|
as context.
|
|
@@ -79,7 +79,7 @@ if (_path["default"].basename(_path["default"].dirname(process.cwd())) === 'node
|
|
|
79
79
|
is a better assumption than two folders up the hierarchy.
|
|
80
80
|
*/
|
|
81
81
|
try {
|
|
82
|
-
if (_fs
|
|
82
|
+
if ((0, _fs.lstatSync)((0, _path.join)(process.cwd(), 'node_modules')).isSymbolicLink()) _package.configuration["default"].path.context = process.cwd();
|
|
83
83
|
} catch (error) {// continue regardless of error
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ var specificConfiguration = {};
|
|
|
87
87
|
|
|
88
88
|
try {
|
|
89
89
|
/* eslint-disable no-eval */
|
|
90
|
-
specificConfiguration = eval('require')(_path
|
|
90
|
+
specificConfiguration = eval('require')((0, _path.join)(_package.configuration["default"].path.context, 'package'));
|
|
91
91
|
/* eslint-enable no-eval */
|
|
92
92
|
} catch (error) {
|
|
93
93
|
_package.configuration["default"].path.context = process.cwd();
|
|
@@ -122,7 +122,7 @@ var count = 0;
|
|
|
122
122
|
var filePath = null;
|
|
123
123
|
|
|
124
124
|
while (true) {
|
|
125
|
-
var newFilePath = configuration.path.context
|
|
125
|
+
var newFilePath = "".concat(configuration.path.context, ".dynamicConfiguration-").concat(count, ".json");
|
|
126
126
|
if (!_clientnode["default"].isFileSync(newFilePath)) break;
|
|
127
127
|
filePath = newFilePath;
|
|
128
128
|
count += 1;
|
|
@@ -133,11 +133,10 @@ var runtimeInformation = {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
if (filePath) {
|
|
136
|
-
runtimeInformation = JSON.parse(_fs
|
|
136
|
+
runtimeInformation = JSON.parse((0, _fs.readFileSync)(filePath, {
|
|
137
137
|
encoding: configuration.encoding
|
|
138
138
|
}));
|
|
139
|
-
|
|
140
|
-
_fs["default"].unlink(filePath, function (error) {
|
|
139
|
+
(0, _fs.unlink)(filePath, function (error) {
|
|
141
140
|
if (error) throw error;
|
|
142
141
|
});
|
|
143
142
|
} // // region task specific configuration
|
|
@@ -219,18 +218,18 @@ if (result !== null && (0, _typeof2["default"])(result) === 'object') {
|
|
|
219
218
|
configuration = _clientnode["default"].removeKeyPrefixes(configuration); // endregion
|
|
220
219
|
// / region build absolute paths
|
|
221
220
|
|
|
222
|
-
configuration.path.base = _path
|
|
221
|
+
configuration.path.base = (0, _path.resolve)(configuration.path.context, configuration.path.base);
|
|
223
222
|
|
|
224
223
|
for (var key in configuration.path) {
|
|
225
|
-
if (Object.prototype.hasOwnProperty.call(configuration.path, key) &&
|
|
226
|
-
if (key
|
|
224
|
+
if (Object.prototype.hasOwnProperty.call(configuration.path, key) && !['base', 'configuration'].includes(key)) if (typeof configuration.path[key] === 'string') configuration.path[key] = (0, _path.resolve)(configuration.path.base, configuration.path[key]) + '/';else if (_clientnode["default"].isPlainObject(configuration.path[key])) {
|
|
225
|
+
if (Object.prototype.hasOwnProperty.call(configuration.path[key], 'base')) configuration.path[key].base = (0, _path.resolve)(configuration.path.base, configuration.path[key].base);
|
|
227
226
|
|
|
228
227
|
for (var subKey in configuration.path[key]) {
|
|
229
|
-
if (Object.prototype.hasOwnProperty.call(configuration.path[key], subKey) && !['base', 'public'].includes(subKey) && typeof configuration.path[key][subKey] === 'string') configuration.path[key][subKey] = _path
|
|
230
|
-
configuration.path[key][subKey].base = _path
|
|
228
|
+
if (Object.prototype.hasOwnProperty.call(configuration.path[key], subKey) && !['base', 'public'].includes(subKey) && typeof configuration.path[key][subKey] === 'string') configuration.path[key][subKey] = (0, _path.resolve)(configuration.path[key].base, configuration.path[key][subKey]) + '/';else if (subKey !== 'options' && _clientnode["default"].isPlainObject(configuration.path[key][subKey])) {
|
|
229
|
+
configuration.path[key][subKey].base = (0, _path.resolve)(configuration.path[key].base, configuration.path[key][subKey].base);
|
|
231
230
|
|
|
232
231
|
for (var subSubKey in configuration.path[key][subKey]) {
|
|
233
|
-
if (Object.prototype.hasOwnProperty.call(configuration.path[key][subKey], subSubKey) && subSubKey !== 'base' && typeof configuration.path[key][subKey][subSubKey] === 'string') configuration.path[key][subKey][subSubKey] = _path
|
|
232
|
+
if (Object.prototype.hasOwnProperty.call(configuration.path[key][subKey], subSubKey) && subSubKey !== 'base' && typeof configuration.path[key][subKey][subSubKey] === 'string') configuration.path[key][subKey][subSubKey] = (0, _path.resolve)(configuration.path[key][subKey].base, configuration.path[key][subKey][subSubKey]) + '/';
|
|
234
233
|
}
|
|
235
234
|
}
|
|
236
235
|
}
|
|
@@ -278,7 +277,7 @@ resolvedConfiguration.module.locations = _helper["default"].determineModuleLocat
|
|
|
278
277
|
file: resolvedConfiguration.extensions.file.internal
|
|
279
278
|
}, resolvedConfiguration.path.context, resolvedConfiguration.path.source.asset.base);
|
|
280
279
|
resolvedConfiguration.injection = _helper["default"].resolveAutoInjection(resolvedConfiguration.injection, _helper["default"].resolveBuildConfigurationFilePaths(resolvedConfiguration.buildContext.types, resolvedConfiguration.path.source.asset.base, _helper["default"].normalizePaths(resolvedConfiguration.path.ignore.concat(resolvedConfiguration.module.directoryNames, resolvedConfiguration.loader.directoryNames).map(function (filePath) {
|
|
281
|
-
return _path
|
|
280
|
+
return (0, _path.resolve)(resolvedConfiguration.path.context, filePath);
|
|
282
281
|
}).filter(function (filePath) {
|
|
283
282
|
return !resolvedConfiguration.path.context.startsWith(filePath);
|
|
284
283
|
})), resolvedConfiguration["package"].main.fileNames), resolvedConfiguration.module.aliases, resolvedConfiguration.module.replacements.normal, resolvedConfiguration.extensions, resolvedConfiguration.path.context, resolvedConfiguration.path.source.asset.base, resolvedConfiguration.path.ignore);
|
|
@@ -286,7 +285,7 @@ var givenInjection = resolvedConfiguration.injection.entry;
|
|
|
286
285
|
resolvedConfiguration.injection.entry = {
|
|
287
286
|
given: givenInjection,
|
|
288
287
|
normalized: _helper["default"].resolveModulesInFolders(_helper["default"].normalizeGivenInjection(givenInjection), resolvedConfiguration.module.aliases, resolvedConfiguration.module.replacements.normal, resolvedConfiguration.path.context, resolvedConfiguration.path.source.asset.base, resolvedConfiguration.path.ignore.concat(resolvedConfiguration.module.directoryNames, resolvedConfiguration.loader.directoryNames).map(function (filePath) {
|
|
289
|
-
return _path
|
|
288
|
+
return (0, _path.resolve)(resolvedConfiguration.path.context, filePath);
|
|
290
289
|
}).filter(function (filePath) {
|
|
291
290
|
return !resolvedConfiguration.path.context.startsWith(filePath);
|
|
292
291
|
}))
|
|
@@ -369,10 +368,7 @@ try {
|
|
|
369
368
|
|
|
370
369
|
if (htmlConfiguration.template.filePath !== resolvedConfiguration.files.defaultHTML.template.filePath && htmlConfiguration.template.options) {
|
|
371
370
|
var requestString = new String(htmlConfiguration.template.request + _clientnode["default"].convertCircularObjectToJSON(htmlConfiguration.template.options));
|
|
372
|
-
/* eslint-disable
|
|
373
|
-
@typescript-eslint/unbound-method,
|
|
374
|
-
@typescript-eslint/ban-ts-ignore
|
|
375
|
-
*/
|
|
371
|
+
/* eslint-disable @typescript-eslint/unbound-method */
|
|
376
372
|
// @ts-ignore: Monkeypatching is not allowed by typescript.
|
|
377
373
|
|
|
378
374
|
requestString.replace = function (value) {
|
|
@@ -380,10 +376,7 @@ try {
|
|
|
380
376
|
return value;
|
|
381
377
|
};
|
|
382
378
|
}(htmlConfiguration.template.filePath);
|
|
383
|
-
/* eslint-enable
|
|
384
|
-
@typescript-eslint/unbound-method,
|
|
385
|
-
@typescript-eslint/ban-ts-ignore
|
|
386
|
-
*/
|
|
379
|
+
/* eslint-enable @typescript-eslint/unbound-method */
|
|
387
380
|
|
|
388
381
|
|
|
389
382
|
htmlConfiguration.template.request = requestString;
|
package/ejsLoader.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Encoding, Mapping } from 'clientnode/type';
|
|
2
|
-
import { Options, TemplateFunction } from 'ejs';
|
|
2
|
+
import { Options, TemplateFunction as EJSTemplateFunction } from 'ejs';
|
|
3
|
+
import { LoaderContext } from 'webpack';
|
|
3
4
|
import { Extensions, Replacements } from './type';
|
|
5
|
+
export declare type PreCompiledTemplateFunction = ((..._parameters: Array<unknown>) => string);
|
|
6
|
+
export declare type TemplateFunction = EJSTemplateFunction | PreCompiledTemplateFunction;
|
|
4
7
|
export declare type CompilerOptions = Options & {
|
|
5
8
|
encoding: Encoding;
|
|
6
9
|
isString?: boolean;
|
|
7
10
|
};
|
|
8
|
-
export declare type CompileFunction = (
|
|
11
|
+
export declare type CompileFunction = (_template: string, _options?: Partial<CompilerOptions>, _compileSteps?: number) => TemplateFunction;
|
|
9
12
|
export declare type LoaderConfiguration = Mapping<unknown> & {
|
|
10
13
|
compiler: Partial<CompilerOptions>;
|
|
11
14
|
compileSteps: number;
|
|
@@ -14,6 +17,7 @@ export declare type LoaderConfiguration = Mapping<unknown> & {
|
|
|
14
17
|
javaScript: Mapping<unknown>;
|
|
15
18
|
};
|
|
16
19
|
context: string;
|
|
20
|
+
debug: boolean;
|
|
17
21
|
extensions: Extensions;
|
|
18
22
|
locals?: Mapping<unknown>;
|
|
19
23
|
module: {
|
|
@@ -23,10 +27,9 @@ export declare type LoaderConfiguration = Mapping<unknown> & {
|
|
|
23
27
|
};
|
|
24
28
|
/**
|
|
25
29
|
* Main transformation function.
|
|
26
|
-
*
|
|
27
30
|
* @param this - Loader context.
|
|
28
31
|
* @param source - Input string to transform.
|
|
29
32
|
*
|
|
30
33
|
* @returns Transformed string.
|
|
31
34
|
*/
|
|
32
|
-
export default function (this:
|
|
35
|
+
export default function (this: LoaderContext<LoaderConfiguration>, source: string): string;
|
package/ejsLoader.js
CHANGED
|
@@ -38,13 +38,13 @@ var _clientnode = _interopRequireDefault(require("clientnode"));
|
|
|
38
38
|
|
|
39
39
|
var _ejs = _interopRequireDefault(require("ejs"));
|
|
40
40
|
|
|
41
|
-
var _fs =
|
|
41
|
+
var _fs = require("fs");
|
|
42
42
|
|
|
43
43
|
var _htmlMinifier = require("html-minifier");
|
|
44
44
|
|
|
45
45
|
var _loaderUtils = require("loader-utils");
|
|
46
46
|
|
|
47
|
-
var _path =
|
|
47
|
+
var _path = require("path");
|
|
48
48
|
|
|
49
49
|
var _configurator = _interopRequireDefault(require("./configurator"));
|
|
50
50
|
|
|
@@ -58,7 +58,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Main transformation function.
|
|
61
|
-
*
|
|
62
61
|
* @param this - Loader context.
|
|
63
62
|
* @param source - Input string to transform.
|
|
64
63
|
*
|
|
@@ -75,6 +74,7 @@ function _default(source) {
|
|
|
75
74
|
javaScript: {}
|
|
76
75
|
},
|
|
77
76
|
context: './',
|
|
77
|
+
debug: false,
|
|
78
78
|
extensions: {
|
|
79
79
|
file: {
|
|
80
80
|
external: [],
|
|
@@ -135,7 +135,7 @@ function _default(source) {
|
|
|
135
135
|
*/
|
|
136
136
|
|
|
137
137
|
if (queryMatch || templateFilePath.endsWith('.ejs')) return compile(templateFilePath, nestedOptions)(nestedLocals);
|
|
138
|
-
return _fs
|
|
138
|
+
return (0, _fs.readFileSync)(templateFilePath, {
|
|
139
139
|
encoding: nestedOptions.encoding
|
|
140
140
|
});
|
|
141
141
|
}
|
|
@@ -199,11 +199,11 @@ function _default(source) {
|
|
|
199
199
|
|
|
200
200
|
if (typeof result === 'string') {
|
|
201
201
|
var filePath = isString ? options.filename : result;
|
|
202
|
-
if (filePath && _path
|
|
202
|
+
if (filePath && (0, _path.extname)(filePath) === '.js') result = eval('require')(filePath);else {
|
|
203
203
|
if (!isString) {
|
|
204
204
|
var encoding = _configurator["default"].encoding;
|
|
205
205
|
if (typeof options.encoding === 'string') encoding = options.encoding;
|
|
206
|
-
result = _fs
|
|
206
|
+
result = (0, _fs.readFileSync)(result, {
|
|
207
207
|
encoding: encoding
|
|
208
208
|
});
|
|
209
209
|
}
|
|
@@ -223,8 +223,11 @@ function _default(source) {
|
|
|
223
223
|
while (scopeNames.includes(localsName)) {
|
|
224
224
|
localsName = "_".concat(localsName);
|
|
225
225
|
}
|
|
226
|
+
/* eslint-disable @typescript-eslint/no-implied-eval */
|
|
227
|
+
|
|
226
228
|
|
|
227
229
|
result = (0, _construct2["default"])(Function, (0, _toConsumableArray2["default"])(scopeNames).concat([localsName, "return ".concat(result.toString(), "(") + "".concat(localsName, ",").concat(localsName, ".escapeFn,include,") + "".concat(localsName, ".rethrow)")]));
|
|
230
|
+
/* eslint-enable @typescript-eslint/no-implied-eval */
|
|
228
231
|
}
|
|
229
232
|
}
|
|
230
233
|
} else result = compressHTML(!options.strict && options._with ? result(scope, scope.escapeFn, scope.include) : result.apply(void 0, (0, _toConsumableArray2["default"])(originalScopeNames.map(function (name) {
|
|
@@ -260,8 +263,8 @@ function _default(source) {
|
|
|
260
263
|
|
|
261
264
|
return compile(source, _objectSpread(_objectSpread({}, givenOptions.compiler), {}, {
|
|
262
265
|
client: Boolean(givenOptions.compileSteps % 2),
|
|
263
|
-
compileDebug:
|
|
264
|
-
debug:
|
|
266
|
+
compileDebug: givenOptions.debug,
|
|
267
|
+
debug: givenOptions.debug,
|
|
265
268
|
filename: 'remainingRequest' in this ? (0, _loaderUtils.getRemainingRequest)(this).replace(/^!/, '') : this.resourcePath || 'unknown',
|
|
266
269
|
isString: true,
|
|
267
270
|
localsName: 'scope'
|
package/helper.d.ts
CHANGED
|
@@ -8,36 +8,45 @@ export declare class Helper {
|
|
|
8
8
|
/**
|
|
9
9
|
* Determines whether given file path is within given list of file
|
|
10
10
|
* locations.
|
|
11
|
+
* @param this - Indicates an unbound method.
|
|
11
12
|
* @param filePath - Path to file to check.
|
|
12
13
|
* @param locationsToCheck - Locations to take into account.
|
|
14
|
+
*
|
|
13
15
|
* @returns Value "true" if given file path is within one of given
|
|
14
16
|
* locations or "false" otherwise.
|
|
15
17
|
*/
|
|
16
|
-
static isFilePathInLocation(filePath: string, locationsToCheck: Array<string>): boolean;
|
|
18
|
+
static isFilePathInLocation(this: void, filePath: string, locationsToCheck: Array<string>): boolean;
|
|
17
19
|
/**
|
|
18
20
|
* Strips loader informations form given module request including loader
|
|
19
21
|
* prefix and query parameter.
|
|
22
|
+
* @param this - Indicates an unbound method.
|
|
20
23
|
* @param moduleID - Module request to strip.
|
|
24
|
+
*
|
|
21
25
|
* @returns Given module id stripped.
|
|
22
26
|
*/
|
|
23
|
-
static stripLoader(moduleID: string): string;
|
|
27
|
+
static stripLoader(this: void, moduleID: string): string;
|
|
24
28
|
/**
|
|
25
29
|
* Converts given list of path to a normalized list with unique values.
|
|
30
|
+
* @param this - Indicates an unbound method.
|
|
26
31
|
* @param paths - File paths.
|
|
32
|
+
*
|
|
27
33
|
* @returns The given file path list with normalized unique values.
|
|
28
34
|
*/
|
|
29
|
-
static normalizePaths(paths: Array<string>): Array<string>;
|
|
35
|
+
static normalizePaths(this: void, paths: Array<string>): Array<string>;
|
|
30
36
|
/**
|
|
31
37
|
* Applies file path/name placeholder replacements with given bundle
|
|
32
38
|
* associated informations.
|
|
39
|
+
* @param this - Indicates an unbound method.
|
|
33
40
|
* @param template - File path to process placeholder in.
|
|
34
41
|
* @param scope - Scope to use for processing.
|
|
42
|
+
*
|
|
35
43
|
* @returns Processed file path.
|
|
36
44
|
*/
|
|
37
|
-
static renderFilePathTemplate(template: string, scope?: Mapping<number | string>): string;
|
|
45
|
+
static renderFilePathTemplate(this: void, template: string, scope?: Mapping<number | string>): string;
|
|
38
46
|
/**
|
|
39
47
|
* Converts given request to a resolved request with given context
|
|
40
48
|
* embedded.
|
|
49
|
+
* @param this - Indicates an unbound method.
|
|
41
50
|
* @param request - Request to determine.
|
|
42
51
|
* @param context - Context of given request to resolve relative to.
|
|
43
52
|
* @param referencePath - Path to resolve local modules relative to.
|
|
@@ -46,13 +55,14 @@ export declare class Helper {
|
|
|
46
55
|
* account.
|
|
47
56
|
* @param relativeModuleLocations - List of relative directory paths to
|
|
48
57
|
* search for modules in.
|
|
58
|
+
*
|
|
49
59
|
* @returns A new resolved request.
|
|
50
60
|
*/
|
|
51
|
-
static applyContext(request: string, context?: string, referencePath?: string, aliases?: Mapping, moduleReplacements?: Replacements, relativeModuleLocations?: Array<string>): false | string;
|
|
61
|
+
static applyContext(this: void, request: string, context?: string, referencePath?: string, aliases?: Mapping, moduleReplacements?: Replacements, relativeModuleLocations?: Array<string>): false | string;
|
|
52
62
|
/**
|
|
53
63
|
* Check if given request points to an external dependency not maintained
|
|
54
64
|
* by current package context.
|
|
55
|
-
*
|
|
65
|
+
* @param this - Indicates an unbound method.
|
|
56
66
|
* @param request - Request to determine.
|
|
57
67
|
* @param context - Context of current project.
|
|
58
68
|
* @param requestContext - Context of given request to resolve relative to.
|
|
@@ -89,33 +99,38 @@ export declare class Helper {
|
|
|
89
99
|
* @returns A new resolved request indicating whether given request is an
|
|
90
100
|
* external one.
|
|
91
101
|
*/
|
|
92
|
-
static determineExternalRequest(request: string, context?: string, requestContext?: string, normalizedGivenInjection?: NormalizedGivenInjection, relativeExternalModuleLocations?: Array<string>, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: Extensions, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, includePattern?: Array<string | RegExp>, excludePattern?: Array<string | RegExp>, inPlaceNormalLibrary?: boolean, inPlaceDynamicLibrary?: boolean, encoding?: Encoding): null | string;
|
|
102
|
+
static determineExternalRequest(this: void, request: string, context?: string, requestContext?: string, normalizedGivenInjection?: NormalizedGivenInjection, relativeExternalModuleLocations?: Array<string>, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: Extensions, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, includePattern?: Array<string | RegExp>, excludePattern?: Array<string | RegExp>, inPlaceNormalLibrary?: boolean, inPlaceDynamicLibrary?: boolean, encoding?: Encoding): null | string;
|
|
93
103
|
/**
|
|
94
104
|
* Determines asset type of given file.
|
|
105
|
+
* @param this - Indicates an unbound method.
|
|
95
106
|
* @param filePath - Path to file to analyse.
|
|
96
107
|
* @param buildConfiguration - Meta informations for available asset
|
|
97
108
|
* types.
|
|
98
109
|
* @param paths - List of paths to search if given path doesn't reference
|
|
99
110
|
* a file directly.
|
|
111
|
+
*
|
|
100
112
|
* @returns Determined file type or "null" of given file couldn't be
|
|
101
113
|
* determined.
|
|
102
114
|
*/
|
|
103
|
-
static determineAssetType(filePath: string, buildConfiguration: BuildConfiguration, paths: PathConfiguration): null | string;
|
|
115
|
+
static determineAssetType(this: void, filePath: string, buildConfiguration: BuildConfiguration, paths: PathConfiguration): null | string;
|
|
104
116
|
/**
|
|
105
117
|
* Adds a property with a stored array of all matching file paths, which
|
|
106
118
|
* matches each build configuration in given entry path and converts given
|
|
107
119
|
* build configuration into a sorted array were javaScript files takes
|
|
108
120
|
* precedence.
|
|
121
|
+
* @param this - Indicates an unbound method.
|
|
109
122
|
* @param configuration - Given build configurations.
|
|
110
123
|
* @param entryPath - Path to analyse nested structure.
|
|
111
124
|
* @param pathsToIgnore - Paths which marks location to ignore.
|
|
112
125
|
* @param mainFileBasenames - File basenames to sort into the front.
|
|
126
|
+
*
|
|
113
127
|
* @returns Converted build configuration.
|
|
114
128
|
*/
|
|
115
|
-
static resolveBuildConfigurationFilePaths(configuration: BuildConfiguration, entryPath?: string, pathsToIgnore?: Array<string>, mainFileBasenames?: Array<string>): ResolvedBuildConfiguration;
|
|
129
|
+
static resolveBuildConfigurationFilePaths(this: void, configuration: BuildConfiguration, entryPath?: string, pathsToIgnore?: Array<string>, mainFileBasenames?: Array<string>): ResolvedBuildConfiguration;
|
|
116
130
|
/**
|
|
117
131
|
* Determines all file and directory paths related to given internal
|
|
118
132
|
* modules as array.
|
|
133
|
+
* @param this - Indicates an unbound method.
|
|
119
134
|
* @param givenInjection - List of module ids or module file paths.
|
|
120
135
|
* @param aliases - Mapping of aliases to take into account.
|
|
121
136
|
* @param moduleReplacements - Mapping of module replacements to take into
|
|
@@ -135,16 +150,18 @@ export declare class Helper {
|
|
|
135
150
|
* @param packageAliasPropertyNames - List of package file alias property
|
|
136
151
|
* names to search for package specific module aliases.
|
|
137
152
|
* @param encoding - File name encoding to use during file traversing.
|
|
153
|
+
*
|
|
138
154
|
* @returns Object with a file path and directory path key mapping to
|
|
139
155
|
* corresponding list of paths.
|
|
140
156
|
*/
|
|
141
|
-
static determineModuleLocations(givenInjection: GivenInjection, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: SpecificExtensions, context?: string, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, encoding?: Encoding): {
|
|
157
|
+
static determineModuleLocations(this: void, givenInjection: GivenInjection, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: SpecificExtensions, context?: string, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, encoding?: Encoding): {
|
|
142
158
|
directoryPaths: Array<string>;
|
|
143
159
|
filePaths: Array<string>;
|
|
144
160
|
};
|
|
145
161
|
/**
|
|
146
162
|
* Determines a list of concrete file paths for given module id pointing to
|
|
147
163
|
* a folder which isn't a package.
|
|
164
|
+
* @param this - Indicates an unbound method.
|
|
148
165
|
* @param normalizedGivenInjection - Injection data structure of modules
|
|
149
166
|
* with folder references to resolve.
|
|
150
167
|
* @param aliases - Mapping of aliases to take into account.
|
|
@@ -153,20 +170,24 @@ export declare class Helper {
|
|
|
153
170
|
* @param context - File path to determine relative to.
|
|
154
171
|
* @param referencePath - Path to resolve local modules relative to.
|
|
155
172
|
* @param pathsToIgnore - Paths which marks location to ignore.
|
|
173
|
+
*
|
|
156
174
|
* @returns Given injections with resolved folder pointing modules.
|
|
157
175
|
*/
|
|
158
|
-
static resolveModulesInFolders(normalizedGivenInjection: NormalizedGivenInjection, aliases?: Mapping, moduleReplacements?: Replacements, context?: string, referencePath?: string, pathsToIgnore?: Array<string>): NormalizedGivenInjection;
|
|
176
|
+
static resolveModulesInFolders(this: void, normalizedGivenInjection: NormalizedGivenInjection, aliases?: Mapping, moduleReplacements?: Replacements, context?: string, referencePath?: string, pathsToIgnore?: Array<string>): NormalizedGivenInjection;
|
|
159
177
|
/**
|
|
160
178
|
* Every injection definition type can be represented as plain object
|
|
161
179
|
* (mapping from chunk name to array of module ids). This method converts
|
|
162
180
|
* each representation into the normalized plain object notation.
|
|
181
|
+
* @param this - Indicates an unbound method.
|
|
163
182
|
* @param givenInjection - Given entry injection to normalize.
|
|
183
|
+
*
|
|
164
184
|
* @returns Normalized representation of given entry injection.
|
|
165
185
|
*/
|
|
166
|
-
static normalizeGivenInjection(givenInjection: GivenInjection): NormalizedGivenInjection;
|
|
186
|
+
static normalizeGivenInjection(this: void, givenInjection: GivenInjection): NormalizedGivenInjection;
|
|
167
187
|
/**
|
|
168
188
|
* Determines all concrete file paths for given injection which are marked
|
|
169
189
|
* with the "__auto__" indicator.
|
|
190
|
+
* @param this - Indicates an unbound method.
|
|
170
191
|
* @param givenInjection - Given entry and external injection to take
|
|
171
192
|
* into account.
|
|
172
193
|
* @param buildConfigurations - Resolved build configuration.
|
|
@@ -179,35 +200,41 @@ export declare class Helper {
|
|
|
179
200
|
* @param referencePath - Reference path from where local files should be
|
|
180
201
|
* resolved.
|
|
181
202
|
* @param pathsToIgnore - Paths which marks location to ignore.
|
|
203
|
+
*
|
|
182
204
|
* @returns Given injection with resolved marked indicators.
|
|
183
205
|
*/
|
|
184
|
-
static resolveAutoInjection<T extends GivenInjectionConfiguration>(givenInjection: T, buildConfigurations: ResolvedBuildConfiguration, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: Extensions, context?: string, referencePath?: string, pathsToIgnore?: Array<string>): T;
|
|
206
|
+
static resolveAutoInjection<T extends GivenInjectionConfiguration>(this: void, givenInjection: T, buildConfigurations: ResolvedBuildConfiguration, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: Extensions, context?: string, referencePath?: string, pathsToIgnore?: Array<string>): T;
|
|
185
207
|
/**
|
|
186
208
|
* Determines all module file paths.
|
|
209
|
+
* @param this - Indicates an unbound method.
|
|
187
210
|
* @param buildConfigurations - Resolved build configuration.
|
|
188
211
|
* @param moduleFilePathsToExclude - A list of modules file paths to
|
|
189
212
|
* exclude (specified by path or id) or a mapping from chunk names to
|
|
190
213
|
* module ids.
|
|
191
214
|
* @param context - File path to use as starting point.
|
|
215
|
+
*
|
|
192
216
|
* @returns All determined module file paths.
|
|
193
217
|
*/
|
|
194
|
-
static getAutoInjection(buildConfigurations: ResolvedBuildConfiguration, moduleFilePathsToExclude: Array<string>, context: string): Mapping;
|
|
218
|
+
static getAutoInjection(this: void, buildConfigurations: ResolvedBuildConfiguration, moduleFilePathsToExclude: Array<string>, context: string): Mapping;
|
|
195
219
|
/**
|
|
196
220
|
* Determines a resolved module file path in given package path.
|
|
221
|
+
* @param this - Indicates an unbound method.
|
|
197
222
|
* @param packagePath - Path to package to resolve in.
|
|
198
223
|
* @param packageMainPropertyNames - List of package file main property
|
|
199
224
|
* names to search for package representing entry module definitions.
|
|
200
225
|
* @param packageAliasPropertyNames - List of package file alias property
|
|
201
226
|
* names to search for package specific module aliases.
|
|
202
227
|
* @param encoding - Encoding to use for file names during file traversing.
|
|
228
|
+
*
|
|
203
229
|
* @returns Path if found and / or additional package aliases to consider.
|
|
204
230
|
*/
|
|
205
|
-
static determineModuleFilePathInPackage(packagePath: string, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, encoding?: Encoding): {
|
|
231
|
+
static determineModuleFilePathInPackage(this: void, packagePath: string, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, encoding?: Encoding): {
|
|
206
232
|
fileName: null | string;
|
|
207
233
|
packageAliases: Mapping | null;
|
|
208
234
|
};
|
|
209
235
|
/**
|
|
210
236
|
* Determines a concrete file path for given module id.
|
|
237
|
+
* @param this - Indicates an unbound method.
|
|
211
238
|
* @param moduleID - Module id to determine.
|
|
212
239
|
* @param aliases - Mapping of aliases to take into account.
|
|
213
240
|
* @param moduleReplacements - Mapping of replacements to take into
|
|
@@ -227,41 +254,50 @@ export declare class Helper {
|
|
|
227
254
|
* @param packageAliasPropertyNames - List of package file alias property
|
|
228
255
|
* names to search for package specific module aliases.
|
|
229
256
|
* @param encoding - Encoding to use for file names during file traversing.
|
|
257
|
+
*
|
|
230
258
|
* @returns File path or given module id if determinations has failed or
|
|
231
259
|
* wasn't necessary.
|
|
232
260
|
*/
|
|
233
|
-
static determineModuleFilePath(moduleID: false | string, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: SpecificExtensions, context?: string, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, encoding?: Encoding): null | string;
|
|
261
|
+
static determineModuleFilePath(this: void, moduleID: false | string, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: SpecificExtensions, context?: string, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, encoding?: Encoding): null | string;
|
|
234
262
|
/**
|
|
235
263
|
* Determines a concrete file path for given module id.
|
|
264
|
+
* @param this - Indicates an unbound method.
|
|
236
265
|
* @param moduleID - Module id to determine.
|
|
237
266
|
* @param aliases - Mapping of aliases to take into account.
|
|
267
|
+
*
|
|
238
268
|
* @returns The alias applied given module id.
|
|
239
269
|
*/
|
|
240
|
-
static applyAliases(moduleID: string, aliases: Mapping): string;
|
|
270
|
+
static applyAliases(this: void, moduleID: string, aliases: Mapping): string;
|
|
241
271
|
/**
|
|
242
272
|
* Determines a concrete file path for given module id.
|
|
273
|
+
* @param this - Indicates an unbound method.
|
|
243
274
|
* @param moduleID - Module id to determine.
|
|
244
275
|
* @param replacements - Mapping of regular expressions to their
|
|
245
276
|
* corresponding replacements.
|
|
277
|
+
*
|
|
246
278
|
* @returns The replacement applied given module id.
|
|
247
279
|
*/
|
|
248
|
-
static applyModuleReplacements(moduleID: false | string, replacements: Replacements): false | string;
|
|
280
|
+
static applyModuleReplacements(this: void, moduleID: false | string, replacements: Replacements): false | string;
|
|
249
281
|
/**
|
|
250
282
|
* Determines the nearest package configuration file from given file path.
|
|
283
|
+
* @param this - Indicates an unbound method.
|
|
251
284
|
* @param start - Reference location to search from.
|
|
252
285
|
* @param fileName - Package configuration file name.
|
|
286
|
+
*
|
|
253
287
|
* @returns Determined file path.
|
|
254
288
|
*/
|
|
255
|
-
static findPackageDescriptorFilePath(start: Array<string> | string, fileName?: string): null | string;
|
|
289
|
+
static findPackageDescriptorFilePath(this: void, start: Array<string> | string, fileName?: string): null | string;
|
|
256
290
|
/**
|
|
257
291
|
* Determines the nearest package configuration from given module file
|
|
258
292
|
* path.
|
|
293
|
+
* @param this - Indicates an unbound method.
|
|
259
294
|
* @param modulePath - Module path to take as reference location (leaf in
|
|
260
295
|
* tree).
|
|
261
296
|
* @param fileName - Package configuration file name.
|
|
297
|
+
*
|
|
262
298
|
* @returns A object containing found parsed configuration an their
|
|
263
299
|
* corresponding file path.
|
|
264
300
|
*/
|
|
265
|
-
static getClosestPackageDescriptor(modulePath: string, fileName?: string): null | PackageDescriptor;
|
|
301
|
+
static getClosestPackageDescriptor(this: void, modulePath: string, fileName?: string): null | PackageDescriptor;
|
|
266
302
|
}
|
|
267
303
|
export default Helper;
|