@atlassian/webresource-webpack-plugin 7.0.2 → 7.0.4-efd4a11
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/CHANGELOG.md +12 -0
- package/README.md +6 -3
- package/dist/AppResources.d.ts +63 -0
- package/dist/AppResources.js +179 -0
- package/dist/AppResources.js.map +1 -0
- package/dist/AppResourcesFactory.d.ts +10 -0
- package/dist/AppResourcesFactory.js +16 -0
- package/dist/AppResourcesFactory.js.map +1 -0
- package/dist/WebpackHelpers.d.ts +16 -0
- package/dist/WebpackHelpers.js +97 -0
- package/dist/WebpackHelpers.js.map +1 -0
- package/dist/WebpackRuntimeHelpers.d.ts +2 -0
- package/dist/WebpackRuntimeHelpers.js +10 -0
- package/dist/WebpackRuntimeHelpers.js.map +1 -0
- package/dist/WrmManifestPlugin.d.ts +9 -0
- package/dist/WrmManifestPlugin.js +44 -0
- package/dist/WrmManifestPlugin.js.map +1 -0
- package/dist/WrmPlugin.d.ts +51 -0
- package/dist/WrmPlugin.js +566 -0
- package/dist/WrmPlugin.js.map +1 -0
- package/dist/deps/base-dependencies.d.ts +8 -0
- package/dist/deps/base-dependencies.js +38 -0
- package/dist/deps/base-dependencies.js.map +1 -0
- package/dist/deps/provided-dependencies.d.ts +3 -0
- package/dist/deps/provided-dependencies.js +22 -0
- package/dist/deps/provided-dependencies.js.map +1 -0
- package/dist/helpers/file-system.d.ts +2 -0
- package/dist/helpers/file-system.js +22 -0
- package/dist/helpers/file-system.js.map +1 -0
- package/dist/helpers/isRspackCompiler.d.ts +3 -0
- package/dist/helpers/isRspackCompiler.js +9 -0
- package/dist/helpers/isRspackCompiler.js.map +1 -0
- package/dist/helpers/options-parser.d.ts +3 -0
- package/dist/helpers/options-parser.js +31 -0
- package/dist/helpers/options-parser.js.map +1 -0
- package/dist/helpers/renderCondition.d.ts +3 -0
- package/dist/helpers/renderCondition.js +32 -0
- package/dist/helpers/renderCondition.js.map +1 -0
- package/dist/helpers/renderTransformations.d.ts +10 -0
- package/dist/helpers/renderTransformations.js +34 -0
- package/dist/helpers/renderTransformations.js.map +1 -0
- package/dist/helpers/string.d.ts +1 -0
- package/dist/helpers/string.js +9 -0
- package/dist/helpers/string.js.map +1 -0
- package/dist/helpers/web-resource-entrypoints.d.ts +9 -0
- package/dist/helpers/web-resource-entrypoints.js +44 -0
- package/dist/helpers/web-resource-entrypoints.js.map +1 -0
- package/dist/helpers/web-resource-generator.d.ts +2 -0
- package/dist/helpers/web-resource-generator.js +105 -0
- package/dist/helpers/web-resource-generator.js.map +1 -0
- package/dist/helpers/web-resource-parser.d.ts +2 -0
- package/dist/helpers/web-resource-parser.js +39 -0
- package/dist/helpers/web-resource-parser.js.map +1 -0
- package/dist/helpers/xml.d.ts +6 -0
- package/dist/helpers/xml.js +37 -0
- package/dist/helpers/xml.js.map +1 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +26 -0
- package/dist/logger.js.map +1 -0
- package/dist/shims/require-ensure-shim.d.ts +2 -0
- package/dist/shims/require-ensure-shim.js +21 -0
- package/dist/shims/require-ensure-shim.js.map +1 -0
- package/dist/shims/runtime-load-shim.d.ts +14 -0
- package/dist/shims/runtime-load-shim.js +62 -0
- package/dist/shims/runtime-load-shim.js.map +1 -0
- package/dist/types/extracted-webpack-types.d.ts +12 -0
- package/dist/types/extracted-webpack-types.js +3 -0
- package/dist/types/extracted-webpack-types.js.map +1 -0
- package/dist/types/types.d.ts +132 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/webpack-modules/EmptyExportsModule.d.ts +14 -0
- package/dist/webpack-modules/EmptyExportsModule.js +28 -0
- package/dist/webpack-modules/EmptyExportsModule.js.map +1 -0
- package/dist/webpack-modules/ProvidedExternalDependencyModule.d.ts +20 -0
- package/dist/webpack-modules/ProvidedExternalDependencyModule.js +36 -0
- package/dist/webpack-modules/ProvidedExternalDependencyModule.js.map +1 -0
- package/dist/webpack-modules/WrmDependencyModule.d.ts +6 -0
- package/dist/webpack-modules/WrmDependencyModule.js +17 -0
- package/dist/webpack-modules/WrmDependencyModule.js.map +1 -0
- package/dist/webpack-modules/WrmResourceModule.d.ts +10 -0
- package/dist/webpack-modules/WrmResourceModule.js +29 -0
- package/dist/webpack-modules/WrmResourceModule.js.map +1 -0
- package/jest.config.js +16 -1
- package/package.json +20 -17
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProvidedDependenciesMap, ProvidedDependency } from '../types/types';
|
|
2
|
+
export declare const buildProvidedDependency: (pluginKey: string, resourceKey: string, importVar: string, importAmd: string) => ProvidedDependency;
|
|
3
|
+
export declare const builtInProvidedDependencies: ProvidedDependenciesMap;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.builtInProvidedDependencies = exports.buildProvidedDependency = void 0;
|
|
4
|
+
const buildProvidedDependency = (pluginKey, resourceKey, importVar, importAmd) => {
|
|
5
|
+
return {
|
|
6
|
+
dependency: `${pluginKey}:${resourceKey}`,
|
|
7
|
+
import: {
|
|
8
|
+
var: importVar,
|
|
9
|
+
amd: importAmd,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.buildProvidedDependency = buildProvidedDependency;
|
|
14
|
+
const webresourcePluginName = 'com.atlassian.plugins.atlassian-plugins-webresource-plugin';
|
|
15
|
+
const webresourceDep = exports.buildProvidedDependency.bind(undefined, webresourcePluginName);
|
|
16
|
+
exports.builtInProvidedDependencies = new Map()
|
|
17
|
+
.set('wrm/require', (0, exports.buildProvidedDependency)('com.atlassian.plugins.atlassian-plugins-webresource-rest', 'web-resource-manager', 'WRM.require', 'wrm/require'))
|
|
18
|
+
.set('wrm/context-path', webresourceDep('context-path', 'WRM.contextPath', 'wrm/context-path'))
|
|
19
|
+
.set('wrm/data', webresourceDep('data', 'WRM.data', 'wrm/data'))
|
|
20
|
+
.set('wrm/format', webresourceDep('format', 'WRM.format', 'wrm/format'))
|
|
21
|
+
.set('wrm/i18n', webresourceDep('i18n', 'WRM.I18n', 'wrm/i18n'));
|
|
22
|
+
//# sourceMappingURL=provided-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provided-dependencies.js","sourceRoot":"","sources":["../../src/deps/provided-dependencies.ts"],"names":[],"mappings":";;;AAEO,MAAM,uBAAuB,GAAG,CACrC,SAAiB,EACjB,WAAmB,EACnB,SAAiB,EACjB,SAAiB,EACG,EAAE;IACtB,OAAO;QACL,UAAU,EAAE,GAAG,SAAS,IAAI,WAAW,EAAE;QACzC,MAAM,EAAE;YACN,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;SACf;KACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,uBAAuB,2BAalC;AAEF,MAAM,qBAAqB,GAAG,4DAA4D,CAAC;AAC3F,MAAM,cAAc,GAAG,+BAAuB,CAAC,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAEzE,QAAA,2BAA2B,GAA4B,IAAI,GAAG,EAAE;KAC1E,GAAG,CACF,aAAa,EACb,IAAA,+BAAuB,EACrB,0DAA0D,EAC1D,sBAAsB,EACtB,aAAa,EACb,aAAa,CACd,CACF;KACA,GAAG,CAAC,kBAAkB,EAAE,cAAc,CAAC,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;KAC9F,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;KAC/D,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;KACvE,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeFileSync = writeFileSync;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
function writeFileSync(outputPath, contents) {
|
|
10
|
+
try {
|
|
11
|
+
// will throw a TypeError if the path is non-normal
|
|
12
|
+
path_1.default.parse(outputPath);
|
|
13
|
+
fs_1.default.mkdirSync(path_1.default.dirname(outputPath), { recursive: true });
|
|
14
|
+
fs_1.default.writeFileSync(outputPath, contents, 'utf8');
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
console.error(`Failed to output file at path ${outputPath}`, e);
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=file-system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-system.js","sourceRoot":"","sources":["../../src/helpers/file-system.ts"],"names":[],"mappings":";;;;;AAgBS,sCAAa;AAhBtB,4CAAoB;AACpB,gDAAwB;AAExB,SAAS,aAAa,CAAC,UAAkB,EAAE,QAAgB;IACzD,IAAI,CAAC;QACH,mDAAmD;QACnD,cAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACvB,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,iCAAiC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRspackCompiler = void 0;
|
|
4
|
+
const isRspackCompiler = (compiler) => {
|
|
5
|
+
// @ts-expect-error TODO: find cleaner way for Rspack compatibility
|
|
6
|
+
return compiler?.rspack !== undefined;
|
|
7
|
+
};
|
|
8
|
+
exports.isRspackCompiler = isRspackCompiler;
|
|
9
|
+
//# sourceMappingURL=isRspackCompiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isRspackCompiler.js","sourceRoot":"","sources":["../../src/helpers/isRspackCompiler.ts"],"names":[],"mappings":";;;AAGO,MAAM,gBAAgB,GAAG,CAAC,QAA0C,EAA8B,EAAE;IACzG,mEAAmE;IACnE,OAAO,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;AACxC,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.extractPathPrefixForXml = exports.toMap = void 0;
|
|
7
|
+
const escapeRegExp_1 = __importDefault(require("lodash/escapeRegExp"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const escapedSeparator = (0, escapeRegExp_1.default)(path_1.default.sep);
|
|
10
|
+
const pathSeparatorRegex = new RegExp(`^\\${escapedSeparator}|\\${escapedSeparator}$`, 'g');
|
|
11
|
+
const toMap = (original) => {
|
|
12
|
+
if (original instanceof Map) {
|
|
13
|
+
return original;
|
|
14
|
+
}
|
|
15
|
+
if (original && typeof original === 'object') {
|
|
16
|
+
return new Map(Object.entries(original));
|
|
17
|
+
}
|
|
18
|
+
return new Map();
|
|
19
|
+
};
|
|
20
|
+
exports.toMap = toMap;
|
|
21
|
+
const extractPathPrefixForXml = (pathPrefix) => {
|
|
22
|
+
if (!pathPrefix || pathPrefix === '' || pathPrefix === '/') {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
// remove leading/trailing path separator
|
|
26
|
+
const withoutLeadingTrailingSeparators = pathPrefix.replace(pathSeparatorRegex, '');
|
|
27
|
+
// readd trailing slash - this time OS independent always a "/"
|
|
28
|
+
return withoutLeadingTrailingSeparators + '/';
|
|
29
|
+
};
|
|
30
|
+
exports.extractPathPrefixForXml = extractPathPrefixForXml;
|
|
31
|
+
//# sourceMappingURL=options-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-parser.js","sourceRoot":"","sources":["../../src/helpers/options-parser.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA+C;AAC/C,gDAAwB;AAIxB,MAAM,gBAAgB,GAAG,IAAA,sBAAY,EAAC,cAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,MAAM,gBAAgB,MAAM,gBAAgB,GAAG,EAAE,GAAG,CAAC,CAAC;AAErF,MAAM,KAAK,GAAG,CAAI,QAAqB,EAAkB,EAAE;IAChE,IAAI,QAAQ,YAAY,GAAG,EAAE,CAAC;QAC5B,OAAO,QAA0B,CAAC;IACpC,CAAC;IACD,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC7C,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAA6B,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,IAAI,GAAG,EAAE,CAAC;AACnB,CAAC,CAAC;AARW,QAAA,KAAK,SAQhB;AAEK,MAAM,uBAAuB,GAAG,CAAC,UAA8B,EAAE,EAAE;IACxE,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,EAAE,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QAC3D,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,yCAAyC;IACzC,MAAM,gCAAgC,GAAG,UAAU,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACpF,+DAA+D;IAC/D,OAAO,gCAAgC,GAAG,GAAG,CAAC;AAChD,CAAC,CAAC;AATW,QAAA,uBAAuB,2BASlC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const xml_1 = require("./xml");
|
|
4
|
+
const renderParams = (params) => {
|
|
5
|
+
if (!params) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
return params.map((param) => (0, xml_1.renderElement)('param', param.attributes, param.value)).join('');
|
|
9
|
+
};
|
|
10
|
+
function isConditions(arg) {
|
|
11
|
+
if (Array.isArray(arg)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return 'type' in arg;
|
|
15
|
+
}
|
|
16
|
+
const renderCondition = (condition) => {
|
|
17
|
+
if (!condition) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
// we have an array of conditions or condition
|
|
21
|
+
if (Array.isArray(condition)) {
|
|
22
|
+
return condition.map(renderCondition).join('');
|
|
23
|
+
}
|
|
24
|
+
// we have a "conditions"-joiner for multiple sub conditions
|
|
25
|
+
if (isConditions(condition)) {
|
|
26
|
+
return (0, xml_1.renderElement)('conditions', { type: condition.type }, renderCondition(condition.conditions));
|
|
27
|
+
}
|
|
28
|
+
// we have a "condition"
|
|
29
|
+
return (0, xml_1.renderElement)('condition', ` class="${condition.class}" ${condition.invert ? 'invert="true"' : ''}`, renderParams(condition.params));
|
|
30
|
+
};
|
|
31
|
+
exports.default = renderCondition;
|
|
32
|
+
//# sourceMappingURL=renderCondition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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CAAC,EAAE,EAAE,EACxE,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAC/B,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TransformationMap } from '../types/types';
|
|
2
|
+
type Resource = {
|
|
3
|
+
location: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Converts a map of filetype-to-transformer entries in to the set of XML transform elements
|
|
7
|
+
* required for a given set of resources. Renders every transform if no resources are provided.
|
|
8
|
+
*/
|
|
9
|
+
declare const renderTransformations: (transformations: TransformationMap, resources?: Resource[]) => string[];
|
|
10
|
+
export default renderTransformations;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const xml_1 = require("./xml");
|
|
8
|
+
const renderTransformer = (transformers) => {
|
|
9
|
+
if (transformers && transformers.length) {
|
|
10
|
+
return transformers.map((transformer) => (0, xml_1.renderElement)('transformer', { key: transformer })).join('');
|
|
11
|
+
}
|
|
12
|
+
return '';
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Generates the appropriate function to be used when filtering a transform map down to only those required.
|
|
16
|
+
*/
|
|
17
|
+
const transformFilterFactory = (resources) => {
|
|
18
|
+
if (resources && resources.length) {
|
|
19
|
+
const resourceFiletypes = resources.map((resource) => path_1.default.extname(resource.location).substr(1));
|
|
20
|
+
return (ext) => resourceFiletypes.includes(ext);
|
|
21
|
+
}
|
|
22
|
+
return () => true;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Converts a map of filetype-to-transformer entries in to the set of XML transform elements
|
|
26
|
+
* required for a given set of resources. Renders every transform if no resources are provided.
|
|
27
|
+
*/
|
|
28
|
+
const renderTransformations = (transformations, resources = []) => {
|
|
29
|
+
return Array.from(transformations.keys())
|
|
30
|
+
.filter(transformFilterFactory(resources))
|
|
31
|
+
.map((extension) => (0, xml_1.renderElement)('transformation', { extension }, renderTransformer(transformations.get(extension))));
|
|
32
|
+
};
|
|
33
|
+
exports.default = renderTransformations;
|
|
34
|
+
//# sourceMappingURL=renderTransformations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderTransformations.js","sourceRoot":"","sources":["../../src/helpers/renderTransformations.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAGxB,+BAAsC;AAEtC,MAAM,iBAAiB,GAAG,CAAC,YAAsB,EAAE,EAAE;IACnD,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;QACxC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,mBAAa,EAAC,aAAa,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,sBAAsB,GAAG,CAAC,SAAqB,EAAE,EAAE;IACvD,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,iBAAiB,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACjG,OAAO,CAAC,GAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;AACpB,CAAC,CAAC;AAMF;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,eAAkC,EAAE,YAAwB,EAAE,EAAY,EAAE;IACzG,OAAO,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;SACtC,MAAM,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;SACzC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CACjB,IAAA,mBAAa,EAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,EAAE,iBAAiB,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC,CAAC,CACnG,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toTrimmedString: (val: string | unknown) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toTrimmedString = void 0;
|
|
4
|
+
const toTrimmedString = (val) => {
|
|
5
|
+
const maybeStr = typeof val === 'string' ? val : '';
|
|
6
|
+
return maybeStr.trim();
|
|
7
|
+
};
|
|
8
|
+
exports.toTrimmedString = toTrimmedString;
|
|
9
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/helpers/string.ts"],"names":[],"mappings":";;;AAAO,MAAM,eAAe,GAAG,CAAC,GAAqB,EAAE,EAAE;IACvD,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConditionsMap, ContextMap, DataProvidersMap, DeprecationMap, WebresourceMap } from '../types/types';
|
|
2
|
+
export declare const getContextForEntry: (entry: string, contextMap: ContextMap, addEntrypointNameAsContext: boolean) => string[];
|
|
3
|
+
export declare const getWebresourceAttributesForEntry: (entry: string, webresourceKeyMap: WebresourceMap) => {
|
|
4
|
+
key: string;
|
|
5
|
+
moduleId: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getConditionForEntry: (entry: string, conditionMap: ConditionsMap) => import("../types/types").Condition | undefined;
|
|
8
|
+
export declare const getDataProvidersForEntry: (entrypoint: string, dataProvidersMap: DataProvidersMap) => import("../types/types").DataProvider[];
|
|
9
|
+
export declare const getDeprecationInfoForEntry: (entrypoint: string, deprecationMap: DeprecationMap) => import("../types/types").DeprecationInfo | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDeprecationInfoForEntry = exports.getDataProvidersForEntry = exports.getConditionForEntry = exports.getWebresourceAttributesForEntry = exports.getContextForEntry = void 0;
|
|
4
|
+
const web_resource_parser_1 = require("./web-resource-parser");
|
|
5
|
+
const getContextForEntry = (entry, contextMap, addEntrypointNameAsContext) => {
|
|
6
|
+
const initialArray = addEntrypointNameAsContext ? [entry] : [];
|
|
7
|
+
if (!contextMap.has(entry)) {
|
|
8
|
+
return initialArray;
|
|
9
|
+
}
|
|
10
|
+
// TODO: verify if we need the typecheck here, as Intellij is rightfully complaining about the typecheck here as `contextMap` should only return "strings"
|
|
11
|
+
// noinspection SuspiciousTypeOfGuard
|
|
12
|
+
return initialArray
|
|
13
|
+
.concat(contextMap.get(entry))
|
|
14
|
+
.filter((context) => typeof context === 'string' && context.trim() !== '');
|
|
15
|
+
};
|
|
16
|
+
exports.getContextForEntry = getContextForEntry;
|
|
17
|
+
const getWebresourceAttributesForEntry = (entry, webresourceKeyMap) => {
|
|
18
|
+
const wrKey = webresourceKeyMap.get(entry);
|
|
19
|
+
// Create the default attribute values
|
|
20
|
+
let attrs = { key: `entrypoint-${entry}`, moduleId: entry };
|
|
21
|
+
// Extend the attributes with parsed, valid values
|
|
22
|
+
if (typeof wrKey === 'object') {
|
|
23
|
+
attrs = Object.assign(attrs, (0, web_resource_parser_1.parseWebResourceAttributes)(wrKey));
|
|
24
|
+
}
|
|
25
|
+
// Override the key if a non-empty string is provided
|
|
26
|
+
if (typeof wrKey === 'string') {
|
|
27
|
+
attrs = Object.assign(attrs, (0, web_resource_parser_1.parseWebResourceAttributes)({ key: wrKey }));
|
|
28
|
+
}
|
|
29
|
+
return attrs;
|
|
30
|
+
};
|
|
31
|
+
exports.getWebresourceAttributesForEntry = getWebresourceAttributesForEntry;
|
|
32
|
+
const getConditionForEntry = (entry, conditionMap) => {
|
|
33
|
+
return conditionMap.get(entry);
|
|
34
|
+
};
|
|
35
|
+
exports.getConditionForEntry = getConditionForEntry;
|
|
36
|
+
const getDataProvidersForEntry = (entrypoint, dataProvidersMap) => {
|
|
37
|
+
return dataProvidersMap.get(entrypoint) || [];
|
|
38
|
+
};
|
|
39
|
+
exports.getDataProvidersForEntry = getDataProvidersForEntry;
|
|
40
|
+
const getDeprecationInfoForEntry = (entrypoint, deprecationMap) => {
|
|
41
|
+
return deprecationMap.get(entrypoint);
|
|
42
|
+
};
|
|
43
|
+
exports.getDeprecationInfoForEntry = getDeprecationInfoForEntry;
|
|
44
|
+
//# sourceMappingURL=web-resource-entrypoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-resource-entrypoints.js","sourceRoot":"","sources":["../../src/helpers/web-resource-entrypoints.ts"],"names":[],"mappings":";;;AACA,+DAAmE;AAE5D,MAAM,kBAAkB,GAAG,CAChC,KAAa,EACb,UAAsB,EACtB,0BAAmC,EACzB,EAAE;IACZ,MAAM,YAAY,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OA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AAE;IACjG,OAAO,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,wBAAwB,4BAEnC;AAEK,MAAM,0BAA0B,GAAG,CAAC,UAAkB,EAAE,cAA8B,EAAE,EAAE;IAC/F,OAAO,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderWebResource = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const renderCondition_1 = __importDefault(require("./renderCondition"));
|
|
9
|
+
const renderTransformations_1 = __importDefault(require("./renderTransformations"));
|
|
10
|
+
const web_resource_parser_1 = require("./web-resource-parser");
|
|
11
|
+
const xml_1 = require("./xml");
|
|
12
|
+
/**
|
|
13
|
+
* Renders list of data providers {@see DataProvider} as <data key="provider-key" class="data.provider.Class" /> elements
|
|
14
|
+
*/
|
|
15
|
+
const renderDataProviders = (dataProviders) => {
|
|
16
|
+
if (!Array.isArray(dataProviders) || dataProviders.length === 0) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
return dataProviders.map((dataProvider) => (0, xml_1.renderElement)('data', {
|
|
20
|
+
key: dataProvider.key,
|
|
21
|
+
class: dataProvider.class,
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
function renderContexts(contexts) {
|
|
25
|
+
return contexts ? contexts.map((context) => `<context>${context}</context>`) : [];
|
|
26
|
+
}
|
|
27
|
+
function renderDependencies(dependencies) {
|
|
28
|
+
return dependencies ? dependencies.map((dependency) => `<dependency>${dependency}</dependency>`) : [];
|
|
29
|
+
}
|
|
30
|
+
function renderDeprecationInfo(deprecationInfo, pluginKey, webResourceDescriptors) {
|
|
31
|
+
if (deprecationInfo) {
|
|
32
|
+
if (deprecationInfo === true) {
|
|
33
|
+
return ['<deprecated />'];
|
|
34
|
+
}
|
|
35
|
+
const attributes = {};
|
|
36
|
+
if (deprecationInfo.sinceVersion) {
|
|
37
|
+
attributes.since = deprecationInfo.sinceVersion;
|
|
38
|
+
}
|
|
39
|
+
if (deprecationInfo.removeInVersion) {
|
|
40
|
+
attributes.remove = deprecationInfo.removeInVersion;
|
|
41
|
+
}
|
|
42
|
+
if (deprecationInfo.alternative) {
|
|
43
|
+
attributes.alternative = calculateAlternativeResourceKey(deprecationInfo.alternative, pluginKey, webResourceDescriptors);
|
|
44
|
+
}
|
|
45
|
+
return [(0, xml_1.renderElement)('deprecated', attributes, deprecationInfo.extraInfo)];
|
|
46
|
+
}
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Expand the alternative attribute value to a full resource key if it is a reference to another entrypoint.
|
|
51
|
+
* @param alternativeAttributeValue the value of the "alternative" attribute in the deprecatedEntrypoints map. Can be a simple string
|
|
52
|
+
* referencing another entrypoint or a full resource key.
|
|
53
|
+
* @param pluginKey the plugin key
|
|
54
|
+
* @param webResourceDescriptors list all entry-points specified in the current build
|
|
55
|
+
*/
|
|
56
|
+
function calculateAlternativeResourceKey(alternativeAttributeValue, pluginKey, webResourceDescriptors) {
|
|
57
|
+
// If a colon is present, the users have specified a full resource key, and we don't need to do any mapping.
|
|
58
|
+
if (alternativeAttributeValue.includes(':')) {
|
|
59
|
+
return alternativeAttributeValue;
|
|
60
|
+
}
|
|
61
|
+
// We need to check if the alternative entry-point's web resource key has been mapped to something else.
|
|
62
|
+
const entryPointDescriptor = webResourceDescriptors.find((descriptor) => descriptor.attributes.moduleId === alternativeAttributeValue);
|
|
63
|
+
if (entryPointDescriptor !== undefined) {
|
|
64
|
+
return `${pluginKey}:${entryPointDescriptor.attributes.key}`;
|
|
65
|
+
}
|
|
66
|
+
// If it's not an entry point just assume it's some other web resource in the same plugin defined outside of webpack.
|
|
67
|
+
return `${pluginKey}:${alternativeAttributeValue}`;
|
|
68
|
+
}
|
|
69
|
+
const generateResourceElement = (resource, parameterMap) => {
|
|
70
|
+
const { name, location } = resource;
|
|
71
|
+
const assetContentType = path_1.default.extname(location).substr(1);
|
|
72
|
+
const parameters = parameterMap.get(assetContentType) || [];
|
|
73
|
+
const children = [];
|
|
74
|
+
const renderParameters = (attributes) => children.push((0, xml_1.renderElement)('param', attributes));
|
|
75
|
+
parameters.forEach(renderParameters);
|
|
76
|
+
return (0, xml_1.renderElement)('resource', {
|
|
77
|
+
type: 'download',
|
|
78
|
+
name,
|
|
79
|
+
location,
|
|
80
|
+
}, children);
|
|
81
|
+
};
|
|
82
|
+
const renderResources = (parameterMap, resources) => {
|
|
83
|
+
return resources
|
|
84
|
+
? resources
|
|
85
|
+
.filter(Boolean)
|
|
86
|
+
// ignore all `.map` files, since the WRM finds them of its own accord.
|
|
87
|
+
.filter((resource) => !resource.location.endsWith('.map'))
|
|
88
|
+
.map((resource) => generateResourceElement(resource, parameterMap))
|
|
89
|
+
: [];
|
|
90
|
+
};
|
|
91
|
+
const renderWebResource = (webresource, descriptors, options) => {
|
|
92
|
+
const { resources = [], externalResources = [], contexts, dependencies, deprecationInfo, conditions, dataProviders, } = webresource;
|
|
93
|
+
const attributes = (0, web_resource_parser_1.parseWebResourceAttributes)(webresource.attributes);
|
|
94
|
+
const allResources = [];
|
|
95
|
+
const children = [];
|
|
96
|
+
const prependPathPrefix = (location) => options.locationPrefix + location;
|
|
97
|
+
// add resources for direct dependencies (e.g., JS and CSS files)
|
|
98
|
+
allResources.push(...resources.map((res) => ({ name: res, location: prependPathPrefix(res) })));
|
|
99
|
+
// add resources for indirect dependencies (e.g., images extracted from CSS)
|
|
100
|
+
allResources.push(...externalResources.map((wr) => ({ name: wr.name, location: prependPathPrefix(wr.location) })));
|
|
101
|
+
children.push(...(0, renderTransformations_1.default)(options.transformationMap, allResources), ...renderContexts(contexts), ...renderDependencies(dependencies), ...renderDeprecationInfo(deprecationInfo, options.pluginKey, descriptors), ...renderResources(options.resourceParamMap, allResources), ...renderDataProviders(dataProviders), (0, renderCondition_1.default)(conditions));
|
|
102
|
+
return (0, xml_1.renderElement)('web-resource', attributes, children);
|
|
103
|
+
};
|
|
104
|
+
exports.renderWebResource = renderWebResource;
|
|
105
|
+
//# sourceMappingURL=web-resource-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-resource-generator.js","sourceRoot":"","sources":["../../src/helpers/web-resource-generator.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAYxB,wEAAgD;AAChD,oFAAuD;AACvD,+DAAmE;AACnE,+BAAsC;AAEtC;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,aAAyC,EAAE,EAAE;IACxE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CACxC,IAAA,mBAAa,EAAC,MAAM,EAAE;QACpB,GAAG,EAAE,YAAY,CAAC,GAAG;QACrB,KAAK,EAAE,YAAY,CAAC,KAAK;KAC1B,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,cAAc,CAAC,QAA8B;IACpD,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACpF,CAAC;AAED,SAAS,kBAAkB,CAAC,YAAkC;IAC5D,OAAO,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAA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B,CAAC,aAAa,CAAC,EACrC,IAAA,yBAAe,EAAC,UAAU,CAAC,CAC5B,CAAC;IAEF,OAAO,IAAA,mBAAa,EAAC,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC7D,CAAC,CAAC;AArCW,QAAA,iBAAiB,qBAqC5B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseWebResourceAttributes = void 0;
|
|
4
|
+
const string_1 = require("./string");
|
|
5
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
6
|
+
const parseWebResourceAttributes = (data) => {
|
|
7
|
+
const attributes = {};
|
|
8
|
+
// Only parse objects.
|
|
9
|
+
if (data && typeof data === 'object') {
|
|
10
|
+
// define the key if a non-empty string was provided
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(data, 'key')) {
|
|
12
|
+
const customKey = (0, string_1.toTrimmedString)(data.key);
|
|
13
|
+
if (customKey) {
|
|
14
|
+
attributes.key = customKey;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// define the state as either enabled or disabled
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(data, 'state')) {
|
|
19
|
+
let isEnabled = true;
|
|
20
|
+
if (typeof data.state === 'boolean') {
|
|
21
|
+
isEnabled = data.state;
|
|
22
|
+
}
|
|
23
|
+
else if (typeof data.state === 'string') {
|
|
24
|
+
isEnabled = data.state !== 'disabled';
|
|
25
|
+
}
|
|
26
|
+
attributes.state = isEnabled ? 'enabled' : 'disabled';
|
|
27
|
+
}
|
|
28
|
+
// define the name if a non-empty string was provided
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(data, 'name')) {
|
|
30
|
+
const customName = (0, string_1.toTrimmedString)(data.name);
|
|
31
|
+
if (customName) {
|
|
32
|
+
attributes.name = customName;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return attributes;
|
|
37
|
+
};
|
|
38
|
+
exports.parseWebResourceAttributes = parseWebResourceAttributes;
|
|
39
|
+
//# sourceMappingURL=web-resource-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-resource-parser.js","sourceRoot":"","sources":["../../src/helpers/web-resource-parser.ts"],"names":[],"mappings":";;;AACA,qCAA2C;AAE3C,wDAAwD;AACjD,MAAM,0BAA0B,GAAG,CAAC,IAAuB,EAAE,EAAE;IACpE,MAAM,UAAU,GAAsB,EAAE,CAAC;IACzC,sBAAsB;IACtB,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACrC,oDAAoD;QACpD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;YACtD,MAAM,SAAS,GAAG,IAAA,wBAAe,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,SAAS,EAAE,CAAC;gBACd,UAAU,CAAC,GAAG,GAAG,SAAS,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,iDAAiD;QACjD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;YACxD,IAAI,SAAS,GAAG,IAAI,CAAC;YACrB,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBACpC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,CAAC;iBAAM,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC1C,SAAS,GAAG,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;YACxC,CAAC;YACD,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;QACxD,CAAC;QAED,qDAAqD;QACrD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;YACvD,MAAM,UAAU,GAAG,IAAA,wBAAe,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9C,IAAI,UAAU,EAAE,CAAC;gBACf,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAjCW,QAAA,0BAA0B,8BAiCrC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type AttributesObject = {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
};
|
|
4
|
+
export declare const stringifyAttributes: (attributes: AttributesObject) => string;
|
|
5
|
+
export declare const renderElement: (name: string, attributes: AttributesObject | string | undefined, children?: string | string[]) => string;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderElement = exports.stringifyAttributes = void 0;
|
|
4
|
+
const stringifyAttributes = (attributes) => {
|
|
5
|
+
if (!attributes) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
return (' ' +
|
|
9
|
+
Object.keys(attributes)
|
|
10
|
+
.map((key) => {
|
|
11
|
+
const val = typeof attributes[key] === 'undefined' ? '' : String(attributes[key]);
|
|
12
|
+
return `${key}="${val}"`;
|
|
13
|
+
})
|
|
14
|
+
.join(' '));
|
|
15
|
+
};
|
|
16
|
+
exports.stringifyAttributes = stringifyAttributes;
|
|
17
|
+
const renderElement = (name, attributes, children) => {
|
|
18
|
+
if (typeof attributes === 'object') {
|
|
19
|
+
attributes = (0, exports.stringifyAttributes)(attributes);
|
|
20
|
+
}
|
|
21
|
+
// avoid outputting 'undefined' when attributes aren't present.
|
|
22
|
+
if (!attributes) {
|
|
23
|
+
attributes = '';
|
|
24
|
+
}
|
|
25
|
+
// convert children array in to a string.
|
|
26
|
+
// assume they are string values already. (todo: refactor for nested rendering?)
|
|
27
|
+
if (Array.isArray(children)) {
|
|
28
|
+
children = children.join('\n');
|
|
29
|
+
}
|
|
30
|
+
// render self-closing tags based on whether there is no child input.
|
|
31
|
+
if (!children) {
|
|
32
|
+
return `<${name}${attributes}/>`;
|
|
33
|
+
}
|
|
34
|
+
return `<${name}${attributes}>${children}</${name}>`;
|
|
35
|
+
};
|
|
36
|
+
exports.renderElement = renderElement;
|
|
37
|
+
//# sourceMappingURL=xml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml.js","sourceRoot":"","sources":["../../src/helpers/xml.ts"],"names":[],"mappings":";;;AAEO,MAAM,mBAAmB,GAAG,CAAC,UAA4B,EAAE,EAAE;IAClE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,CACL,GAAG;QACH,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;aACpB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,MAAM,GAAG,GAAG,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;YAClF,OAAO,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;QAC3B,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B;AAEK,MAAM,aAAa,GAAG,CAC3B,IAAY,EACZ,UAAiD,EACjD,QAA4B,EAC5B,EAAE;IACF,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,UAAU,GAAG,IAAA,2BAAmB,EAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IACD,+DAA+D;IAC/D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,yCAAyC;IACzC,gFAAgF;IAChF,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,qEAAqE;IACrE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,IAAI,GAAG,UAAU,IAAI,CAAC;IACnC,CAAC;IAED,OAAO,IAAI,IAAI,GAAG,UAAU,IAAI,QAAQ,KAAK,IAAI,GAAG,CAAC;AACvD,CAAC,CAAC;AAxBW,QAAA,aAAa,iBAwBxB"}
|
package/dist/logger.d.ts
ADDED
package/dist/logger.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.error = exports.warn = exports.log = exports.setVerbose = void 0;
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
let verbose = false;
|
|
6
|
+
const setVerbose = (arg) => (verbose = arg);
|
|
7
|
+
exports.setVerbose = setVerbose;
|
|
8
|
+
const log = (...args) => {
|
|
9
|
+
if (verbose) {
|
|
10
|
+
console.log(...args);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.log = log;
|
|
14
|
+
const warn = (...args) => {
|
|
15
|
+
if (verbose) {
|
|
16
|
+
console.warn(...args);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.warn = warn;
|
|
20
|
+
const error = (...args) => {
|
|
21
|
+
if (verbose) {
|
|
22
|
+
console.error(...args);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.error = error;
|
|
26
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,IAAI,OAAO,GAAG,KAAK,CAAC;AACb,MAAM,UAAU,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC;AAA/C,QAAA,UAAU,cAAqC;AAErD,MAAM,GAAG,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE;IACxC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC;AAJW,QAAA,GAAG,OAId;AAEK,MAAM,IAAI,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE;IACzC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACxB,CAAC;AACH,CAAC,CAAC;AAJW,QAAA,IAAI,QAIf;AAEK,MAAM,KAAK,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE;IAC1C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC;AACH,CAAC,CAAC;AAJW,QAAA,KAAK,SAIhB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const requireEnsureShim = (pluginKey) => `
|
|
4
|
+
if(installedChunks[chunkId] === 0) { // 0 means "already installed".
|
|
5
|
+
return Promise.resolve();
|
|
6
|
+
}
|
|
7
|
+
if (installedChunks[chunkId]) {
|
|
8
|
+
return installedChunks[chunkId][2];
|
|
9
|
+
}
|
|
10
|
+
promises.push(
|
|
11
|
+
new Promise(function(resolve, reject) {
|
|
12
|
+
installedChunks[chunkId] = [resolve, reject];
|
|
13
|
+
}),
|
|
14
|
+
new Promise(function(resolve, reject) {
|
|
15
|
+
WRM.require('wrc!${pluginKey}:' + chunkId).then(resolve, reject);
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
return installedChunks[chunkId][2] = Promise.all(promises);
|
|
19
|
+
`;
|
|
20
|
+
exports.default = requireEnsureShim;
|
|
21
|
+
//# sourceMappingURL=require-ensure-shim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-ensure-shim.js","sourceRoot":"","sources":["../../src/shims/require-ensure-shim.ts"],"names":[],"mappings":";;AAAA,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC;;;;;;;;;;;;2BAYtB,SAAS;;;;CAInC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Method signature is:
|
|
3
|
+
```
|
|
4
|
+
var inProgress[url] = [done];
|
|
5
|
+
var dataWebpackPrefix = "...";
|
|
6
|
+
// loadScript function to load a script via script tag
|
|
7
|
+
__webpack_require__.l = (url, done, key) => {
|
|
8
|
+
```
|
|
9
|
+
The variables are:
|
|
10
|
+
'done' - callback function
|
|
11
|
+
'key' - should be in the form "chunk-" + chunkId
|
|
12
|
+
*/
|
|
13
|
+
declare const runtimeLoadShim: (pluginKey: string, watchMode: boolean, publicPath: string) => string;
|
|
14
|
+
export default runtimeLoadShim;
|