@servicetitan/startup 26.1.0 → 26.3.0
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/__mocks__/create-package.js +9 -3
- package/dist/__mocks__/create-package.js.map +1 -1
- package/dist/cli/commands/build.js +34 -45
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.js +17 -28
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/eslint.js +3 -14
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/get-command.js +1 -2
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/get-user-commands.d.ts.map +1 -1
- package/dist/cli/commands/get-user-commands.js +1 -2
- package/dist/cli/commands/get-user-commands.js.map +1 -1
- package/dist/cli/commands/init.js +16 -29
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.js +6 -17
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +25 -40
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.js +59 -81
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +95 -110
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/prepare-package.js +10 -21
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/start.js +50 -61
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/styles-check.js +19 -30
- package/dist/cli/commands/styles-check.js.map +1 -1
- package/dist/cli/commands/tests.js +7 -18
- package/dist/cli/commands/tests.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/assets-copy.js +12 -26
- package/dist/cli/utils/assets-copy.js.map +1 -1
- package/dist/cli/utils/bundle.js +87 -118
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-npm.js +18 -38
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/cli-os.d.ts +0 -1
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/compile-less.js +7 -19
- package/dist/cli/utils/compile-less.js.map +1 -1
- package/dist/cli/utils/compile-sass.js +5 -17
- package/dist/cli/utils/compile-sass.js.map +1 -1
- package/dist/cli/utils/eslint.js +33 -50
- package/dist/cli/utils/eslint.js.map +1 -1
- package/dist/cli/utils/get-module-type.js +1 -2
- package/dist/cli/utils/get-module-type.js.map +1 -1
- package/dist/cli/utils/is-module-installed.js +1 -2
- package/dist/cli/utils/is-module-installed.js.map +1 -1
- package/dist/cli/utils/lerna-exec.js +12 -24
- package/dist/cli/utils/lerna-exec.js.map +1 -1
- package/dist/cli/utils/maybe-create-git-folder.js +1 -2
- package/dist/cli/utils/maybe-create-git-folder.js.map +1 -1
- package/dist/cli/utils/set-node-options.js +1 -2
- package/dist/cli/utils/set-node-options.js.map +1 -1
- package/dist/cli/utils/styles-copy.js +12 -26
- package/dist/cli/utils/styles-copy.js.map +1 -1
- package/dist/cli/utils/tcm.js +42 -60
- package/dist/cli/utils/tcm.js.map +1 -1
- package/dist/cli/utils/tsc.js +10 -22
- package/dist/cli/utils/tsc.js.map +1 -1
- package/dist/jest/index.js +1 -2
- package/dist/jest/index.js.map +1 -1
- package/dist/utils/debug.js +1 -2
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/find-packages.js +2 -3
- package/dist/utils/find-packages.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +9 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +21 -29
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-destination-folders.js +1 -2
- package/dist/utils/get-destination-folders.js.map +1 -1
- package/dist/utils/get-folders.js +1 -2
- package/dist/utils/get-folders.js.map +1 -1
- package/dist/utils/get-jest-config.d.ts.map +1 -1
- package/dist/utils/get-jest-config.js +23 -21
- package/dist/utils/get-jest-config.js.map +1 -1
- package/dist/utils/get-package-data.js +6 -4
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-package-name.js +1 -2
- package/dist/utils/get-package-name.js.map +1 -1
- package/dist/utils/get-packages.js +4 -4
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/get-startup-version.js +1 -2
- package/dist/utils/get-startup-version.js.map +1 -1
- package/dist/utils/get-tsconfig.js +1 -2
- package/dist/utils/get-tsconfig.js.map +1 -1
- package/dist/utils/load-shared-dependencies.js +7 -5
- package/dist/utils/load-shared-dependencies.js.map +1 -1
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/log.d.ts.map +1 -1
- package/dist/utils/log.js +2 -2
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/pick.js +1 -2
- package/dist/utils/pick.js.map +1 -1
- package/dist/utils/read-json.js +2 -3
- package/dist/utils/read-json.js.map +1 -1
- package/dist/utils/to-array.js +1 -2
- package/dist/utils/to-array.js.map +1 -1
- package/dist/webpack/__mocks__/style-rules.js +6 -6
- package/dist/webpack/__mocks__/style-rules.js.map +1 -1
- package/dist/webpack/configs/amd-config.js +1 -2
- package/dist/webpack/configs/amd-config.js.map +1 -1
- package/dist/webpack/configs/cache-config.js +1 -2
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +11 -5
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.js +1 -2
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.js +1 -2
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.js +1 -2
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.js +6 -3
- package/dist/webpack/configs/loaders/css-loader.js.map +1 -1
- package/dist/webpack/configs/loaders/less-loader.js +1 -2
- package/dist/webpack/configs/loaders/less-loader.js.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.js +1 -2
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.js +2 -3
- package/dist/webpack/configs/module-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +79 -48
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.js +6 -3
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +1 -2
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +1 -2
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +1 -2
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js +1 -2
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +1 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +17 -13
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +1 -2
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +1 -2
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js +1 -2
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +5 -3
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js +1 -2
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/provide-react-plugin.js +1 -2
- package/dist/webpack/configs/plugins/provide-react-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ts-checker-plugin.js +1 -2
- package/dist/webpack/configs/plugins/ts-checker-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +1 -2
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.js +1 -2
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/resolve-config.js +1 -2
- package/dist/webpack/configs/resolve-config.js.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +1 -2
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js +1 -2
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js +1 -2
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/configs/rules/js-rules.js +1 -2
- package/dist/webpack/configs/rules/js-rules.js.map +1 -1
- package/dist/webpack/configs/rules/less-rules.js +1 -2
- package/dist/webpack/configs/rules/less-rules.js.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.js +1 -2
- package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.js +1 -2
- package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
- package/dist/webpack/configs/rules/tsx-rules.js +1 -2
- package/dist/webpack/configs/rules/tsx-rules.js.map +1 -1
- package/dist/webpack/configs/rules-config.js +1 -2
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.js +1 -2
- package/dist/webpack/configs/stats-config.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +2 -1
- package/dist/webpack/configs/types.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.js +2 -3
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
- package/dist/webpack/configs/utils/get-web-components-version.js +1 -2
- package/dist/webpack/configs/utils/get-web-components-version.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +26 -6
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/contextify-request.js +1 -2
- package/dist/webpack/loaders/expose-loader/utils/contextify-request.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js +1 -2
- package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/stringify-request.js +1 -2
- package/dist/webpack/loaders/expose-loader/utils/stringify-request.js.map +1 -1
- package/dist/webpack/utils/bundle.js +1 -2
- package/dist/webpack/utils/bundle.js.map +1 -1
- package/dist/webpack/utils/feature-cohort.js +1 -2
- package/dist/webpack/utils/feature-cohort.js.map +1 -1
- package/dist/webpack/utils/get-caller-filename.js +1 -2
- package/dist/webpack/utils/get-caller-filename.js.map +1 -1
- package/dist/webpack/utils/hash-mod.js +1 -2
- package/dist/webpack/utils/hash-mod.js.map +1 -1
- package/dist/webpack/utils/split-by-entry.d.ts.map +1 -1
- package/dist/webpack/utils/split-by-entry.js +1 -2
- package/dist/webpack/utils/split-by-entry.js.map +1 -1
- package/dist/webpack/utils/testing/compile.js +1 -2
- package/dist/webpack/utils/testing/compile.js.map +1 -1
- package/dist/webpack/utils/testing/execute.js +1 -2
- package/dist/webpack/utils/testing/execute.js.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.js +1 -2
- package/dist/webpack/utils/testing/get-compiler.js.map +1 -1
- package/dist/webpack/utils/testing/get-errors.js +1 -2
- package/dist/webpack/utils/testing/get-errors.js.map +1 -1
- package/dist/webpack/utils/testing/get-module-source.d.ts +0 -1
- package/dist/webpack/utils/testing/get-module-source.d.ts.map +1 -1
- package/dist/webpack/utils/testing/get-module-source.js +1 -2
- package/dist/webpack/utils/testing/get-module-source.js.map +1 -1
- package/dist/webpack/utils/testing/get-warnings.js +1 -2
- package/dist/webpack/utils/testing/get-warnings.js.map +1 -1
- package/dist/webpack/utils/testing/index.js +1 -2
- package/dist/webpack/utils/testing/index.js.map +1 -1
- package/dist/webpack/utils/testing/normalize-errors.js +1 -2
- package/dist/webpack/utils/testing/normalize-errors.js.map +1 -1
- package/dist/webpack/utils/testing/read-asset.js +1 -2
- package/dist/webpack/utils/testing/read-asset.js.map +1 -1
- package/dist/webpack/utils/testing/read-assets.js +1 -2
- package/dist/webpack/utils/testing/read-assets.js.map +1 -1
- package/package.json +6 -5
- package/src/utils/get-configuration.ts +18 -21
- package/src/webpack/__tests__/create-webpack-config.test.ts +40 -0
- package/src/webpack/configs/optimization-config.ts +88 -48
- package/src/webpack/configs/types.ts +2 -1
- package/src/webpack/create-webpack-config.ts +11 -3
- package/tsconfig/base.json +1 -1
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCompilerFactory =
|
|
6
|
+
exports.getCompilerFactory = getCompilerFactory;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const webpack_1 = __importDefault(require("webpack"));
|
|
9
9
|
const webpack_merge_1 = require("webpack-merge");
|
|
@@ -40,5 +40,4 @@ function getCompilerFactory(cwd) {
|
|
|
40
40
|
return compiler;
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
exports.getCompilerFactory = getCompilerFactory;
|
|
44
43
|
//# sourceMappingURL=get-compiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compiler.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-compiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-compiler.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-compiler.ts"],"names":[],"mappings":";;;;;AAOA,gDAqCC;AA5CD,gDAAwB;AAExB,sDAAiD;AACjD,iDAAsC;AAEtC,iCAAmD;AAEnD,SAAgB,kBAAkB,CAAC,GAAW;IAC1C,OAAO,SAAS,WAAW,CAAC,KAAa,EAAE,aAAa,GAAG,EAAE,EAAE,SAAwB,EAAE;;QACrF,MAAM,QAAQ,GAAG,IAAA,iBAAO,EACpB,IAAA,qBAAK,EACD;YACI,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,MAAA,MAAM,CAAC,OAAO,mCAAI,KAAK;YAChC,OAAO,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,uBAAuB,CAAC;YACnD,KAAK,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,uBAAuB,EAAE,KAAK,CAAC;YACxD,MAAM,EAAE;gBACJ,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAkB,CAAC;gBAC3C,QAAQ,EAAE,kBAAkB;gBAC5B,aAAa,EAAE,iBAAiB;aACnC;YACD,MAAM,EAAE;gBACJ,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,IAAI,MAAM,CAAC,MAAM,cAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC;wBACzD,KAAK,EAAE;4BACH;gCACI,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;gCAC5B,OAAO,EAAE,aAAa;6BACzB;yBACJ;qBACJ;iBACJ;aACJ;YACD,OAAO,EAAE,EAAE;SACd,EACD,MAAM,CACT,CACJ,CAAC;QAEF,QAAQ,CAAC,gBAAgB,GAAG,IAAA,0BAAkB,EAAC,IAAI,cAAM,EAAE,CAAQ,CAAC;QAEpE,OAAO,QAAQ,CAAC;IACpB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getErrors =
|
|
3
|
+
exports.getErrors = getErrors;
|
|
4
4
|
const normalize_errors_1 = require("./normalize-errors");
|
|
5
5
|
function getErrors(stats) {
|
|
6
6
|
return (0, normalize_errors_1.normalizeErrors)(stats.compilation.errors);
|
|
7
7
|
}
|
|
8
|
-
exports.getErrors = getErrors;
|
|
9
8
|
//# sourceMappingURL=get-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-errors.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-errors.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-errors.ts"],"names":[],"mappings":";;AAIA,8BAEC;AAJD,yDAAqD;AAErD,SAAgB,SAAS,CAAC,KAAY;IAClC,OAAO,IAAA,kCAAe,EAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-module-source.d.ts","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-module-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-module-source.d.ts","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-module-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,+BAQzD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getModuleSource =
|
|
3
|
+
exports.getModuleSource = getModuleSource;
|
|
4
4
|
function getModuleSource(name, stats) {
|
|
5
5
|
var _a;
|
|
6
6
|
const { modules } = stats.toJson({ source: true });
|
|
@@ -9,5 +9,4 @@ function getModuleSource(name, stats) {
|
|
|
9
9
|
}
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
-
exports.getModuleSource = getModuleSource;
|
|
13
12
|
//# sourceMappingURL=get-module-source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-module-source.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-module-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-module-source.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-module-source.ts"],"names":[],"mappings":";;AAEA,0CAQC;AARD,SAAgB,eAAe,CAAC,IAAY,EAAE,KAAY;;IACtD,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAEnD,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAC,OAAA,MAAA,CAAC,CAAC,IAAI,0CAAE,QAAQ,CAAC,IAAI,CAAC,CAAA,EAAA,CAAC,0CAAE,MAAM,CAAC;IAC7D,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWarnings =
|
|
3
|
+
exports.getWarnings = getWarnings;
|
|
4
4
|
const normalize_errors_1 = require("./normalize-errors");
|
|
5
5
|
function getWarnings(stats) {
|
|
6
6
|
return (0, normalize_errors_1.normalizeErrors)(stats.compilation.warnings);
|
|
7
7
|
}
|
|
8
|
-
exports.getWarnings = getWarnings;
|
|
9
8
|
//# sourceMappingURL=get-warnings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-warnings.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-warnings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-warnings.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/get-warnings.ts"],"names":[],"mappings":";;AAIA,kCAEC;AAJD,yDAAqD;AAErD,SAAgB,WAAW,CAAC,KAAY;IACpC,OAAO,IAAA,kCAAe,EAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUtils =
|
|
3
|
+
exports.getUtils = getUtils;
|
|
4
4
|
const compile_1 = require("./compile");
|
|
5
5
|
const execute_1 = require("./execute");
|
|
6
6
|
const get_compiler_1 = require("./get-compiler");
|
|
@@ -23,5 +23,4 @@ function getUtils(cwd) {
|
|
|
23
23
|
readAssets: read_assets_1.readAssets,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
exports.getUtils = getUtils;
|
|
27
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/index.ts"],"names":[],"mappings":";;AAUA,4BAYC;AAtBD,uCAAoC;AACpC,uCAA2C;AAC3C,iDAAoD;AACpD,6CAAyC;AACzC,2DAAsD;AACtD,iDAA6C;AAC7C,yDAAqD;AACrD,6CAAyC;AACzC,+CAA2C;AAE3C,SAAgB,QAAQ,CAAC,GAAW;IAChC,OAAO;QACH,OAAO,EAAP,iBAAO;QACP,OAAO,EAAE,IAAA,wBAAc,EAAC,GAAG,CAAC;QAC5B,WAAW,EAAE,IAAA,iCAAkB,EAAC,GAAG,CAAC;QACpC,SAAS,EAAT,sBAAS;QACT,eAAe,EAAf,mCAAe;QACf,WAAW,EAAX,0BAAW;QACX,eAAe,EAAf,kCAAe;QACf,SAAS,EAAT,sBAAS;QACT,UAAU,EAAV,wBAAU;KACb,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeErrors =
|
|
3
|
+
exports.normalizeErrors = normalizeErrors;
|
|
4
4
|
function removeCWD(str) {
|
|
5
5
|
const isWin = process.platform === 'win32';
|
|
6
6
|
let cwd = process.cwd();
|
|
@@ -14,5 +14,4 @@ function removeCWD(str) {
|
|
|
14
14
|
function normalizeErrors(errors) {
|
|
15
15
|
return errors.map(error => removeCWD(error.message.split('\n').slice(0, 2).join('\n')));
|
|
16
16
|
}
|
|
17
|
-
exports.normalizeErrors = normalizeErrors;
|
|
18
17
|
//# sourceMappingURL=normalize-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-errors.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/normalize-errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-errors.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/normalize-errors.ts"],"names":[],"mappings":";;AAeA,0CAEC;AAfD,SAAS,SAAS,CAAC,GAAW;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;IAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAExB,IAAI,KAAK,EAAE,CAAC;QACR,6CAA6C;QAC7C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,SAAgB,eAAe,CAAC,MAAsB;IAClD,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.readAsset =
|
|
6
|
+
exports.readAsset = readAsset;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
function readAsset(asset, compiler, stats) {
|
|
9
9
|
var _a;
|
|
@@ -23,5 +23,4 @@ function readAsset(asset, compiler, stats) {
|
|
|
23
23
|
}
|
|
24
24
|
return data;
|
|
25
25
|
}
|
|
26
|
-
exports.readAsset = readAsset;
|
|
27
26
|
//# sourceMappingURL=read-asset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-asset.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/read-asset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-asset.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/read-asset.ts"],"names":[],"mappings":";;;;;AAKA,8BAoBC;AAzBD,gDAAwB;AAKxB,SAAgB,SAAS,CAAC,KAAa,EAAE,QAAkB,EAAE,KAAY;;IACrE,MAAM,MAAM,GAAG,QAAQ,CAAC,gBAAuB,CAAC;IAChD,MAAM,UAAU,GAAG,MAAA,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,mCAAI,EAAE,CAAC;IAE9D,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE/C,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;QACtB,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,CAAC;QACD,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readAssets =
|
|
3
|
+
exports.readAssets = readAssets;
|
|
4
4
|
const read_asset_1 = require("./read-asset");
|
|
5
5
|
function readAssets(compiler, stats) {
|
|
6
6
|
const assets = {};
|
|
@@ -9,5 +9,4 @@ function readAssets(compiler, stats) {
|
|
|
9
9
|
});
|
|
10
10
|
return assets;
|
|
11
11
|
}
|
|
12
|
-
exports.readAssets = readAssets;
|
|
13
12
|
//# sourceMappingURL=read-assets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-assets.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/read-assets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-assets.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/read-assets.ts"],"names":[],"mappings":";;AAIA,gCAQC;AAVD,6CAAyC;AAEzC,SAAgB,UAAU,CAAC,QAAkB,EAAE,KAAY;IACvD,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAClD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,sBAAS,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@babel/preset-env": "~7.25.3",
|
|
37
37
|
"@jest/core": "~29.7.0",
|
|
38
38
|
"@jest/types": "~29.6.3",
|
|
39
|
-
"@servicetitan/eslint-config": "26.
|
|
40
|
-
"@servicetitan/stylelint-config": "26.
|
|
39
|
+
"@servicetitan/eslint-config": "26.3.0",
|
|
40
|
+
"@servicetitan/stylelint-config": "26.3.0",
|
|
41
41
|
"@svgr/webpack": "^8.1.0",
|
|
42
42
|
"@swc/core": "1.6.13",
|
|
43
43
|
"@types/debug": "^4.1.12",
|
|
@@ -78,11 +78,12 @@
|
|
|
78
78
|
"style-loader": "~4.0.0",
|
|
79
79
|
"stylelint": "~14.16.1",
|
|
80
80
|
"swc-loader": "0.2.6",
|
|
81
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
81
82
|
"ts-jest": "~29.2.4",
|
|
82
83
|
"ts-loader": "~9.5.1",
|
|
83
84
|
"ts-node": "~10.9.2",
|
|
84
85
|
"typed-css-modules": "~0.9.1",
|
|
85
|
-
"typescript": "
|
|
86
|
+
"typescript": "5.5.3",
|
|
86
87
|
"username": "~5.1.0",
|
|
87
88
|
"webpack": "~5.93.0",
|
|
88
89
|
"webpack-assets-manifest": "~5.2.1",
|
|
@@ -104,5 +105,5 @@
|
|
|
104
105
|
"cli": {
|
|
105
106
|
"webpack": false
|
|
106
107
|
},
|
|
107
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "f7879b7fbad9bf75b8659c3c5fc04d22c8c82b8e"
|
|
108
109
|
}
|
|
@@ -10,6 +10,15 @@ export const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'stat
|
|
|
10
10
|
|
|
11
11
|
type ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;
|
|
12
12
|
|
|
13
|
+
export interface MinifyJSOptions {
|
|
14
|
+
compress?: boolean;
|
|
15
|
+
mangle?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MinifyOptions {
|
|
19
|
+
js?: boolean | MinifyJSOptions;
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
export interface WebpackConfiguration
|
|
14
23
|
extends Omit<
|
|
15
24
|
Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,
|
|
@@ -20,6 +29,7 @@ export interface WebpackConfiguration
|
|
|
20
29
|
'expose-shared-dependencies'?: boolean;
|
|
21
30
|
'devServer'?: WebpackDevServerConfiguration;
|
|
22
31
|
'disable-style-check'?: boolean;
|
|
32
|
+
'minify'?: MinifyOptions;
|
|
23
33
|
'proxy'?: WebpackDevServerConfiguration['proxy'] | string;
|
|
24
34
|
}
|
|
25
35
|
|
|
@@ -102,28 +112,21 @@ export function getStylelintConfiguration() {
|
|
|
102
112
|
return getConfiguration().lint?.stylelint ?? {};
|
|
103
113
|
}
|
|
104
114
|
|
|
115
|
+
export function getWebpackConfiguration(locationOrJson?: LocationOrJson) {
|
|
116
|
+
const { webpack } = getConfiguration(locationOrJson);
|
|
117
|
+
return typeof webpack === 'object' ? webpack : {};
|
|
118
|
+
}
|
|
119
|
+
|
|
105
120
|
export function isBundle(locationOrJson?: LocationOrJson) {
|
|
106
121
|
return getConfiguration(locationOrJson).webpack !== false;
|
|
107
122
|
}
|
|
108
123
|
|
|
109
124
|
export function isCustomStyleRules() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (typeof configuration.webpack !== 'object') {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return configuration.webpack['custom-style-rules'] === true;
|
|
125
|
+
return getWebpackConfiguration()['custom-style-rules'] === true;
|
|
117
126
|
}
|
|
118
127
|
|
|
119
128
|
export function isExposeSharedDependencies() {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (typeof configuration.webpack !== 'object') {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return configuration.webpack['expose-shared-dependencies'] === true;
|
|
129
|
+
return getWebpackConfiguration()['expose-shared-dependencies'] === true;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
export function isLegacy(locationOrJson?: LocationOrJson) {
|
|
@@ -136,13 +139,7 @@ export function isLegacyRoot() {
|
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
export function isStyleCheckDisabled() {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (typeof configuration.webpack !== 'object') {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return configuration.webpack?.['disable-style-check'] === true;
|
|
142
|
+
return getWebpackConfiguration()['disable-style-check'] === true;
|
|
146
143
|
}
|
|
147
144
|
|
|
148
145
|
export function isWebComponent() {
|
|
@@ -5,6 +5,7 @@ import { fs, vol } from 'memfs';
|
|
|
5
5
|
import MomentLocalesPlugin from 'moment-locales-webpack-plugin';
|
|
6
6
|
import os from 'os';
|
|
7
7
|
import path from 'path';
|
|
8
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
8
9
|
import { IgnorePlugin, ProvidePlugin } from 'webpack';
|
|
9
10
|
import WebpackDevServer from 'webpack-dev-server';
|
|
10
11
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
@@ -21,6 +22,7 @@ import {
|
|
|
21
22
|
getPackageDependencyVersion,
|
|
22
23
|
getPackages,
|
|
23
24
|
getTsConfig,
|
|
25
|
+
getWebpackConfiguration,
|
|
24
26
|
isCustomStyleRules,
|
|
25
27
|
isWebComponent,
|
|
26
28
|
loadSharedDependencies,
|
|
@@ -39,6 +41,7 @@ jest.mock('mini-css-extract-plugin', () =>
|
|
|
39
41
|
Object.assign(jest.fn(), { loader: 'MiniCssExtractPlugin.loader' })
|
|
40
42
|
);
|
|
41
43
|
jest.mock('moment-locales-webpack-plugin', () => jest.fn());
|
|
44
|
+
jest.mock('terser-webpack-plugin', () => jest.fn());
|
|
42
45
|
jest.mock('webpack', () => ({
|
|
43
46
|
...jest.requireActual('webpack'),
|
|
44
47
|
IgnorePlugin: jest.fn(),
|
|
@@ -57,6 +60,7 @@ jest.mock('../../utils', () => ({
|
|
|
57
60
|
getPackageDependencyVersion: jest.fn(),
|
|
58
61
|
getPackages: jest.fn(),
|
|
59
62
|
getTsConfig: jest.fn(),
|
|
63
|
+
getWebpackConfiguration: jest.fn(),
|
|
60
64
|
isCustomStyleRules: jest.fn(),
|
|
61
65
|
isExposeSharedDependencies: jest.fn(),
|
|
62
66
|
isWebComponent: jest.fn(),
|
|
@@ -120,8 +124,10 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
120
124
|
jest.mocked(IgnorePlugin).mockImplementation(mockPlugIn('IgnorePlugin'));
|
|
121
125
|
jest.mocked(MomentLocalesPlugin).mockImplementation(mockPlugIn('MomentLocalesPlugin'));
|
|
122
126
|
jest.mocked(ProvidePlugin).mockImplementation(mockPlugIn('ProvidePlugin'));
|
|
127
|
+
jest.mocked(TerserPlugin).mockImplementation(mockPlugIn('TerserPlugin'));
|
|
123
128
|
|
|
124
129
|
jest.mocked(getConfiguration).mockImplementation(() => configuration as any);
|
|
130
|
+
jest.mocked(getWebpackConfiguration).mockImplementation(() => configuration.webpack ?? {});
|
|
125
131
|
jest.mocked(getFolders).mockImplementation((location?: string) => {
|
|
126
132
|
const prefix = location ? `${location.replace(/\W/g, '')}-` : '';
|
|
127
133
|
return { source: `${prefix}${source}`, destination };
|
|
@@ -625,6 +631,40 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
625
631
|
expect(subject().optimization?.runtimeChunk).toBe('single');
|
|
626
632
|
});
|
|
627
633
|
|
|
634
|
+
test('configures "optimization.minimize"', () => {
|
|
635
|
+
expect(subject().optimization?.minimize).toBe(true);
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
test('configures "optimization.minimizer"', () => {
|
|
639
|
+
expect(subject().optimization?.minimizer).toEqual([
|
|
640
|
+
new TerserPlugin({ terserOptions: { compress: false, mangle: false } }),
|
|
641
|
+
]);
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
describe('when JS minification is turned off', () => {
|
|
645
|
+
beforeEach(() => (configuration = { webpack: { minify: { js: false } } }));
|
|
646
|
+
|
|
647
|
+
test('changes "optimization.minimize" to false', () => {
|
|
648
|
+
expect(subject().optimization?.minimize).toBe(false);
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
test('omits "optimization.minimizer"', () => {
|
|
652
|
+
expect(subject().optimization?.minimizer).toBeUndefined();
|
|
653
|
+
});
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
describe('with JS minification options', () => {
|
|
657
|
+
beforeEach(() => {
|
|
658
|
+
configuration = { webpack: { minify: { js: { compress: true, mangle: true } } } };
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
test('applies the options', () => {
|
|
662
|
+
expect(subject().optimization?.minimizer).toEqual([
|
|
663
|
+
new TerserPlugin({ terserOptions: configuration.webpack?.minify?.js }),
|
|
664
|
+
]);
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
|
|
628
668
|
Object.entries(productionStyleRules).forEach(([extension, rules]) => {
|
|
629
669
|
test(`configures "${extension}" rules`, () => {
|
|
630
670
|
expect(subject().module?.rules).toContainEqual(rules);
|
|
@@ -1,69 +1,109 @@
|
|
|
1
|
+
import TerserPlugin from 'terser-webpack-plugin';
|
|
1
2
|
import { Configuration } from 'webpack';
|
|
2
3
|
import { Context, Overrides } from './types';
|
|
3
4
|
|
|
4
5
|
type Config = Configuration['optimization'];
|
|
6
|
+
type ConfigWithCacheGroups = Config & { splitChunks: { cacheGroups: Record<string, any> } };
|
|
5
7
|
type Result = Pick<Configuration, 'optimization'>;
|
|
6
8
|
|
|
7
9
|
export function optimizationConfig(context: Context, _: Overrides): Result {
|
|
8
|
-
const {
|
|
10
|
+
const { isProduction } = context;
|
|
9
11
|
|
|
10
|
-
const optimization:
|
|
12
|
+
const optimization: ConfigWithCacheGroups = {
|
|
11
13
|
chunkIds: isProduction ? 'deterministic' : 'named',
|
|
12
14
|
moduleIds: 'size',
|
|
13
15
|
mangleExports: 'size',
|
|
14
16
|
splitChunks: { cacheGroups: {} },
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
'design-system': {
|
|
20
|
-
test: /[\\/]node_modules[\\/]@servicetitan[\\/](tokens|anvil-fonts|design-system)[\\/].*\.css$/,
|
|
21
|
-
name: 'design-system',
|
|
22
|
-
chunks: 'all',
|
|
23
|
-
enforce: true,
|
|
24
|
-
},
|
|
25
|
-
'anvil2': {
|
|
26
|
-
test: /@servicetitan\/anvil2\/.*\.css$/,
|
|
27
|
-
name: 'anvil2',
|
|
28
|
-
chunks: 'all',
|
|
29
|
-
enforce: true,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
19
|
+
if (isProduction) {
|
|
20
|
+
optimization.runtimeChunk = 'single';
|
|
32
21
|
}
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
[minimizeConfig, sharedDependenciesConfig, webComponentConfig].forEach(handler =>
|
|
24
|
+
handler(optimization, context)
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return { optimization };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function minimizeConfig(optimization: ConfigWithCacheGroups, context: Context) {
|
|
31
|
+
const { isProduction } = context;
|
|
32
|
+
if (!isProduction) {
|
|
33
|
+
return;
|
|
43
34
|
}
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
common: {
|
|
50
|
-
name: 'common',
|
|
51
|
-
test: /[\\/]node_modules[\\/](axios|classnames|formstate|mobx|mobx-react|mobx-utils|react|react-dom|react-router|react-router-dom)[\\/]/,
|
|
52
|
-
chunks: 'all',
|
|
53
|
-
},
|
|
54
|
-
kendo: {
|
|
55
|
-
name: 'kendo',
|
|
56
|
-
test: /[\\/]node_modules[\\/](@progress|@telerik)[\\/]/,
|
|
57
|
-
chunks: 'all',
|
|
58
|
-
},
|
|
59
|
-
servicetitan: {
|
|
60
|
-
name: 'servicetitan',
|
|
61
|
-
test: /[\\/]node_modules[\\/]@servicetitan[\\/]/,
|
|
62
|
-
chunks: 'all',
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}
|
|
36
|
+
const minify = context.minify?.js ?? true;
|
|
37
|
+
optimization.minimize = !!minify;
|
|
38
|
+
if (!optimization.minimize) {
|
|
39
|
+
return;
|
|
66
40
|
}
|
|
67
41
|
|
|
68
|
-
|
|
42
|
+
const terserOptions = {
|
|
43
|
+
compress: false,
|
|
44
|
+
mangle: false,
|
|
45
|
+
...(typeof minify === 'object' ? minify : {}),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
optimization.minimizer = [new TerserPlugin({ terserOptions })];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function sharedDependenciesConfig(optimization: ConfigWithCacheGroups, context: Context) {
|
|
52
|
+
const { isExposeSharedDependencies } = context;
|
|
53
|
+
if (!isExposeSharedDependencies) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
Object.assign(optimization.splitChunks.cacheGroups, {
|
|
58
|
+
'design-system': {
|
|
59
|
+
test: /[\\/]node_modules[\\/]@servicetitan[\\/](tokens|anvil-fonts|design-system)[\\/].*\.css$/,
|
|
60
|
+
name: 'design-system',
|
|
61
|
+
chunks: 'all',
|
|
62
|
+
enforce: true,
|
|
63
|
+
},
|
|
64
|
+
'anvil2': {
|
|
65
|
+
test: /@servicetitan\/anvil2\/.*\.css$/,
|
|
66
|
+
name: 'anvil2',
|
|
67
|
+
chunks: 'all',
|
|
68
|
+
enforce: true,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function webComponentConfig(optimization: ConfigWithCacheGroups, context: Context) {
|
|
74
|
+
const { isWebComponent, isProduction } = context;
|
|
75
|
+
if (!isWebComponent) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Object.assign(optimization.splitChunks.cacheGroups, {
|
|
80
|
+
styles: {
|
|
81
|
+
name: 'main',
|
|
82
|
+
type: 'css/mini-extract',
|
|
83
|
+
chunks: 'all',
|
|
84
|
+
enforce: true,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (!isProduction) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
Object.assign(optimization.splitChunks.cacheGroups, {
|
|
93
|
+
common: {
|
|
94
|
+
name: 'common',
|
|
95
|
+
test: /[\\/]node_modules[\\/](axios|classnames|formstate|mobx|mobx-react|mobx-utils|react|react-dom|react-router|react-router-dom)[\\/]/,
|
|
96
|
+
chunks: 'all',
|
|
97
|
+
},
|
|
98
|
+
kendo: {
|
|
99
|
+
name: 'kendo',
|
|
100
|
+
test: /[\\/]node_modules[\\/](@progress|@telerik)[\\/]/,
|
|
101
|
+
chunks: 'all',
|
|
102
|
+
},
|
|
103
|
+
servicetitan: {
|
|
104
|
+
name: 'servicetitan',
|
|
105
|
+
test: /[\\/]node_modules[\\/]@servicetitan[\\/]/,
|
|
106
|
+
chunks: 'all',
|
|
107
|
+
},
|
|
108
|
+
});
|
|
69
109
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPackageData, loadSharedDependencies } from '../../utils';
|
|
1
|
+
import { getPackageData, loadSharedDependencies, MinifyOptions } from '../../utils';
|
|
2
2
|
import { Options } from '../types';
|
|
3
3
|
export { Overrides } from '../types';
|
|
4
4
|
|
|
@@ -12,6 +12,7 @@ export interface Context extends Options {
|
|
|
12
12
|
isLegacyRoot: boolean;
|
|
13
13
|
isProduction: boolean;
|
|
14
14
|
isWebComponent: boolean;
|
|
15
|
+
minify?: MinifyOptions;
|
|
15
16
|
packageData: ReturnType<typeof getPackageData>;
|
|
16
17
|
sharedDependencies: ReturnType<typeof loadSharedDependencies>;
|
|
17
18
|
source: string;
|
|
@@ -6,6 +6,7 @@ import { webpackDevConfigFileName, webpackProdConfigFileName } from '../cli/util
|
|
|
6
6
|
import {
|
|
7
7
|
getFolders,
|
|
8
8
|
getPackageData,
|
|
9
|
+
getWebpackConfiguration,
|
|
9
10
|
isCustomStyleRules,
|
|
10
11
|
isExposeSharedDependencies,
|
|
11
12
|
isLegacyRoot,
|
|
@@ -35,6 +36,7 @@ export function createWebpackConfig(overrides: Overrides, options: Options = {})
|
|
|
35
36
|
const { configuration = {} } = overrides;
|
|
36
37
|
|
|
37
38
|
const { source, destination } = getFolders();
|
|
39
|
+
const { minify } = getWebpackConfiguration();
|
|
38
40
|
const packageData = getPackageData();
|
|
39
41
|
const sharedDependencies = loadSharedDependencies(
|
|
40
42
|
packageData.dependencies,
|
|
@@ -52,6 +54,7 @@ export function createWebpackConfig(overrides: Overrides, options: Options = {})
|
|
|
52
54
|
isLegacyRoot: isLegacyRoot(),
|
|
53
55
|
isProduction: configuration.mode === 'production',
|
|
54
56
|
isWebComponent: isWebComponent(),
|
|
57
|
+
minify,
|
|
55
58
|
name: '',
|
|
56
59
|
...options,
|
|
57
60
|
packageData,
|
|
@@ -60,9 +63,7 @@ export function createWebpackConfig(overrides: Overrides, options: Options = {})
|
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
if (context.isWebComponent && isCalledFromCustomWebpackConfigFile()) {
|
|
63
|
-
throw new Error(
|
|
64
|
-
'You cannot call createWebpackConfig in a custom webpack config file in a web component (MFE) project. Export webpack configuration itself as a default export from the config file instead.'
|
|
65
|
-
);
|
|
66
|
+
throw new Error(WEB_COMPONENT_CONFIG_ERROR);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
const result = merge(
|
|
@@ -115,3 +116,10 @@ function stringify(configuration: any) {
|
|
|
115
116
|
}
|
|
116
117
|
return JSON.stringify(configuration, replacer, 2);
|
|
117
118
|
}
|
|
119
|
+
|
|
120
|
+
const WEB_COMPONENT_CONFIG_ERROR = `
|
|
121
|
+
You cannot call createWebpackConfig in a custom webpack config file in a web component (MFE) project.
|
|
122
|
+
Export webpack configuration itself as a default export from the config file instead.
|
|
123
|
+
`
|
|
124
|
+
.replace(/\n\s*/g, ' ')
|
|
125
|
+
.trim();
|
package/tsconfig/base.json
CHANGED