@ui5/builder 3.0.0-alpha.1 → 3.0.0-alpha.4

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.
@@ -0,0 +1,30 @@
1
+ const ModuleName = require("../../../lbt/utils/ModuleName");
2
+
3
+ /**
4
+ * For "unoptimized" bundles, the non-debug files have already been filtered out above.
5
+ * Now we need to create a mapping from the debug-variant resource path to the respective module
6
+ * name, which is basically the non-debug resource path, minus the "/resources/"" prefix.
7
+ * This mapping overwrites internal logic of the LocatorResourcePool which would otherwise determine
8
+ * the module name from the resource path, which would contain "-dbg" in this case. That would be
9
+ * incorrect since debug-variants should still keep the original module name.
10
+ *
11
+ * @private
12
+ * @param {object} parameters Parameters
13
+ * @param {module:@ui5/fs.Resource[]} parameters.resources List of resources
14
+ * @param {module:@ui5/builder.tasks.TaskUtil|object} parameters.taskUtil TaskUtil
15
+ * @returns {object} Module name mapping
16
+ */
17
+ module.exports = function({resources, taskUtil}) {
18
+ const moduleNameMapping = {};
19
+ for (let i = resources.length - 1; i >= 0; i--) {
20
+ const resourcePath = resources[i].getPath();
21
+ if (taskUtil.getTag(resourcePath, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
22
+ const nonDbgPath = ModuleName.getNonDebugName(resourcePath);
23
+ if (!nonDbgPath) {
24
+ throw new Error(`Failed to resolve non-debug name for ${resourcePath}`);
25
+ }
26
+ moduleNameMapping[resourcePath] = nonDbgPath.slice("/resources/".length);
27
+ }
28
+ }
29
+ return moduleNameMapping;
30
+ };
@@ -105,7 +105,7 @@ function getCreatorOptions(projectName) {
105
105
  module.exports = async function({workspace, dependencies, taskUtil, options: {projectName}}) {
106
106
  let resources = await workspace.byGlob(["/resources/**/*"].concat(DEFAULT_EXCLUDES));
107
107
  let dependencyResources =
108
- await dependencies.byGlob("/resources/**/*.{js,json,xml,html,properties,library}");
108
+ await dependencies.byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
109
109
 
110
110
  if (taskUtil) {
111
111
  // Filter out resources that will be omitted from the build results
@@ -10,17 +10,27 @@ const minifier = require("../processors/minifier");
10
10
  * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
11
11
  * @param {object} parameters.options Options
12
12
  * @param {string} parameters.options.pattern Pattern to locate the files to be processed
13
+ * @param {boolean} [parameters.options.omitSourceMapResources=true] Whether source map resources shall
14
+ * be tagged as "OmitFromBuildResult" and no sourceMappingURL shall be added to the minified resource
13
15
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
14
16
  */
15
- module.exports = async function({workspace, taskUtil, options: {pattern}}) {
17
+ module.exports = async function({workspace, taskUtil, options: {pattern, omitSourceMapResources = true}}) {
16
18
  const resources = await workspace.byGlob(pattern);
17
- const processedResources = await minifier({resources});
19
+ const processedResources = await minifier({
20
+ resources,
21
+ options: {
22
+ addSourceMappingUrl: !omitSourceMapResources
23
+ }
24
+ });
18
25
 
19
26
  return Promise.all(processedResources.map(async ({resource, dbgResource, sourceMapResource}) => {
20
27
  if (taskUtil) {
21
28
  taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
22
29
  taskUtil.setTag(dbgResource, taskUtil.STANDARD_TAGS.IsDebugVariant);
23
- taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
30
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.HasDebugVariant);
31
+ if (omitSourceMapResources) {
32
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
33
+ }
24
34
  }
25
35
  return Promise.all([
26
36
  workspace.write(resource),
@@ -28,7 +28,7 @@ class LibraryBuilder extends AbstractBuilder {
28
28
  workspace: resourceCollections.workspace,
29
29
  options: {
30
30
  copyright: project.metadata.copyright,
31
- pattern: "/resources/**/*.{js,library,less,theme}"
31
+ pattern: "/**/*.{js,library,css,less,theme,html}"
32
32
  }
33
33
  });
34
34
  });
@@ -38,7 +38,7 @@ class LibraryBuilder extends AbstractBuilder {
38
38
  workspace: resourceCollections.workspace,
39
39
  options: {
40
40
  version: project.version,
41
- pattern: "/resources/**/*.{js,json,library,less,theme}"
41
+ pattern: "/**/*.{js,json,library,css,less,theme,html}"
42
42
  }
43
43
  });
44
44
  });
@@ -198,7 +198,8 @@ class LibraryBuilder extends AbstractBuilder {
198
198
  projectName: project.metadata.name,
199
199
  librariesPattern: !taskUtil.isRootProject() ? "/resources/**/(*.library|library.js)" : undefined,
200
200
  themesPattern: !taskUtil.isRootProject() ? "/resources/sap/ui/core/themes/*" : undefined,
201
- inputPattern
201
+ inputPattern,
202
+ cssVariables: taskUtil.getBuildOption("cssVariables")
202
203
  }
203
204
  });
204
205
  });
@@ -31,7 +31,8 @@ class ThemeLibraryBuilder extends AbstractBuilder {
31
31
  projectName: project.metadata.name,
32
32
  librariesPattern: !taskUtil.isRootProject() ? "/resources/**/(*.library|library.js)" : undefined,
33
33
  themesPattern: !taskUtil.isRootProject() ? "/resources/sap/ui/core/themes/*" : undefined,
34
- inputPattern: "/resources/**/themes/*/library.source.less"
34
+ inputPattern: "/resources/**/themes/*/library.source.less",
35
+ cssVariables: taskUtil.getBuildOption("cssVariables")
35
36
  }
36
37
  });
37
38
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.4",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -37,13 +37,14 @@
37
37
  "jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
38
38
  "jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
39
39
  "preversion": "npm test",
40
- "version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
40
+ "version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
41
41
  "postversion": "git push --follow-tags",
42
- "release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
42
+ "release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
43
43
  "depcheck": "depcheck --ignores docdash"
44
44
  },
45
45
  "files": [
46
46
  "index.js",
47
+ "CHANGELOG.md",
47
48
  "CONTRIBUTING.md",
48
49
  "jsdoc.json",
49
50
  "lib/**",
@@ -109,7 +110,7 @@
109
110
  "cheerio": "1.0.0-rc.9",
110
111
  "escape-unicode": "^0.2.0",
111
112
  "escope": "^3.6.0",
112
- "espree": "^9.3.0",
113
+ "espree": "^9.3.1",
113
114
  "globby": "^11.1.0",
114
115
  "graceful-fs": "^4.2.9",
115
116
  "jsdoc": "^3.6.7",
@@ -120,6 +121,7 @@
120
121
  "replacestream": "^4.0.3",
121
122
  "rimraf": "^3.0.2",
122
123
  "semver": "^7.3.5",
124
+ "sourcemap-codec": "^1.4.8",
123
125
  "terser": "^5.10.0",
124
126
  "xml2js": "^0.4.23",
125
127
  "yazl": "^2.5.1"