@ui5/builder 3.0.0-alpha.11 → 3.0.0-alpha.12
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 +18 -2
- package/jsdoc.json +2 -2
- package/lib/lbt/UI5ClientConstants.js +7 -8
- package/lib/lbt/analyzer/ComponentAnalyzer.js +10 -10
- package/lib/lbt/analyzer/FioriElementsAnalyzer.js +9 -9
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +32 -25
- package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +9 -9
- package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +8 -8
- package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +19 -17
- package/lib/lbt/analyzer/analyzeLibraryJS.js +8 -7
- package/lib/lbt/bundle/AutoSplitter.js +10 -11
- package/lib/lbt/bundle/Builder.js +29 -32
- package/lib/lbt/bundle/BundleDefinition.js +1 -5
- package/lib/lbt/bundle/BundleWriter.js +1 -2
- package/lib/lbt/bundle/ResolvedBundleDefinition.js +6 -7
- package/lib/lbt/bundle/Resolver.js +9 -10
- package/lib/lbt/calls/SapUiDefine.js +5 -6
- package/lib/lbt/graph/dependencyGraph.js +3 -4
- package/lib/lbt/graph/dominatorTree.js +3 -3
- package/lib/lbt/graph/topologicalSort.js +3 -3
- package/lib/lbt/resources/LibraryFileAnalyzer.js +5 -8
- package/lib/lbt/resources/LocatorResource.js +2 -2
- package/lib/lbt/resources/LocatorResourcePool.js +3 -3
- package/lib/lbt/resources/ModuleInfo.js +1 -2
- package/lib/lbt/resources/Resource.js +3 -4
- package/lib/lbt/resources/ResourceCollector.js +7 -8
- package/lib/lbt/resources/ResourceFilterList.js +38 -40
- package/lib/lbt/resources/ResourceInfo.js +1 -1
- package/lib/lbt/resources/ResourceInfoList.js +2 -2
- package/lib/lbt/resources/ResourcePool.js +15 -21
- package/lib/lbt/utils/ASTUtils.js +17 -30
- package/lib/lbt/utils/JSTokenizer.js +4 -4
- package/lib/lbt/utils/ModuleName.js +10 -20
- package/lib/lbt/utils/escapePropertiesFile.js +3 -3
- package/lib/lbt/utils/parseUtils.js +4 -10
- package/lib/processors/bootstrapHtmlTransformer.js +15 -7
- package/lib/processors/bundlers/flexChangesBundler.js +16 -8
- package/lib/processors/bundlers/manifestBundler.js +19 -10
- package/lib/processors/bundlers/moduleBundler.js +26 -15
- package/lib/processors/jsdoc/apiIndexGenerator.js +16 -9
- package/lib/processors/jsdoc/jsdocGenerator.js +31 -17
- package/lib/processors/jsdoc/lib/{createIndexFiles.js → createIndexFiles.cjs} +0 -0
- package/lib/processors/jsdoc/lib/{transformApiJson.js → transformApiJson.cjs} +0 -0
- package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +0 -0
- package/lib/processors/jsdoc/lib/ui5/template/{publish.js → publish.cjs} +1 -1
- package/lib/processors/jsdoc/lib/ui5/template/utils/{versionUtil.js → versionUtil.cjs} +0 -0
- package/lib/processors/jsdoc/sdkTransformer.js +18 -11
- package/lib/processors/libraryLessGenerator.js +28 -16
- package/lib/processors/manifestCreator.js +14 -13
- package/lib/processors/minifier.js +21 -15
- package/lib/processors/nonAsciiEscaper.js +16 -6
- package/lib/processors/resourceListCreator.js +13 -13
- package/lib/processors/stringReplacer.js +13 -6
- package/lib/processors/themeBuilder.js +30 -22
- package/lib/processors/versionInfoGenerator.js +33 -23
- package/lib/tasks/buildThemes.js +17 -10
- package/lib/tasks/bundlers/generateBundle.js +23 -12
- package/lib/tasks/bundlers/generateComponentPreload.js +18 -10
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +16 -8
- package/lib/tasks/bundlers/generateLibraryPreload.js +22 -12
- package/lib/tasks/bundlers/generateManifestBundle.js +15 -6
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +21 -13
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +6 -6
- package/lib/tasks/escapeNonAsciiCharacters.js +12 -5
- package/lib/tasks/generateCachebusterInfo.js +16 -8
- package/lib/tasks/generateLibraryManifest.js +14 -8
- package/lib/tasks/generateResourcesJson.js +15 -9
- package/lib/tasks/generateThemeDesignerResources.js +19 -9
- package/lib/tasks/generateVersionInfo.js +12 -5
- package/lib/tasks/jsdoc/executeJsdocSdkTransformation.js +17 -9
- package/lib/tasks/jsdoc/generateApiIndex.js +16 -10
- package/lib/tasks/jsdoc/generateJsdoc.js +131 -119
- package/lib/tasks/minify.js +13 -6
- package/lib/tasks/replaceBuildtime.js +12 -5
- package/lib/tasks/replaceCopyright.js +12 -5
- package/lib/tasks/replaceVersion.js +12 -5
- package/lib/tasks/taskRepository.js +24 -29
- package/lib/tasks/transformBootstrapHtml.js +6 -5
- package/package.json +29 -15
- package/index.js +0 -173
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/* eslint quotes: ["error", "double", { "allowTemplateLiterals": true }] */
|
|
2
2
|
// for consistency of write calls, we generally allow template literals
|
|
3
|
-
"use strict";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import {pd} from "pretty-data";
|
|
6
|
+
import {parseJS, Syntax} from "../utils/parseUtils.js";
|
|
7
|
+
import {encode as encodeMappings, decode as decodeMappings} from "@jridgewell/sourcemap-codec";
|
|
8
|
+
import {isMethodCall} from "../utils/ASTUtils.js";
|
|
9
|
+
import {toUI5LegacyName, toRequireJSName} from "../utils/ModuleName.js";
|
|
10
|
+
import {
|
|
11
|
+
MODULE__UI5LOADER, MODULE__UI5LOADER_AUTOCONFIG,
|
|
12
|
+
MODULE__JQUERY_SAP_GLOBAL, MODULE__SAP_UI_CORE_CORE} from "../UI5ClientConstants.js";
|
|
13
|
+
import escapePropertiesFile from "../utils/escapePropertiesFile.js";
|
|
14
|
+
import BundleResolver from "./Resolver.js";
|
|
15
|
+
import BundleSplitter from "./AutoSplitter.js";
|
|
16
|
+
import {SectionType} from "./BundleDefinition.js";
|
|
17
|
+
import BundleWriter from "./BundleWriter.js";
|
|
18
|
+
import logger from "@ui5/logger";
|
|
19
|
+
const log = logger.getLogger("lbt:bundle:Builder");
|
|
20
20
|
|
|
21
21
|
const sourceMappingUrlPattern = /\/\/# sourceMappingURL=(.+)\s*$/;
|
|
22
22
|
const httpPattern = /^https?:\/\//i;
|
|
@@ -63,14 +63,14 @@ const EVOBundleFormat = {
|
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
requireSync(moduleName) {
|
|
66
|
-
return `sap.ui.requireSync("${
|
|
66
|
+
return `sap.ui.requireSync("${toRequireJSName(moduleName)}");\n`;
|
|
67
67
|
},
|
|
68
68
|
|
|
69
69
|
shouldDecorate(resolvedModule) {
|
|
70
|
-
return resolvedModule.executes(
|
|
71
|
-
resolvedModule.executes(
|
|
72
|
-
resolvedModule.executes(
|
|
73
|
-
resolvedModule.executes(
|
|
70
|
+
return resolvedModule.executes(MODULE__UI5LOADER) ||
|
|
71
|
+
resolvedModule.executes(MODULE__UI5LOADER_AUTOCONFIG) ||
|
|
72
|
+
resolvedModule.executes(MODULE__JQUERY_SAP_GLOBAL) ||
|
|
73
|
+
resolvedModule.executes(MODULE__SAP_UI_CORE_CORE);
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
|
|
@@ -232,11 +232,11 @@ class BundleBuilder {
|
|
|
232
232
|
/* NODE-TODO, moduleName is not defined
|
|
233
233
|
It should contain the name of the module which is currently build (1st parameter of _createBundle).
|
|
234
234
|
But when the ui5loader is present, declareRawModules should be forced to false anyhow.
|
|
235
|
-
this.outW.writeln("jQuery.sap.declare('",
|
|
235
|
+
this.outW.writeln("jQuery.sap.declare('", toUI5LegacyName(moduleName), "');");
|
|
236
236
|
*/
|
|
237
237
|
this.missingRawDeclarations.forEach( (module) => {
|
|
238
238
|
// 2nd parameter set to 'false': do not create namespaces - they nevertheless would come too late
|
|
239
|
-
this.outW.writeln(`jQuery.sap.declare('${
|
|
239
|
+
this.outW.writeln(`jQuery.sap.declare('${toUI5LegacyName(module)}', false);`);
|
|
240
240
|
});
|
|
241
241
|
this.missingRawDeclarations = [];
|
|
242
242
|
}
|
|
@@ -258,7 +258,7 @@ class BundleBuilder {
|
|
|
258
258
|
if ( section.declareRawModules ) {
|
|
259
259
|
this.missingRawDeclarations.push(moduleName);
|
|
260
260
|
}
|
|
261
|
-
if ( moduleName ===
|
|
261
|
+
if ( moduleName === MODULE__JQUERY_SAP_GLOBAL ) {
|
|
262
262
|
this.jqglobalAvailable = true;
|
|
263
263
|
}
|
|
264
264
|
} else {
|
|
@@ -413,7 +413,7 @@ class BundleBuilder {
|
|
|
413
413
|
*
|
|
414
414
|
* @param {string} moduleName module name
|
|
415
415
|
* @param {ModuleInfo} info
|
|
416
|
-
* @param {
|
|
416
|
+
* @param {@ui5/fs/Resource} resource
|
|
417
417
|
* @returns {Promise<boolean>}
|
|
418
418
|
*/
|
|
419
419
|
async writePreloadModule(moduleName, info, resource) {
|
|
@@ -649,7 +649,7 @@ async function rewriteDefine({moduleName, moduleContent, moduleSourceMap}) {
|
|
|
649
649
|
// Inject module name if missing
|
|
650
650
|
if ( defineCall.arguments.length == 0 ||
|
|
651
651
|
![Syntax.Literal, Syntax.TemplateLiteral].includes(defineCall.arguments[0].type)) {
|
|
652
|
-
let value = `"${
|
|
652
|
+
let value = `"${toRequireJSName(moduleName)}"`;
|
|
653
653
|
let index;
|
|
654
654
|
|
|
655
655
|
if (defineCall.arguments.length == 0) {
|
|
@@ -773,10 +773,7 @@ function createTransientSourceMap({moduleName, moduleContent, includeContent = f
|
|
|
773
773
|
return sourceMap;
|
|
774
774
|
}
|
|
775
775
|
|
|
776
|
-
|
|
776
|
+
export default BundleBuilder;
|
|
777
777
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
if (process.env.NODE_ENV === "test") {
|
|
781
|
-
module.exports.__localFunctions__ = {rewriteDefine, createTransientSourceMap};
|
|
782
|
-
}
|
|
778
|
+
export const __localFunctions__ = (process.env.NODE_ENV === "test") ?
|
|
779
|
+
{rewriteDefine, createTransientSourceMap} : undefined;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const SectionType = {
|
|
1
|
+
export const SectionType = {
|
|
4
2
|
/**
|
|
5
3
|
* The modules are assumed to exist already in the loading environment.
|
|
6
4
|
*/
|
|
@@ -31,5 +29,3 @@ const SectionType = {
|
|
|
31
29
|
*/
|
|
32
30
|
Require: "require"
|
|
33
31
|
};
|
|
34
|
-
|
|
35
|
-
module.exports.SectionType = SectionType;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {MODULE__JQUERY_SAP_GLOBAL, MODULE__SAP_UI_CORE_CORE} from "../UI5ClientConstants.js";
|
|
3
|
+
import ModuleInfo from "../resources/ModuleInfo.js";
|
|
4
|
+
import {SectionType} from "./BundleDefinition.js";
|
|
6
5
|
|
|
7
6
|
class ResolvedBundleDefinition {
|
|
8
7
|
constructor( bundleDefinition /* , vars*/) {
|
|
@@ -18,7 +17,7 @@ class ResolvedBundleDefinition {
|
|
|
18
17
|
return this.sections.some(
|
|
19
18
|
(section) =>
|
|
20
19
|
(section.mode === SectionType.Raw || section.mode === SectionType.Require) &&
|
|
21
|
-
section.modules.some((module) => module ===
|
|
20
|
+
section.modules.some((module) => module === MODULE__SAP_UI_CORE_CORE)
|
|
22
21
|
);
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -26,7 +25,7 @@ class ResolvedBundleDefinition {
|
|
|
26
25
|
return this.sections.some(
|
|
27
26
|
(section) =>
|
|
28
27
|
section.mode === SectionType.Raw &&
|
|
29
|
-
section.modules.some((module) => module ===
|
|
28
|
+
section.modules.some((module) => module === MODULE__JQUERY_SAP_GLOBAL)
|
|
30
29
|
);
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -108,4 +107,4 @@ class ResolvedSection {
|
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
export default ResolvedBundleDefinition;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Takes a bundle definition and resolves it against the given pool.
|
|
3
3
|
*/
|
|
4
|
-
"use strict";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const log =
|
|
5
|
+
import topologicalSort from "../graph/topologicalSort.js";
|
|
6
|
+
import {getRendererName} from "../UI5ClientConstants.js";
|
|
7
|
+
import ResourceFilterList from "../resources/ResourceFilterList.js";
|
|
8
|
+
import {SectionType} from "./BundleDefinition.js";
|
|
9
|
+
import ResolvedBundleDefinition from "./ResolvedBundleDefinition.js";
|
|
10
|
+
import logger from "@ui5/logger";
|
|
11
|
+
const log = logger.getLogger("lbt:bundle:Resolver");
|
|
13
12
|
|
|
14
13
|
let dependencyTracker;
|
|
15
14
|
|
|
@@ -144,7 +143,7 @@ class BundleResolver {
|
|
|
144
143
|
|
|
145
144
|
// add renderer, if 'renderer' is configured and if it exists
|
|
146
145
|
if ( section.renderer ) {
|
|
147
|
-
const rendererModuleName =
|
|
146
|
+
const rendererModuleName = getRendererName( resourceName );
|
|
148
147
|
promises.push( checkAndAddResource( rendererModuleName, depth + 1) );
|
|
149
148
|
}
|
|
150
149
|
}
|
|
@@ -324,5 +323,5 @@ class BundleResolver {
|
|
|
324
323
|
}
|
|
325
324
|
|
|
326
325
|
|
|
327
|
-
|
|
326
|
+
export default BundleResolver;
|
|
328
327
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {Syntax} from "../utils/parseUtils.js";
|
|
3
|
+
import {resolveRelativeRequireJSName} from "../utils/ModuleName.js";
|
|
4
|
+
import {isBoolean, getStringValue} from "../utils/ASTUtils.js";
|
|
6
5
|
|
|
7
6
|
class SapUiDefineCall {
|
|
8
7
|
constructor(node, moduleName) {
|
|
@@ -42,7 +41,7 @@ class SapUiDefineCall {
|
|
|
42
41
|
if ( !value ) {
|
|
43
42
|
throw new TypeError();
|
|
44
43
|
}
|
|
45
|
-
return
|
|
44
|
+
return resolveRelativeRequireJSName(this.name, value);
|
|
46
45
|
});
|
|
47
46
|
this.dependencyInsertionIdx = this.dependencyArray.elements.length;
|
|
48
47
|
}
|
|
@@ -94,4 +93,4 @@ class SapUiDefineCall {
|
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
export default SapUiDefineCall;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const log = require("@ui5/logger").getLogger("lbt:graph:dependencyGraph");
|
|
1
|
+
import logger from "@ui5/logger";
|
|
2
|
+
const log = logger.getLogger("lbt:graph:dependencyGraph");
|
|
4
3
|
|
|
5
4
|
class Node {
|
|
6
5
|
constructor(name) {
|
|
@@ -64,7 +63,7 @@ async function createDependencyGraph(pool, roots, options) {
|
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
export default createDependencyGraph;
|
|
68
67
|
|
|
69
68
|
// TODO introduce class Graph
|
|
70
69
|
// TODO remove n0 here, only introduce it in dominator tree (using the Graph API)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import logger from "@ui5/logger";
|
|
2
|
+
const log = logger.getLogger("lbt:graph:dominatorTree");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Creates a dependency graph starting from the given set of root modules.
|
|
@@ -16,7 +17,6 @@
|
|
|
16
17
|
* @private
|
|
17
18
|
*/
|
|
18
19
|
function calculateDominatorTree({n0, nodes}) {
|
|
19
|
-
const log = require("@ui5/logger").getLogger("lbt:graph:dominatorTree");
|
|
20
20
|
// initialize set of dominators for each node
|
|
21
21
|
for ( const n of nodes.values() ) {
|
|
22
22
|
if ( n === n0 ) {
|
|
@@ -113,4 +113,4 @@ function calculateDominatorTree({n0, nodes}) {
|
|
|
113
113
|
return n0;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
export default calculateDominatorTree;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
import logger from "@ui5/logger";
|
|
3
|
+
const log = logger.getLogger("lbt:graph:topologicalSort");
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a module and its dependencies in a dependency graph.
|
|
@@ -186,4 +186,4 @@ function topologicalSort(pool, moduleNames) {
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
export default topologicalSort;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Used by the ResourcePool to read raw module info as stored in the .
|
|
2
|
+
* Used by the ResourcePool to read raw module info as stored in the .library files.
|
|
3
3
|
* It does not (yet) analyze dependencies of the library and therefore isn't part of the analyzer package (yet).
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const log = require("@ui5/logger").getLogger("lbt:resources:LibraryFileAnalyzer");
|
|
5
|
+
import xml2js from "xml2js";
|
|
6
|
+
import logger from "@ui5/logger";
|
|
7
|
+
const log = logger.getLogger("lbt:resources:LibraryFileAnalyzer");
|
|
9
8
|
|
|
10
9
|
const parser = new xml2js.Parser({
|
|
11
10
|
// explicitChildren: true,
|
|
@@ -49,7 +48,7 @@ function createRawInfo(rawModule) {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
function getDependencyInfos( name, content ) {
|
|
51
|
+
export function getDependencyInfos( name, content ) {
|
|
53
52
|
const infos = {};
|
|
54
53
|
parser.parseString(content, (err, result) => {
|
|
55
54
|
if ( result &&
|
|
@@ -77,5 +76,3 @@ function getDependencyInfos( name, content ) {
|
|
|
77
76
|
// console.log("done", infos);
|
|
78
77
|
return infos;
|
|
79
78
|
}
|
|
80
|
-
|
|
81
|
-
module.exports.getDependencyInfos = getDependencyInfos;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Resource from "./Resource.js";
|
|
2
2
|
|
|
3
3
|
class LocatorResource extends Resource {
|
|
4
4
|
constructor(pool, resource, moduleName) {
|
|
@@ -19,4 +19,4 @@ class LocatorResource extends Resource {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
export default LocatorResource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import ResourcePool from "./ResourcePool.js";
|
|
2
|
+
import LocatorResource from "./LocatorResource.js";
|
|
3
3
|
|
|
4
4
|
class LocatorResourcePool extends ResourcePool {
|
|
5
5
|
prepare(resources, moduleNameMapping) {
|
|
@@ -16,4 +16,4 @@ class LocatorResourcePool extends ResourcePool {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
export default LocatorResourcePool;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {promisify} from "node:util";
|
|
3
|
+
import fs from "graceful-fs";
|
|
5
4
|
const readFile = promisify(fs.readFile);
|
|
6
5
|
|
|
7
6
|
class Resource {
|
|
@@ -27,4 +26,4 @@ class Resource {
|
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
export default Resource;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import ResourceInfoList from "./ResourceInfoList.js";
|
|
2
|
+
import ResourceFilterList from "./ResourceFilterList.js";
|
|
3
|
+
import ResourceInfo from "./ResourceInfo.js";
|
|
4
|
+
import logger from "@ui5/logger";
|
|
5
|
+
const log = logger.getLogger("lbt:resources:ResourceCollector");
|
|
5
6
|
|
|
6
7
|
const LOCALE = /^((?:[^/]+\/)*[^/]+?)_([A-Z]{2}(?:_[A-Z]{2}(?:_[A-Z0-9_]+)?)?)(\.properties|\.hdbtextbundle)$/i;
|
|
7
8
|
const THEME = /^((?:[^/]+\/)*)themes\/([^/]+)\//;
|
|
8
9
|
|
|
9
|
-
const log = require("@ui5/logger").getLogger("lbt:resources:ResourceCollector");
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Collects all resources in a set of resource folders or from an archive
|
|
13
12
|
* and writes a 'resources.json' file for each component or library
|
|
@@ -76,7 +75,7 @@ class ResourceCollector {
|
|
|
76
75
|
/**
|
|
77
76
|
* Processes a resource
|
|
78
77
|
*
|
|
79
|
-
* @param {
|
|
78
|
+
* @param {@ui5/fs/Resource} resource
|
|
80
79
|
*/
|
|
81
80
|
async visitResource(resource) {
|
|
82
81
|
const virPath = resource.getPath();
|
|
@@ -400,4 +399,4 @@ class ResourceCollector {
|
|
|
400
399
|
}
|
|
401
400
|
}
|
|
402
401
|
|
|
403
|
-
|
|
402
|
+
export default ResourceCollector;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
import logger from "@ui5/logger";
|
|
3
|
+
const log = logger.getLogger("lbt:resources:ResourceFilterList");
|
|
4
4
|
|
|
5
5
|
const FILTER_PREFIXES = /^[-!+]/;
|
|
6
6
|
|
|
@@ -95,7 +95,7 @@ function makeMatcher(globPattern, fileTypesPattern) {
|
|
|
95
95
|
* @since 1.16.2
|
|
96
96
|
* @private
|
|
97
97
|
*/
|
|
98
|
-
class ResourceFilterList {
|
|
98
|
+
export default class ResourceFilterList {
|
|
99
99
|
constructor(filters, fileTypes) {
|
|
100
100
|
this.matchers = [];
|
|
101
101
|
this.matchByDefault = true;
|
|
@@ -127,43 +127,43 @@ class ResourceFilterList {
|
|
|
127
127
|
toString() {
|
|
128
128
|
return this.matchers.map((matcher) => matcher.pattern).join(",");
|
|
129
129
|
}
|
|
130
|
-
}
|
|
131
130
|
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Each filter entry can be a comma separated list of simple filters. Each simple filter
|
|
133
|
+
* can be a pattern in resource name pattern syntax: A double asterisk '&0x2a;&0x2a;/' denotes an arbitrary
|
|
134
|
+
* number of resource name segments (folders) incl. a trailing slash, whereas a simple asterisk '*'
|
|
135
|
+
* denotes an arbitrary number of resource name characters, but not the segment separator '/'.
|
|
136
|
+
* A dot is interpreted as a dot, all other special regular expression characters keep their
|
|
137
|
+
* special meaning. This is a mixture of ANT-style path patterns and regular expressions.
|
|
138
|
+
*
|
|
139
|
+
* Excludes can be denoted by a leading '-' or '!', includes optionally by a leading '+'.
|
|
140
|
+
* Order of filters is significant, a later exclusion overrides an earlier inclusion
|
|
141
|
+
* and vice versa.
|
|
142
|
+
*
|
|
143
|
+
* Example:
|
|
144
|
+
* <pre>
|
|
145
|
+
* !sap/ui/core/
|
|
146
|
+
* +sap/ui/core/utils/
|
|
147
|
+
* </pre>
|
|
148
|
+
* excludes everything from sap/ui/core, but includes everything from the subpackage sap/ui/core/utils/.
|
|
149
|
+
*
|
|
150
|
+
* Note that the filter operates on the full name of each resource. If a resource name
|
|
151
|
+
* <code>prefix</code> is configured for a resource set, the filter will be applied
|
|
152
|
+
* to the combination of prefix and local file path and not only to the local file path.
|
|
153
|
+
*
|
|
154
|
+
* @param {string} filterStr comma separated list of simple filters
|
|
155
|
+
* @returns {ResourceFilterList}
|
|
156
|
+
*/
|
|
157
|
+
static fromString(filterStr) {
|
|
158
|
+
const result = new ResourceFilterList();
|
|
159
|
+
if ( filterStr != null ) {
|
|
160
|
+
result.addFilters( filterStr.trim().split(/\s*,\s*/).filter(Boolean) );
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
162
163
|
}
|
|
163
|
-
|
|
164
|
-
};
|
|
164
|
+
}
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
export function negateFilters(patterns) {
|
|
167
167
|
return patterns.map((pattern) => {
|
|
168
168
|
let include = true;
|
|
169
169
|
|
|
@@ -181,6 +181,4 @@ ResourceFilterList.negateFilters = function(patterns) {
|
|
|
181
181
|
return "+" + pattern;
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
module.exports = ResourceFilterList;
|
|
184
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import ResourceInfo from "./ResourceInfo.js";
|
|
2
2
|
|
|
3
3
|
const DEBUG_RESOURCES_PATTERN = /-dbg((?:\.view|\.fragment|\.controller|\.designtime|\.support)?\.js|\.css)$/;
|
|
4
4
|
|
|
@@ -114,4 +114,4 @@ class ResourceInfoList {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
export default ResourceInfoList;
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const XMLTemplateAnalyzer = require("../analyzer/XMLTemplateAnalyzer");
|
|
14
|
-
|
|
15
|
-
const LibraryFileAnalyzer = require("./LibraryFileAnalyzer");
|
|
16
|
-
const ModuleInfo = require("./ModuleInfo");
|
|
17
|
-
const ResourceFilterList = require("./ResourceFilterList");
|
|
1
|
+
import {parseJS} from "../utils/parseUtils.js";
|
|
2
|
+
import ComponentAnalyzer from "../analyzer/ComponentAnalyzer.js";
|
|
3
|
+
import SmartTemplateAnalyzer from "../analyzer/SmartTemplateAnalyzer.js";
|
|
4
|
+
import FioriElementsAnalyzer from "../analyzer/FioriElementsAnalyzer.js";
|
|
5
|
+
import XMLCompositeAnalyzer from "../analyzer/XMLCompositeAnalyzer.js";
|
|
6
|
+
import JSModuleAnalyzer from "../analyzer/JSModuleAnalyzer.js";
|
|
7
|
+
import XMLTemplateAnalyzer from "../analyzer/XMLTemplateAnalyzer.js";
|
|
8
|
+
import {getDependencyInfos} from "./LibraryFileAnalyzer.js";
|
|
9
|
+
import ModuleInfo from "./ModuleInfo.js";
|
|
10
|
+
import ResourceFilterList from "./ResourceFilterList.js";
|
|
11
|
+
import logger from "@ui5/logger";
|
|
12
|
+
const log = logger.getLogger("lbt:resources:ResourcePool");
|
|
18
13
|
/*
|
|
19
|
-
|
|
14
|
+
import Resource from "./Resource";
|
|
20
15
|
*/
|
|
21
|
-
const log = require("@ui5/logger").getLogger("lbt:resources:ResourcePool");
|
|
22
16
|
|
|
23
17
|
const jsAnalyzer = new JSModuleAnalyzer();
|
|
24
18
|
|
|
@@ -165,7 +159,7 @@ class ResourcePool {
|
|
|
165
159
|
if ( /\.library$/.test(resource.name) ) {
|
|
166
160
|
// read raw-module info from .library files
|
|
167
161
|
return resource.buffer().then( (buffer) => {
|
|
168
|
-
const infos =
|
|
162
|
+
const infos = getDependencyInfos( resource.name, buffer );
|
|
169
163
|
for ( const name of Object.keys(infos) ) {
|
|
170
164
|
this._rawModuleInfos.set(name, infos[name]);
|
|
171
165
|
}
|
|
@@ -238,5 +232,5 @@ class ResourcePool {
|
|
|
238
232
|
}
|
|
239
233
|
}
|
|
240
234
|
|
|
241
|
-
|
|
235
|
+
export default ResourcePool;
|
|
242
236
|
|