@rspack/core 0.2.2 → 0.2.3
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/dist/compilation.d.ts +22 -13
- package/dist/compilation.d.ts.map +1 -1
- package/dist/compilation.js +26 -24
- package/dist/compilation.js.map +1 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +20 -6
- package/dist/compiler.js.map +1 -1
- package/dist/config/adapter.js +5 -3
- package/dist/config/adapter.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +47 -35
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/normalization.js +3 -1
- package/dist/config/normalization.js.map +1 -1
- package/dist/config/types.d.ts +9 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/zod/entry.d.ts +5 -2
- package/dist/config/zod/entry.d.ts.map +1 -1
- package/dist/config/zod/entry.js +6 -0
- package/dist/config/zod/entry.js.map +1 -1
- package/dist/config/zod/index.d.ts +39 -25
- package/dist/config/zod/index.d.ts.map +1 -1
- package/dist/config/zod/optimization/index.d.ts +7 -0
- package/dist/config/zod/optimization/index.d.ts.map +1 -1
- package/dist/config/zod/optimization/split-chunks.d.ts +8 -0
- package/dist/config/zod/optimization/split-chunks.d.ts.map +1 -1
- package/dist/config/zod/optimization/split-chunks.js +1 -0
- package/dist/config/zod/optimization/split-chunks.js.map +1 -1
- package/dist/config/zod/output.d.ts +8 -8
- package/dist/config/zod/target.d.ts +1 -1
- package/dist/config/zod/target.d.ts.map +1 -1
- package/dist/config/zod/target.js +3 -0
- package/dist/config/zod/target.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/BannerPlugin.d.ts +22 -0
- package/dist/lib/BannerPlugin.d.ts.map +1 -0
- package/dist/lib/BannerPlugin.js +102 -0
- package/dist/lib/BannerPlugin.js.map +1 -0
- package/dist/lib/ModuleFilenameHelpers.d.ts +7 -0
- package/dist/lib/ModuleFilenameHelpers.d.ts.map +1 -0
- package/dist/lib/ModuleFilenameHelpers.js +46 -0
- package/dist/lib/ModuleFilenameHelpers.js.map +1 -0
- package/dist/lib/Template.d.ts +194 -0
- package/dist/lib/Template.d.ts.map +1 -0
- package/dist/lib/Template.js +383 -0
- package/dist/lib/Template.js.map +1 -0
- package/dist/lib/util/create-schema-validation.d.ts +3 -0
- package/dist/lib/util/create-schema-validation.d.ts.map +1 -0
- package/dist/lib/util/create-schema-validation.js +20 -0
- package/dist/lib/util/create-schema-validation.js.map +1 -0
- package/dist/lib/util/memoize.d.ts +13 -0
- package/dist/lib/util/memoize.d.ts.map +1 -0
- package/dist/lib/util/memoize.js +30 -0
- package/dist/lib/util/memoize.js.map +1 -0
- package/dist/schemas/plugins/BannerPlugin.check.d.ts +11 -0
- package/dist/schemas/plugins/BannerPlugin.check.d.ts.map +1 -0
- package/dist/schemas/plugins/BannerPlugin.check.js +311 -0
- package/dist/schemas/plugins/BannerPlugin.check.js.map +1 -0
- package/dist/util/MergeCaller.d.ts +4 -4
- package/dist/util/MergeCaller.d.ts.map +1 -1
- package/dist/util/MergeCaller.js +2 -2
- package/dist/util/MergeCaller.js.map +1 -1
- package/dist/util/fake.d.ts +1 -1
- package/dist/util/fake.d.ts.map +1 -1
- package/dist/util/fake.js +10 -4
- package/dist/util/fake.js.map +1 -1
- package/dist/util/normalization.d.ts +6 -0
- package/dist/util/normalization.d.ts.map +1 -0
- package/dist/util/normalization.js +10 -0
- package/dist/util/normalization.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
const { ConcatSource } = require("webpack-sources");
|
|
7
|
+
const Compilation = require("../compilation");
|
|
8
|
+
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
|
|
9
|
+
const Template = require("./Template");
|
|
10
|
+
const createSchemaValidation = require("./util/create-schema-validation");
|
|
11
|
+
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */
|
|
12
|
+
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */
|
|
13
|
+
/** @typedef {import("./Compiler")} Compiler */
|
|
14
|
+
const validate = createSchemaValidation(require("../schemas/plugins/BannerPlugin.check.js"), () => require("../schemas/plugins/BannerPlugin.json"), {
|
|
15
|
+
name: "Banner Plugin",
|
|
16
|
+
baseDataPath: "options"
|
|
17
|
+
});
|
|
18
|
+
const wrapComment = str => {
|
|
19
|
+
if (!str.includes("\n")) {
|
|
20
|
+
return Template.toComment(str);
|
|
21
|
+
}
|
|
22
|
+
return `/*!\n * ${str
|
|
23
|
+
.replace(/\*\//g, "* /")
|
|
24
|
+
.split("\n")
|
|
25
|
+
.join("\n * ")
|
|
26
|
+
.replace(/\s+\n/g, "\n")
|
|
27
|
+
.trimEnd()}\n */`;
|
|
28
|
+
};
|
|
29
|
+
class BannerPlugin {
|
|
30
|
+
/**
|
|
31
|
+
* @param {BannerPluginArgument} options options object
|
|
32
|
+
*/
|
|
33
|
+
constructor(options) {
|
|
34
|
+
if (typeof options === "string" || typeof options === "function") {
|
|
35
|
+
options = {
|
|
36
|
+
banner: options
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
validate(options);
|
|
40
|
+
this.options = options;
|
|
41
|
+
const bannerOption = options.banner;
|
|
42
|
+
if (typeof bannerOption === "function") {
|
|
43
|
+
const getBanner = bannerOption;
|
|
44
|
+
this.banner = this.options.raw
|
|
45
|
+
? getBanner
|
|
46
|
+
: data => wrapComment(getBanner(data));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const banner = this.options.raw
|
|
50
|
+
? bannerOption
|
|
51
|
+
: wrapComment(bannerOption);
|
|
52
|
+
this.banner = () => banner;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Apply the plugin
|
|
57
|
+
* @param {Compiler} compiler the compiler instance
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
apply(compiler) {
|
|
61
|
+
const options = this.options;
|
|
62
|
+
const banner = this.banner;
|
|
63
|
+
const matchObject = ModuleFilenameHelpers.matchObject.bind(undefined, options);
|
|
64
|
+
const cache = new WeakMap();
|
|
65
|
+
compiler.hooks.compilation.tap("BannerPlugin", compilation => {
|
|
66
|
+
compilation.hooks.processAssets.tap({
|
|
67
|
+
name: "BannerPlugin",
|
|
68
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
69
|
+
}, () => {
|
|
70
|
+
for (const chunk of compilation.chunks) {
|
|
71
|
+
if (options.entryOnly && !chunk.canBeInitial()) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
for (const file of chunk.files) {
|
|
75
|
+
if (!matchObject(file)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const data = {
|
|
79
|
+
// chunk,
|
|
80
|
+
filename: file
|
|
81
|
+
};
|
|
82
|
+
let normalizedBanner = typeof banner === "function" ? banner({ chunk }) : banner;
|
|
83
|
+
const comment = compilation.getPath(normalizedBanner, data);
|
|
84
|
+
compilation.updateAsset(file, old => {
|
|
85
|
+
let cached = cache.get(old);
|
|
86
|
+
if (!cached || cached.comment !== comment) {
|
|
87
|
+
const source = options.footer
|
|
88
|
+
? new ConcatSource(old, "\n", comment)
|
|
89
|
+
: new ConcatSource(comment, "\n", old);
|
|
90
|
+
cache.set(old, { source, comment });
|
|
91
|
+
return source;
|
|
92
|
+
}
|
|
93
|
+
return cached.source;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
module.exports = BannerPlugin;
|
|
102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
2
|
+
export function matchObject(obj: any, str: any): boolean;
|
|
3
|
+
export type ChunkGraph = any;
|
|
4
|
+
export type Module = any;
|
|
5
|
+
export type RequestShortener = any;
|
|
6
|
+
export type Hash = typeof import("./util/Hash");
|
|
7
|
+
//# sourceMappingURL=ModuleFilenameHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleFilenameHelpers.d.ts","sourceRoot":"","sources":["../../src/lib/ModuleFilenameHelpers.js"],"names":[],"mappings":"AAqBA,oDAQC;AAED,yDAiBC;;;;mBAtCa,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
|
7
|
+
/** @typedef {import("./Module")} Module */
|
|
8
|
+
/** @typedef {import("./RequestShortener")} RequestShortener */
|
|
9
|
+
/** @typedef {typeof import("./util/Hash")} Hash */
|
|
10
|
+
const ModuleFilenameHelpers = exports;
|
|
11
|
+
const asRegExp = test => {
|
|
12
|
+
if (typeof test === "string") {
|
|
13
|
+
test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
|
|
14
|
+
}
|
|
15
|
+
return test;
|
|
16
|
+
};
|
|
17
|
+
ModuleFilenameHelpers.matchPart = (str, test) => {
|
|
18
|
+
if (!test)
|
|
19
|
+
return true;
|
|
20
|
+
test = asRegExp(test);
|
|
21
|
+
if (Array.isArray(test)) {
|
|
22
|
+
return test.map(asRegExp).some(regExp => regExp.test(str));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return test.test(str);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
ModuleFilenameHelpers.matchObject = (obj, str) => {
|
|
29
|
+
if (obj.test) {
|
|
30
|
+
if (!ModuleFilenameHelpers.matchPart(str, obj.test)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (obj.include) {
|
|
35
|
+
if (!ModuleFilenameHelpers.matchPart(str, obj.include)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (obj.exclude) {
|
|
40
|
+
if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=ModuleFilenameHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleFilenameHelpers.js","sourceRoot":"","sources":["../../src/lib/ModuleFilenameHelpers.js"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;AAEb,mDAAmD;AACnD,2CAA2C;AAC3C,+DAA+D;AAC/D,mDAAmD;AAEnD,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAEtC,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE;IACvB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC7B,IAAI,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC,CAAC;KAC1E;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,qBAAqB,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IAC/C,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;KAC3D;SAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACtB;AACF,CAAC,CAAC;AAEF,qBAAqB,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAChD,IAAI,GAAG,CAAC,IAAI,EAAE;QACb,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE;YACpD,OAAO,KAAK,CAAC;SACb;KACD;IACD,IAAI,GAAG,CAAC,OAAO,EAAE;QAChB,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;YACvD,OAAO,KAAK,CAAC;SACb;KACD;IACD,IAAI,GAAG,CAAC,OAAO,EAAE;QAChB,IAAI,qBAAqB,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;YACtD,OAAO,KAAK,CAAC;SACb;KACD;IACD,OAAO,IAAI,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
export = Template;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} RenderManifestOptions
|
|
4
|
+
* @property {Chunk} chunk the chunk used to render
|
|
5
|
+
* @property {string} hash
|
|
6
|
+
* @property {string} fullHash
|
|
7
|
+
* @property {OutputOptions} outputOptions
|
|
8
|
+
* @property {CodeGenerationResults} codeGenerationResults
|
|
9
|
+
* @property {{javascript: ModuleTemplate}} moduleTemplates
|
|
10
|
+
* @property {DependencyTemplates} dependencyTemplates
|
|
11
|
+
* @property {RuntimeTemplate} runtimeTemplate
|
|
12
|
+
* @property {ModuleGraph} moduleGraph
|
|
13
|
+
* @property {ChunkGraph} chunkGraph
|
|
14
|
+
*/
|
|
15
|
+
/** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} RenderManifestEntryTemplated
|
|
18
|
+
* @property {function(): Source} render
|
|
19
|
+
* @property {string | function(PathData, AssetInfo=): string} filenameTemplate
|
|
20
|
+
* @property {PathData=} pathOptions
|
|
21
|
+
* @property {AssetInfo=} info
|
|
22
|
+
* @property {string} identifier
|
|
23
|
+
* @property {string=} hash
|
|
24
|
+
* @property {boolean=} auxiliary
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} RenderManifestEntryStatic
|
|
28
|
+
* @property {function(): Source} render
|
|
29
|
+
* @property {string} filename
|
|
30
|
+
* @property {AssetInfo} info
|
|
31
|
+
* @property {string} identifier
|
|
32
|
+
* @property {string=} hash
|
|
33
|
+
* @property {boolean=} auxiliary
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} HasId
|
|
37
|
+
* @property {number | string} id
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {function(Module, number): boolean} ModuleFilterPredicate
|
|
41
|
+
*/
|
|
42
|
+
declare class Template {
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {Function} fn a runtime function (.runtime.js) "template"
|
|
46
|
+
* @returns {string} the updated and normalized function string
|
|
47
|
+
*/
|
|
48
|
+
static getFunctionContent(fn: Function): string;
|
|
49
|
+
/**
|
|
50
|
+
* @param {string} str the string converted to identifier
|
|
51
|
+
* @returns {string} created identifier
|
|
52
|
+
*/
|
|
53
|
+
static toIdentifier(str: string): string;
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param {string} str string to be converted to commented in bundle code
|
|
57
|
+
* @returns {string} returns a commented version of string
|
|
58
|
+
*/
|
|
59
|
+
static toComment(str: string): string;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param {string} str string to be converted to "normal comment"
|
|
63
|
+
* @returns {string} returns a commented version of string
|
|
64
|
+
*/
|
|
65
|
+
static toNormalComment(str: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* @param {string} str string path to be normalized
|
|
68
|
+
* @returns {string} normalized bundle-safe path
|
|
69
|
+
*/
|
|
70
|
+
static toPath(str: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* @param {number} n number to convert to ident
|
|
73
|
+
* @returns {string} returns single character ident
|
|
74
|
+
*/
|
|
75
|
+
static numberToIdentifier(n: number): string;
|
|
76
|
+
/**
|
|
77
|
+
* @param {number} n number to convert to ident
|
|
78
|
+
* @returns {string} returns single character ident
|
|
79
|
+
*/
|
|
80
|
+
static numberToIdentifierContinuation(n: number): string;
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param {string | string[]} s string to convert to identity
|
|
84
|
+
* @returns {string} converted identity
|
|
85
|
+
*/
|
|
86
|
+
static indent(s: string | string[]): string;
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param {string|string[]} s string to create prefix for
|
|
90
|
+
* @param {string} prefix prefix to compose
|
|
91
|
+
* @returns {string} returns new prefix string
|
|
92
|
+
*/
|
|
93
|
+
static prefix(s: string | string[], prefix: string): string;
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @param {string|string[]} str string or string collection
|
|
97
|
+
* @returns {string} returns a single string from array
|
|
98
|
+
*/
|
|
99
|
+
static asString(str: string | string[]): string;
|
|
100
|
+
/**
|
|
101
|
+
* @typedef {Object} WithId
|
|
102
|
+
* @property {string|number} id
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* @param {WithId[]} modules a collection of modules to get array bounds for
|
|
106
|
+
* @returns {[number, number] | false} returns the upper and lower array bounds
|
|
107
|
+
* or false if not every module has a number based id
|
|
108
|
+
*/
|
|
109
|
+
static getModulesArrayBounds(modules: {
|
|
110
|
+
id: string | number;
|
|
111
|
+
}[]): [number, number] | false;
|
|
112
|
+
/**
|
|
113
|
+
* @param {ChunkRenderContext} renderContext render context
|
|
114
|
+
* @param {Module[]} modules modules to render (should be ordered by identifier)
|
|
115
|
+
* @param {function(Module): Source} renderModule function to render a module
|
|
116
|
+
* @param {string=} prefix applying prefix strings
|
|
117
|
+
* @returns {Source} rendered chunk modules in a Source object
|
|
118
|
+
*/
|
|
119
|
+
static renderChunkModules(renderContext: any, modules: Module[], renderModule: (arg0: Module) => Source, prefix?: string | undefined): Source;
|
|
120
|
+
/**
|
|
121
|
+
* @param {RuntimeModule[]} runtimeModules array of runtime modules in order
|
|
122
|
+
* @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context
|
|
123
|
+
* @returns {Source} rendered runtime modules in a Source object
|
|
124
|
+
*/
|
|
125
|
+
static renderRuntimeModules(runtimeModules: RuntimeModule[], renderContext: RenderContext & {
|
|
126
|
+
codeGenerationResults?: CodeGenerationResults;
|
|
127
|
+
}): Source;
|
|
128
|
+
/**
|
|
129
|
+
* @param {RuntimeModule[]} runtimeModules array of runtime modules in order
|
|
130
|
+
* @param {RenderContext} renderContext render context
|
|
131
|
+
* @returns {Source} rendered chunk runtime modules in a Source object
|
|
132
|
+
*/
|
|
133
|
+
static renderChunkRuntimeModules(runtimeModules: RuntimeModule[], renderContext: any): Source;
|
|
134
|
+
}
|
|
135
|
+
declare namespace Template {
|
|
136
|
+
export { NUMBER_OF_IDENTIFIER_START_CHARS, NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, Source, OutputOptions, Chunk, ChunkGraph, CodeGenerationResults, AssetInfo, PathData, DependencyTemplates, Module, ModuleGraph, ModuleTemplate, RuntimeModule, RuntimeTemplate, ChunkRenderContext, RenderContext, RenderManifestOptions, RenderManifestEntry, RenderManifestEntryTemplated, RenderManifestEntryStatic, HasId, ModuleFilterPredicate };
|
|
137
|
+
}
|
|
138
|
+
type Module = any;
|
|
139
|
+
type Source = import("webpack-sources").Source;
|
|
140
|
+
type RuntimeModule = any;
|
|
141
|
+
type RenderContext = any;
|
|
142
|
+
type CodeGenerationResults = any;
|
|
143
|
+
declare const NUMBER_OF_IDENTIFIER_START_CHARS: number;
|
|
144
|
+
declare const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS: number;
|
|
145
|
+
type OutputOptions = any;
|
|
146
|
+
type Chunk = any;
|
|
147
|
+
type ChunkGraph = any;
|
|
148
|
+
type AssetInfo = any;
|
|
149
|
+
type PathData = any;
|
|
150
|
+
type DependencyTemplates = any;
|
|
151
|
+
type ModuleGraph = any;
|
|
152
|
+
type ModuleTemplate = any;
|
|
153
|
+
type RuntimeTemplate = any;
|
|
154
|
+
type ChunkRenderContext = any;
|
|
155
|
+
type RenderManifestOptions = {
|
|
156
|
+
/**
|
|
157
|
+
* the chunk used to render
|
|
158
|
+
*/
|
|
159
|
+
chunk: any;
|
|
160
|
+
hash: string;
|
|
161
|
+
fullHash: string;
|
|
162
|
+
outputOptions: any;
|
|
163
|
+
codeGenerationResults: any;
|
|
164
|
+
moduleTemplates: {
|
|
165
|
+
javascript: ModuleTemplate;
|
|
166
|
+
};
|
|
167
|
+
dependencyTemplates: any;
|
|
168
|
+
runtimeTemplate: any;
|
|
169
|
+
moduleGraph: any;
|
|
170
|
+
chunkGraph: any;
|
|
171
|
+
};
|
|
172
|
+
type RenderManifestEntry = RenderManifestEntryTemplated | RenderManifestEntryStatic;
|
|
173
|
+
type RenderManifestEntryTemplated = {
|
|
174
|
+
render: () => Source;
|
|
175
|
+
filenameTemplate: string | ((arg0: PathData, arg1: AssetInfo | undefined) => string);
|
|
176
|
+
pathOptions?: PathData | undefined;
|
|
177
|
+
info?: AssetInfo | undefined;
|
|
178
|
+
identifier: string;
|
|
179
|
+
hash?: string | undefined;
|
|
180
|
+
auxiliary?: boolean | undefined;
|
|
181
|
+
};
|
|
182
|
+
type RenderManifestEntryStatic = {
|
|
183
|
+
render: () => Source;
|
|
184
|
+
filename: string;
|
|
185
|
+
info: any;
|
|
186
|
+
identifier: string;
|
|
187
|
+
hash?: string | undefined;
|
|
188
|
+
auxiliary?: boolean | undefined;
|
|
189
|
+
};
|
|
190
|
+
type HasId = {
|
|
191
|
+
id: number | string;
|
|
192
|
+
};
|
|
193
|
+
type ModuleFilterPredicate = (arg0: Module, arg1: number) => boolean;
|
|
194
|
+
//# sourceMappingURL=Template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Template.d.ts","sourceRoot":"","sources":["../../src/lib/Template.js"],"names":[],"mappings":";AAwCA;;;;;;;;;;;;GAYG;AAEH,8FAA8F;AAE9F;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;IACC;;;;OAIG;IACH,yCAFa,MAAM,CAQlB;IAED;;;OAGG;IACH,yBAHW,MAAM,GACJ,MAAM,CAOlB;IACD;;;;OAIG;IACH,sBAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,MAAM,CAKlB;IAED;;;OAGG;IACH,mBAHW,MAAM,GACJ,MAAM,CAOlB;IAGD;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CA0BlB;IAED;;;OAGG;IACH,yCAHW,MAAM,GACJ,MAAM,CAkClB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GAAG,MAAM,EAAE,GACf,MAAM,CAWlB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,GAAC,MAAM,EAAE,UACf,MAAM,GACJ,MAAM,CAOlB;IAED;;;;OAIG;IACH,qBAHW,MAAM,GAAC,MAAM,EAAE,GACb,MAAM,CAOlB;IAED;;;OAGG;IAEH;;;;OAIG;IACH;YARc,MAAM,GAAC,MAAM;UAKd,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAyBpC;IAED;;;;;;OAMG;IACH,uDALW,MAAM,EAAE,uBACC,MAAM,KAAG,MAAM,WACxB,MAAM,eACJ,MAAM,CA0DlB;IAED;;;;OAIG;IACH,4CAJW,aAAa,EAAE,iBACf,aAAa,GAAG;QAAE,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;KAAE,GAC/D,MAAM,CA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