@servicetitan/startup 28.1.1 → 28.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/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts +4 -0
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +19 -0
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +5 -6
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts +2 -0
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js +27 -0
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts +2 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js +17 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +1 -0
- package/dist/webpack/configs/plugins/index.d.ts +1 -0
- package/dist/webpack/configs/plugins/index.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/index.js +1 -0
- package/dist/webpack/configs/plugins/index.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js +1 -0
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +1 -1
- package/dist/webpack/configs/types.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.js +2 -0
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts +2 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js +17 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/webpack/configs/utils/get-web-components-version.d.ts +1 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +1 -1
- package/package.json +19 -17
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +19 -1
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +19 -0
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/check-resource.test.ts +34 -25
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/get-package-json.test.ts +61 -0
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts +47 -0
- package/src/webpack/configs/plugins/ignore-plugin/check-resource.ts +7 -6
- package/src/webpack/configs/plugins/ignore-plugin/get-package-json.ts +23 -0
- package/src/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.ts +12 -0
- package/src/webpack/configs/plugins/index.ts +1 -0
- package/src/webpack/configs/plugins-config.ts +2 -0
- package/src/webpack/configs/types.ts +1 -1
- package/src/webpack/configs/utils/__tests__/generate-metadata.test.ts +5 -0
- package/src/webpack/configs/utils/__tests__/get-launchdarkly-sdk-version.test.ts +30 -0
- package/src/webpack/configs/utils/generate-metadata.ts +2 -0
- package/src/webpack/configs/utils/get-launchdarkly-sdk-version.ts +15 -0
- package/src/webpack/configs/utils/get-web-components-version.ts +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.d.ts +0 -14
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.js +0 -15
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.js.map +0 -1
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-anvil-peer-dependency.test.ts +0 -54
- package/src/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.ts +0 -22
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DefinePlugin } from 'webpack';
|
|
2
|
+
import { Context, Overrides } from '../types';
|
|
3
|
+
export declare function defineExposedInstanceDependenciesPlugin(context: Context, _: Overrides): DefinePlugin | undefined;
|
|
4
|
+
//# sourceMappingURL=define-exposed-instance-dependencies-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-exposed-instance-dependencies-plugin.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG9C,wBAAgB,uCAAuC,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,4BAcrF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineExposedInstanceDependenciesPlugin = defineExposedInstanceDependenciesPlugin;
|
|
4
|
+
const webpack_1 = require("webpack");
|
|
5
|
+
const get_launchdarkly_sdk_version_1 = require("../utils/get-launchdarkly-sdk-version");
|
|
6
|
+
function defineExposedInstanceDependenciesPlugin(context, _) {
|
|
7
|
+
const { isExposeSharedDependencies } = context;
|
|
8
|
+
if (!isExposeSharedDependencies) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const instanceDependencies = {
|
|
12
|
+
launchDarkly: { version: (0, get_launchdarkly_sdk_version_1.getLaunchDarklySdkVersion)() },
|
|
13
|
+
};
|
|
14
|
+
return new webpack_1.DefinePlugin({
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
+
EXPOSED_INSTANCE_DEPENDENCIES: JSON.stringify(instanceDependencies),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=define-exposed-instance-dependencies-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-exposed-instance-dependencies-plugin.js","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts"],"names":[],"mappings":";;AAIA,0FAcC;AAlBD,qCAAuC;AAEvC,wFAAkF;AAElF,SAAgB,uCAAuC,CAAC,OAAgB,EAAE,CAAY;IAClF,MAAM,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC;IAC/C,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAC9B,OAAO;IACX,CAAC;IAED,MAAM,oBAAoB,GAAG;QACzB,YAAY,EAAE,EAAE,OAAO,EAAE,IAAA,wDAAyB,GAAE,EAAE;KACzD,CAAC;IAEF,OAAO,IAAI,sBAAY,CAAC;QACpB,gEAAgE;QAChE,6BAA6B,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;KACtE,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-resource.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/check-resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check-resource.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/check-resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,wBAAgB,aAAa,CAAC,cAAc,EAAE,OAAO,cACtB,MAAM,WAAW,MAAM,aAsBrD"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkResource = checkResource;
|
|
4
|
-
const
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const is_optional_peer_dependency_1 = require("./is-optional-peer-dependency");
|
|
5
6
|
const is_optional_react_dom_peer_dependency_1 = require("./is-optional-react-dom-peer-dependency");
|
|
6
7
|
function checkResource(packageContext) {
|
|
7
8
|
return function (resource, context) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
if ((0, is_optional_anvil_peer_dependency_1.isOptionalAnvilPeerDependency)({ context, packageContext, resource })) {
|
|
9
|
+
if (!packageContext.packageData.dependencies[resource] &&
|
|
10
|
+
(0, is_optional_peer_dependency_1.isOptionalPeerDependency)(resource, context)) {
|
|
11
|
+
utils_1.log.debug('check-resource', `${JSON.stringify({ resource, context })} => true`);
|
|
13
12
|
return true;
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-resource.js","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/check-resource.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"check-resource.js","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/check-resource.ts"],"names":[],"mappings":";;AAKA,sCAuBC;AA5BD,6CAAwC;AAExC,+EAAyE;AACzE,mGAA2F;AAE3F,SAAgB,aAAa,CAAC,cAAuB;IACjD,OAAO,UAAU,QAAgB,EAAE,OAAe;QAC9C,IACI,CAAC,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC;YAClD,IAAA,sDAAwB,EAAC,QAAQ,EAAE,OAAO,CAAC,EAC7C,CAAC;YACC,WAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;YAChF,OAAO,IAAI,CAAC;QAChB,CAAC;QAED;;;WAGG;QACH,IAAI,IAAA,wEAAgC,EAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAC1D,IAAI,CAAC;gBACD,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-package-json.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/get-package-json.ts"],"names":[],"mappings":"AAOA,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,mCAe7C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.getPackageJson = getPackageJson;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const utils_1 = require("../../../../utils");
|
|
10
|
+
const containsNodeModules = /[\\/](node_modules|\.yalc)[\\/]/;
|
|
11
|
+
const isNodeModules = /(node_modules|\.yalc)/;
|
|
12
|
+
function getPackageJson(context) {
|
|
13
|
+
const fullPath = path_1.default.resolve(context);
|
|
14
|
+
if (!containsNodeModules.test(fullPath)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let dirname = path_1.default.dirname(fullPath);
|
|
18
|
+
do {
|
|
19
|
+
const packageJsonFile = path_1.default.join(dirname, 'package.json');
|
|
20
|
+
if (fs_1.default.existsSync(packageJsonFile)) {
|
|
21
|
+
utils_1.log.debug('get-package-json', `${context} => ${packageJsonFile}`);
|
|
22
|
+
return (0, utils_1.readJson)(packageJsonFile);
|
|
23
|
+
}
|
|
24
|
+
dirname = path_1.default.dirname(dirname);
|
|
25
|
+
} while (!isNodeModules.test(path_1.default.basename(dirname)));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=get-package-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-package-json.js","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/get-package-json.ts"],"names":[],"mappings":";;;;;AAOA,wCAeC;AAtBD,4CAAoB;AACpB,gDAAwB;AACxB,6CAAkD;AAElD,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAC9D,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAE9C,SAAgB,cAAc,CAAC,OAAe;IAC1C,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,OAAO;IACX,CAAC;IAED,IAAI,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,GAAG,CAAC;QACA,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC3D,IAAI,YAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACjC,WAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,OAAO,OAAO,eAAe,EAAE,CAAC,CAAC;YAClE,OAAO,IAAA,gBAAQ,EAAsB,eAAe,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;AAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-optional-peer-dependency.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.ts"],"names":[],"mappings":"AAGA,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,WAIzE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.isOptionalPeerDependency = isOptionalPeerDependency;
|
|
7
|
+
const lodash_memoize_1 = __importDefault(require("lodash.memoize"));
|
|
8
|
+
const get_package_json_1 = require("./get-package-json");
|
|
9
|
+
function isOptionalPeerDependency(resource, context) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
return (/^[@a-z]/.test(resource) && ((_b = (_a = getPeerDependenciesMeta(context)) === null || _a === void 0 ? void 0 : _a[resource]) === null || _b === void 0 ? void 0 : _b.optional) === true);
|
|
12
|
+
}
|
|
13
|
+
const getPeerDependenciesMeta = (0, lodash_memoize_1.default)(function getPeerDependenciesMeta(context) {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = (0, get_package_json_1.getPackageJson)(context)) === null || _a === void 0 ? void 0 : _a.peerDependenciesMeta;
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=is-optional-peer-dependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-optional-peer-dependency.js","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.ts"],"names":[],"mappings":";;;;;AAGA,4DAIC;AAPD,oEAAqC;AACrC,yDAAoD;AAEpD,SAAgB,wBAAwB,CAAC,QAAgB,EAAE,OAAe;;IACtE,OAAO,CACH,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAA,MAAA,MAAA,uBAAuB,CAAC,OAAO,CAAC,0CAAG,QAAQ,CAAC,0CAAE,QAAQ,MAAK,IAAI,CAC9F,CAAC;AACN,CAAC;AAED,MAAM,uBAAuB,GAAG,IAAA,wBAAO,EAAC,SAAS,uBAAuB,CAAC,OAAe;;IACpF,OAAO,MAAA,IAAA,iCAAc,EAAC,OAAO,CAAC,0CAAE,oBAAoB,CAAC;AACzD,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './assets-manifest-plugin';
|
|
2
2
|
export * from './bundle-analyser-plugin';
|
|
3
3
|
export * from './define-exposed-dependencies-plugin';
|
|
4
|
+
export * from './define-exposed-instance-dependencies-plugin';
|
|
4
5
|
export * from './define-web-component-name-plugin';
|
|
5
6
|
export * from './filter-warnings-plugin';
|
|
6
7
|
export * from './html-plugin';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./assets-manifest-plugin"), exports);
|
|
18
18
|
__exportStar(require("./bundle-analyser-plugin"), exports);
|
|
19
19
|
__exportStar(require("./define-exposed-dependencies-plugin"), exports);
|
|
20
|
+
__exportStar(require("./define-exposed-instance-dependencies-plugin"), exports);
|
|
20
21
|
__exportStar(require("./define-web-component-name-plugin"), exports);
|
|
21
22
|
__exportStar(require("./filter-warnings-plugin"), exports);
|
|
22
23
|
__exportStar(require("./html-plugin"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,2DAAyC;AACzC,uEAAqD;AACrD,qEAAmD;AACnD,2DAAyC;AACzC,gDAA8B;AAC9B,kDAAgC;AAChC,4DAA0C;AAC1C,0DAAwC;AACxC,yDAAuC;AACvC,sDAAoC;AACpC,2DAAyC;AACzC,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webpack/configs/plugins/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,2DAAyC;AACzC,uEAAqD;AACrD,gFAA8D;AAC9D,qEAAmD;AACnD,2DAAyC;AACzC,gDAA8B;AAC9B,kDAAgC;AAChC,4DAA0C;AAC1C,0DAAwC;AACxC,yDAAuC;AACvC,sDAAoC;AACpC,2DAAyC;AACzC,qDAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/plugins-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"plugins-config.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/plugins-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAiBxC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAG7C,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAE7C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAqB5E"}
|
|
@@ -7,6 +7,7 @@ function pluginsConfig(context, overrides) {
|
|
|
7
7
|
plugins_1.assetsManifestPlugin,
|
|
8
8
|
plugins_1.bundleAnalyzerPlugin,
|
|
9
9
|
plugins_1.defineExposedDependenciesPlugin,
|
|
10
|
+
plugins_1.defineExposedInstanceDependenciesPlugin,
|
|
10
11
|
plugins_1.defineWebComponentNamePlugin,
|
|
11
12
|
plugins_1.filterWarningsPlugin,
|
|
12
13
|
plugins_1.htmlPlugin,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins-config.js","sourceRoot":"","sources":["../../../src/webpack/configs/plugins-config.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plugins-config.js","sourceRoot":"","sources":["../../../src/webpack/configs/plugins-config.ts"],"names":[],"mappings":";;AAsBA,sCAqBC;AA1CD,uCAemB;AAMnB,SAAgB,aAAa,CAAC,OAAgB,EAAE,SAAoB;IAChE,MAAM,OAAO,GAAW;QACpB,8BAAoB;QACpB,8BAAoB;QACpB,yCAA+B;QAC/B,iDAAuC;QACvC,sCAA4B;QAC5B,8BAAoB;QACpB,oBAAU;QACV,sBAAY;QACZ,8BAAoB;QACpB,6BAAmB;QACnB,yBAAe;QACf,4BAAkB;QAClB,8BAAoB;QACpB,wBAAc;KACjB;SACI,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;SACjC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAEhC,OAAO,EAAE,OAAO,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -27,7 +27,7 @@ export interface EntryPoints {
|
|
|
27
27
|
}
|
|
28
28
|
export interface Metadata {
|
|
29
29
|
name: string;
|
|
30
|
-
bundledWith: Record<string, string>;
|
|
30
|
+
bundledWith: Record<string, string | undefined>;
|
|
31
31
|
sharedDependencies: Record<string, string>;
|
|
32
32
|
dependencies: Record<string, string>;
|
|
33
33
|
entrypoints: EntryPoints;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,WAAW,OAAQ,SAAQ,OAAO;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,0BAA0B,EAAE,OAAO,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC/C,kBAAkB,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IAC9D,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACvB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/webpack/configs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,WAAW,OAAQ,SAAQ,OAAO;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,0BAA0B,EAAE,OAAO,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC/C,kBAAkB,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IAC9D,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACvB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,WAAW,EAAE,WAAW,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-metadata.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/generate-metadata.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAY,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-metadata.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/generate-metadata.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAY,MAAM,UAAU,CAAC;AAK7C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QA0BhD"}
|
|
@@ -7,6 +7,7 @@ exports.generateMetadata = generateMetadata;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const utils_1 = require("../../../utils");
|
|
10
|
+
const get_launchdarkly_sdk_version_1 = require("./get-launchdarkly-sdk-version");
|
|
10
11
|
const get_web_components_version_1 = require("./get-web-components-version");
|
|
11
12
|
function generateMetadata(context) {
|
|
12
13
|
const { destination, name, packageData, sharedDependencies } = context;
|
|
@@ -20,6 +21,7 @@ function generateMetadata(context) {
|
|
|
20
21
|
bundledWith: {
|
|
21
22
|
'@servicetitan/startup': (0, utils_1.getStartupVersion)(),
|
|
22
23
|
'@servicetitan/web-components': (0, get_web_components_version_1.getWebComponentsVersion)(),
|
|
24
|
+
'launchdarkly-js-client-sdk': (0, get_launchdarkly_sdk_version_1.getLaunchDarklySdkVersion)(),
|
|
23
25
|
},
|
|
24
26
|
sharedDependencies,
|
|
25
27
|
dependencies: packageData.dependencies,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-metadata.js","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/generate-metadata.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"generate-metadata.js","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/generate-metadata.ts"],"names":[],"mappings":";;;;;AAQA,4CA0BC;AAlCD,4CAAoB;AACpB,gDAAwB;AACxB,0CAAsE;AAGtE,iFAA2E;AAC3E,6EAAuE;AAEvE,SAAgB,gBAAgB,CAAC,OAAgB;IAC7C,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC;IAEvE,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9B,YAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,oBAAY,EAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACxF,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC1F,MAAM,QAAQ,GAAa;QACvB,IAAI;QACJ,WAAW,EAAE;YACT,uBAAuB,EAAE,IAAA,yBAAiB,GAAE;YAC5C,8BAA8B,EAAE,IAAA,oDAAuB,GAAE;YACzD,4BAA4B,EAAE,IAAA,wDAAyB,GAAE;SAC5D;QACD,kBAAkB;QAClB,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,WAAW,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;KAC1E,CAAC;IAEF,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC3D,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAExE,sCAAsC;IACtC,WAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-launchdarkly-sdk-version.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/get-launchdarkly-sdk-version.ts"],"names":[],"mappings":"AAGA,wBAAgB,yBAAyB,uBAWxC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.getLaunchDarklySdkVersion = getLaunchDarklySdkVersion;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
function getLaunchDarklySdkVersion() {
|
|
10
|
+
try {
|
|
11
|
+
return (0, utils_1.readJson)(path_1.default.join(path_1.default.dirname(require.resolve('launchdarkly-js-client-sdk')), '../package.json')).version;
|
|
12
|
+
}
|
|
13
|
+
catch (_a) {
|
|
14
|
+
// ignore
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=get-launchdarkly-sdk-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-launchdarkly-sdk-version.js","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/get-launchdarkly-sdk-version.ts"],"names":[],"mappings":";;;;;AAGA,8DAWC;AAdD,gDAAwB;AACxB,0CAA0C;AAE1C,SAAgB,yBAAyB;IACrC,IAAI,CAAC;QACD,OAAO,IAAA,gBAAQ,EACX,cAAI,CAAC,IAAI,CACL,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,EAC3D,iBAAiB,CACpB,CACJ,CAAC,OAAO,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACL,SAAS;IACb,CAAC;AACL,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getWebComponentsVersion():
|
|
1
|
+
export declare function getWebComponentsVersion(): string;
|
|
2
2
|
//# sourceMappingURL=get-web-components-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-web-components-version.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/get-web-components-version.ts"],"names":[],"mappings":"AAGA,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"get-web-components-version.d.ts","sourceRoot":"","sources":["../../../../src/webpack/configs/utils/get-web-components-version.ts"],"names":[],"mappings":"AAGA,wBAAgB,uBAAuB,WAItC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "28.
|
|
3
|
+
"version": "28.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/cpx": "~1.5.5",
|
|
23
23
|
"@types/eslint": "~8.56.3",
|
|
24
|
-
"@types/less": "~3.0.
|
|
24
|
+
"@types/less": "~3.0.7",
|
|
25
|
+
"@types/lodash.memoize": "^4.1.9",
|
|
25
26
|
"@types/moment-locales-webpack-plugin": "~1.2.2",
|
|
26
27
|
"@types/webpack-assets-manifest": "~5.1.4",
|
|
27
28
|
"@types/yargs": "~17.0.24"
|
|
@@ -31,10 +32,10 @@
|
|
|
31
32
|
"@jest/core": "~29.7.0",
|
|
32
33
|
"@jest/types": "~29.6.3",
|
|
33
34
|
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
34
|
-
"@servicetitan/eslint-config": "28.
|
|
35
|
-
"@servicetitan/stylelint-config": "28.
|
|
35
|
+
"@servicetitan/eslint-config": "28.3.0",
|
|
36
|
+
"@servicetitan/stylelint-config": "28.3.0",
|
|
36
37
|
"@svgr/webpack": "^8.1.0",
|
|
37
|
-
"@swc/core": "1.
|
|
38
|
+
"@swc/core": "1.10.1",
|
|
38
39
|
"@types/debug": "^4.1.12",
|
|
39
40
|
"@types/jest": "~29.5.12",
|
|
40
41
|
"chalk": "~4.1.2",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"cpx2": "7.0.1",
|
|
43
44
|
"css-loader": "~7.1.2",
|
|
44
45
|
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
45
|
-
"debug": "^4.
|
|
46
|
+
"debug": "^4.4.0",
|
|
46
47
|
"deepmerge": "~4.3.1",
|
|
47
48
|
"esbuild-loader": "~4.2.2",
|
|
48
49
|
"eslint": "~8.57.0",
|
|
@@ -56,35 +57,36 @@
|
|
|
56
57
|
"jest-environment-jsdom": "^29.7.0",
|
|
57
58
|
"jest-fetch-mock": "~3.0.3",
|
|
58
59
|
"lerna": "~8.1.9",
|
|
59
|
-
"less": "~4.2.
|
|
60
|
+
"less": "~4.2.1",
|
|
60
61
|
"less-loader": "~12.2.0",
|
|
61
62
|
"less-plugin-npm-import": "~2.1.0",
|
|
62
|
-
"
|
|
63
|
+
"lodash.memoize": "^4.1.2",
|
|
64
|
+
"memfs": "~4.15.0",
|
|
63
65
|
"mini-css-extract-plugin": "~2.9.2",
|
|
64
66
|
"moment": "^2.30.1",
|
|
65
67
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
66
68
|
"multimatch": "~5.0.0",
|
|
67
69
|
"portfinder": "~1.0.32",
|
|
68
70
|
"postcss": "~8.4.49",
|
|
69
|
-
"prettier": "~3.
|
|
70
|
-
"sass": "~1.
|
|
71
|
-
"sass-loader": "~16.0.
|
|
71
|
+
"prettier": "~3.4.2",
|
|
72
|
+
"sass": "~1.83.0",
|
|
73
|
+
"sass-loader": "~16.0.4",
|
|
72
74
|
"source-map-loader": "~5.0.0",
|
|
73
75
|
"string-width": "<5.0.0",
|
|
74
76
|
"style-loader": "~4.0.0",
|
|
75
|
-
"stylelint": "~16.
|
|
77
|
+
"stylelint": "~16.12.0",
|
|
76
78
|
"swc-loader": "0.2.6",
|
|
77
|
-
"terser-webpack-plugin": "^5.3.
|
|
79
|
+
"terser-webpack-plugin": "^5.3.11",
|
|
78
80
|
"ts-jest": "29.2.5",
|
|
79
81
|
"ts-loader": "~9.5.1",
|
|
80
82
|
"ts-node": "~10.9.2",
|
|
81
83
|
"typed-css-modules": "~0.9.1",
|
|
82
|
-
"typescript": "5.
|
|
84
|
+
"typescript": "5.7.2",
|
|
83
85
|
"username": "~5.1.0",
|
|
84
|
-
"webpack": "~5.
|
|
86
|
+
"webpack": "~5.97.1",
|
|
85
87
|
"webpack-assets-manifest": "~5.2.1",
|
|
86
88
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
87
|
-
"webpack-dev-server": "~5.
|
|
89
|
+
"webpack-dev-server": "~5.2.0",
|
|
88
90
|
"webpack-filter-warnings-plugin": "~1.2.1",
|
|
89
91
|
"webpack-merge": "~6.0.1",
|
|
90
92
|
"webpack-virtual-modules": "~0.6.2",
|
|
@@ -102,5 +104,5 @@
|
|
|
102
104
|
"cli": {
|
|
103
105
|
"webpack": false
|
|
104
106
|
},
|
|
105
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "63ce3ca18966fc5522a3b61df5e4c55f82b4272e"
|
|
106
108
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
isExposeSharedDependencies,
|
|
11
11
|
loadSharedDependencies,
|
|
12
12
|
} from '../../utils';
|
|
13
|
+
import { getLaunchDarklySdkVersion } from '../configs/utils/get-launchdarkly-sdk-version';
|
|
13
14
|
import { getModuleEntryPath } from '../utils';
|
|
14
15
|
|
|
15
16
|
import { createWebpackConfig } from '../index';
|
|
@@ -34,6 +35,7 @@ jest.mock('../../utils', () => ({
|
|
|
34
35
|
isExposeSharedDependencies: jest.fn(),
|
|
35
36
|
loadSharedDependencies: jest.fn(),
|
|
36
37
|
}));
|
|
38
|
+
jest.mock('../configs/utils/get-launchdarkly-sdk-version');
|
|
37
39
|
jest.mock('../utils', () => ({
|
|
38
40
|
...jest.requireActual('../utils'),
|
|
39
41
|
featureCohort: jest.fn(),
|
|
@@ -85,7 +87,12 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
85
87
|
const subject = () => createWebpackConfig(overrides);
|
|
86
88
|
|
|
87
89
|
describe('when package exposes shared dependencies', () => {
|
|
88
|
-
|
|
90
|
+
const launchDarklySdkVersion = '3.0';
|
|
91
|
+
|
|
92
|
+
beforeEach(() => {
|
|
93
|
+
jest.mocked(isExposeSharedDependencies).mockReturnValue(true);
|
|
94
|
+
jest.mocked(getLaunchDarklySdkVersion).mockReturnValue(launchDarklySdkVersion);
|
|
95
|
+
});
|
|
89
96
|
|
|
90
97
|
test('configures "optimization.splitChunks.cacheGroups.design-system"', () => {
|
|
91
98
|
expect(
|
|
@@ -135,6 +142,17 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
135
142
|
);
|
|
136
143
|
});
|
|
137
144
|
|
|
145
|
+
test('configures EXPOSED_INSTANCE_DEPENDENCIES', () => {
|
|
146
|
+
expect(subject().plugins).toContainEqual(
|
|
147
|
+
new DefinePlugin({
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
149
|
+
EXPOSED_INSTANCE_DEPENDENCIES: JSON.stringify({
|
|
150
|
+
launchDarkly: { version: launchDarklySdkVersion },
|
|
151
|
+
}),
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
|
|
138
156
|
test('configures "design-system.css" rules', () => {
|
|
139
157
|
expect(subject().module?.rules).toContainEqual({
|
|
140
158
|
test: /design-system\.css$/,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DefinePlugin } from 'webpack';
|
|
2
|
+
import { Context, Overrides } from '../types';
|
|
3
|
+
import { getLaunchDarklySdkVersion } from '../utils/get-launchdarkly-sdk-version';
|
|
4
|
+
|
|
5
|
+
export function defineExposedInstanceDependenciesPlugin(context: Context, _: Overrides) {
|
|
6
|
+
const { isExposeSharedDependencies } = context;
|
|
7
|
+
if (!isExposeSharedDependencies) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const instanceDependencies = {
|
|
12
|
+
launchDarkly: { version: getLaunchDarklySdkVersion() },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return new DefinePlugin({
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
+
EXPOSED_INSTANCE_DEPENDENCIES: JSON.stringify(instanceDependencies),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -1,52 +1,61 @@
|
|
|
1
|
+
import { Context } from '../../../types';
|
|
1
2
|
import { checkResource } from '../check-resource';
|
|
3
|
+
import { isOptionalPeerDependency } from '../is-optional-peer-dependency';
|
|
2
4
|
import { isOptionalReactDomPeerDependency } from '../is-optional-react-dom-peer-dependency';
|
|
3
|
-
import { isOptionalAnvilPeerDependency } from '../is-optional-anvil-peer-dependency';
|
|
4
5
|
|
|
6
|
+
jest.mock('../is-optional-peer-dependency');
|
|
5
7
|
jest.mock('../is-optional-react-dom-peer-dependency');
|
|
6
|
-
jest.mock('../is-optional-anvil-peer-dependency');
|
|
7
|
-
|
|
8
|
-
type PackageContext = Parameters<typeof isOptionalAnvilPeerDependency>[0]['packageContext'];
|
|
9
8
|
|
|
10
9
|
describe(`${checkResource.name}`, () => {
|
|
11
|
-
|
|
12
|
-
let
|
|
10
|
+
const context = 'node_modules/web-components/dist';
|
|
11
|
+
let packageContext: Partial<Context>;
|
|
13
12
|
let resource: string;
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.resetAllMocks();
|
|
16
|
+
|
|
17
|
+
resource = '@servicetitan/foo';
|
|
18
|
+
packageContext = {
|
|
19
|
+
packageData: {
|
|
20
|
+
name: 'application',
|
|
21
|
+
dependencies: {},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const subject = () => checkResource(packageContext as any)(resource, context);
|
|
16
27
|
|
|
17
28
|
function itReturns(value: boolean) {
|
|
18
29
|
test(`returns ${value}`, () => expect(subject()).toBe(value));
|
|
19
30
|
}
|
|
20
31
|
|
|
21
|
-
|
|
22
|
-
beforeEach(() => jest.mocked(isOptionalAnvilPeerDependency).mockReturnValue(true));
|
|
32
|
+
itReturns(false);
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
describe('when resource is optional peer dependency', () => {
|
|
35
|
+
beforeEach(() => jest.mocked(isOptionalPeerDependency).mockReturnValue(true));
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
beforeEach(() => jest.mocked(isOptionalAnvilPeerDependency).mockReturnValue(false));
|
|
37
|
+
itReturns(true);
|
|
29
38
|
|
|
30
|
-
describe('when resource is
|
|
31
|
-
beforeEach(() =>
|
|
39
|
+
describe('when resource is package dependency', () => {
|
|
40
|
+
beforeEach(() => (packageContext.packageData!.dependencies[resource] = '*'));
|
|
32
41
|
|
|
33
42
|
itReturns(false);
|
|
34
43
|
});
|
|
44
|
+
});
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
describe('when resource is optional react-dom peer dependency', () => {
|
|
47
|
+
beforeEach(() => jest.mocked(isOptionalReactDomPeerDependency).mockReturnValue(true));
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
describe('when resource is present', () => {
|
|
50
|
+
beforeEach(() => (resource = 'fs'));
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
itReturns(false);
|
|
53
|
+
});
|
|
44
54
|
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
describe('when resource is not present', () => {
|
|
56
|
+
beforeEach(() => (resource = 'foo'));
|
|
47
57
|
|
|
48
|
-
|
|
49
|
-
});
|
|
58
|
+
itReturns(true);
|
|
50
59
|
});
|
|
51
60
|
});
|
|
52
61
|
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { vol, fs } from 'memfs';
|
|
2
|
+
import { getPackageJson } from '../get-package-json';
|
|
3
|
+
|
|
4
|
+
jest.mock('fs', () => fs);
|
|
5
|
+
|
|
6
|
+
describe(`[startup] ${getPackageJson.name}`, () => {
|
|
7
|
+
const packageJson = { name: 'foo' };
|
|
8
|
+
let context: string;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
context = 'node_modules/foo/dist';
|
|
12
|
+
vol.fromNestedJSON({
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
|
+
node_modules: { foo: { 'package.json': JSON.stringify(packageJson) } },
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const subject = () => getPackageJson(context);
|
|
19
|
+
|
|
20
|
+
function itReturnsPackageJson() {
|
|
21
|
+
test("returns dependency's package.json", () => {
|
|
22
|
+
expect(subject()).toEqual(packageJson);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function itReturnsUndefined() {
|
|
27
|
+
test('returns undefined', () => {
|
|
28
|
+
expect(subject()).toBeUndefined();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
itReturnsPackageJson();
|
|
33
|
+
|
|
34
|
+
describe('when dependency does not exist', () => {
|
|
35
|
+
beforeEach(() => fs.rmSync('node_modules/foo/package.json'));
|
|
36
|
+
|
|
37
|
+
itReturnsUndefined();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('when context is not in node_modules', () => {
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
context = 'foo/dist';
|
|
43
|
+
vol.fromNestedJSON({
|
|
44
|
+
foo: { 'package.json': JSON.stringify(packageJson) },
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
itReturnsUndefined();
|
|
49
|
+
|
|
50
|
+
describe('when context is in .yalc', () => {
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
context = '.yalc/foo/dist';
|
|
53
|
+
vol.fromNestedJSON({
|
|
54
|
+
'.yalc': { foo: { 'package.json': JSON.stringify(packageJson) } },
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
itReturnsPackageJson();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isOptionalPeerDependency } from '../is-optional-peer-dependency';
|
|
2
|
+
import { getPackageJson } from '../get-package-json';
|
|
3
|
+
|
|
4
|
+
jest.mock('../get-package-json');
|
|
5
|
+
|
|
6
|
+
describe(`[startup] ${isOptionalPeerDependency.name}`, () => {
|
|
7
|
+
let resource: string;
|
|
8
|
+
let context: string;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
resource = 'foo';
|
|
12
|
+
context = makeId(); // use unique context for each test because peerDependenciesMeta is memoized
|
|
13
|
+
jest.mocked(getPackageJson).mockReturnValue(undefined);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const subject = () => isOptionalPeerDependency(resource, context);
|
|
17
|
+
|
|
18
|
+
function itReturns(value: boolean) {
|
|
19
|
+
test(`returns ${value}`, () => {
|
|
20
|
+
expect(subject()).toBe(value);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
itReturns(false);
|
|
25
|
+
|
|
26
|
+
describe('when resource is optional peer dependency', () => {
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
jest.mocked(getPackageJson).mockImplementation(() => ({
|
|
29
|
+
peerDependenciesMeta: {
|
|
30
|
+
[resource]: { optional: true },
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
itReturns(true);
|
|
36
|
+
|
|
37
|
+
describe('when resource is not a package name', () => {
|
|
38
|
+
beforeEach(() => (resource = './foo'));
|
|
39
|
+
|
|
40
|
+
itReturns(false);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
function makeId() {
|
|
46
|
+
return Math.round(1e6 * Math.random()).toString(36);
|
|
47
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { log } from '../../../../utils';
|
|
1
2
|
import { Context } from '../../types';
|
|
2
|
-
import {
|
|
3
|
+
import { isOptionalPeerDependency } from './is-optional-peer-dependency';
|
|
3
4
|
import { isOptionalReactDomPeerDependency } from './is-optional-react-dom-peer-dependency';
|
|
4
5
|
|
|
5
6
|
export function checkResource(packageContext: Context) {
|
|
6
7
|
return function (resource: string, context: string) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (
|
|
9
|
+
!packageContext.packageData.dependencies[resource] &&
|
|
10
|
+
isOptionalPeerDependency(resource, context)
|
|
11
|
+
) {
|
|
12
|
+
log.debug('check-resource', `${JSON.stringify({ resource, context })} => true`);
|
|
12
13
|
return true;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { log, readJson } from '../../../../utils';
|
|
4
|
+
|
|
5
|
+
const containsNodeModules = /[\\/](node_modules|\.yalc)[\\/]/;
|
|
6
|
+
const isNodeModules = /(node_modules|\.yalc)/;
|
|
7
|
+
|
|
8
|
+
export function getPackageJson(context: string) {
|
|
9
|
+
const fullPath = path.resolve(context);
|
|
10
|
+
if (!containsNodeModules.test(fullPath)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let dirname = path.dirname(fullPath);
|
|
15
|
+
do {
|
|
16
|
+
const packageJsonFile = path.join(dirname, 'package.json');
|
|
17
|
+
if (fs.existsSync(packageJsonFile)) {
|
|
18
|
+
log.debug('get-package-json', `${context} => ${packageJsonFile}`);
|
|
19
|
+
return readJson<Record<string, any>>(packageJsonFile);
|
|
20
|
+
}
|
|
21
|
+
dirname = path.dirname(dirname);
|
|
22
|
+
} while (!isNodeModules.test(path.basename(dirname)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import memoize from 'lodash.memoize';
|
|
2
|
+
import { getPackageJson } from './get-package-json';
|
|
3
|
+
|
|
4
|
+
export function isOptionalPeerDependency(resource: string, context: string) {
|
|
5
|
+
return (
|
|
6
|
+
/^[@a-z]/.test(resource) && getPeerDependenciesMeta(context)?.[resource]?.optional === true
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const getPeerDependenciesMeta = memoize(function getPeerDependenciesMeta(context: string) {
|
|
11
|
+
return getPackageJson(context)?.peerDependenciesMeta;
|
|
12
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './assets-manifest-plugin';
|
|
2
2
|
export * from './bundle-analyser-plugin';
|
|
3
3
|
export * from './define-exposed-dependencies-plugin';
|
|
4
|
+
export * from './define-exposed-instance-dependencies-plugin';
|
|
4
5
|
export * from './define-web-component-name-plugin';
|
|
5
6
|
export * from './filter-warnings-plugin';
|
|
6
7
|
export * from './html-plugin';
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
assetsManifestPlugin,
|
|
4
4
|
bundleAnalyzerPlugin,
|
|
5
5
|
defineExposedDependenciesPlugin,
|
|
6
|
+
defineExposedInstanceDependenciesPlugin,
|
|
6
7
|
defineWebComponentNamePlugin,
|
|
7
8
|
filterWarningsPlugin,
|
|
8
9
|
htmlPlugin,
|
|
@@ -24,6 +25,7 @@ export function pluginsConfig(context: Context, overrides: Overrides): Result {
|
|
|
24
25
|
assetsManifestPlugin,
|
|
25
26
|
bundleAnalyzerPlugin,
|
|
26
27
|
defineExposedDependenciesPlugin,
|
|
28
|
+
defineExposedInstanceDependenciesPlugin,
|
|
27
29
|
defineWebComponentNamePlugin,
|
|
28
30
|
filterWarningsPlugin,
|
|
29
31
|
htmlPlugin,
|
|
@@ -31,7 +31,7 @@ export interface EntryPoints {
|
|
|
31
31
|
|
|
32
32
|
export interface Metadata {
|
|
33
33
|
name: string;
|
|
34
|
-
bundledWith: Record<string, string>;
|
|
34
|
+
bundledWith: Record<string, string | undefined>;
|
|
35
35
|
sharedDependencies: Record<string, string>;
|
|
36
36
|
dependencies: Record<string, string>;
|
|
37
37
|
entrypoints: EntryPoints;
|
|
@@ -3,12 +3,14 @@ import * as mockedFs from 'fs';
|
|
|
3
3
|
import { createPackage } from '../../../../__mocks__';
|
|
4
4
|
import { getStartupVersion } from '../../../../utils/get-startup-version';
|
|
5
5
|
import { Context } from '../../types';
|
|
6
|
+
import { getLaunchDarklySdkVersion } from '../get-launchdarkly-sdk-version';
|
|
6
7
|
import { getWebComponentsVersion } from '../get-web-components-version';
|
|
7
8
|
|
|
8
9
|
import { generateMetadata } from '../generate-metadata';
|
|
9
10
|
|
|
10
11
|
jest.mock('fs', () => fs);
|
|
11
12
|
jest.mock('../../../../utils/get-startup-version');
|
|
13
|
+
jest.mock('../get-launchdarkly-sdk-version');
|
|
12
14
|
jest.mock('../get-web-components-version');
|
|
13
15
|
|
|
14
16
|
describe(`[startup] ${generateMetadata.name}`, () => {
|
|
@@ -16,6 +18,7 @@ describe(`[startup] ${generateMetadata.name}`, () => {
|
|
|
16
18
|
const destination = 'dist';
|
|
17
19
|
const startupVersion = '1.0';
|
|
18
20
|
const webComponentsVersion = '2.0';
|
|
21
|
+
const launchDarklySdkVersion = '3.0';
|
|
19
22
|
let context: Partial<Context>;
|
|
20
23
|
|
|
21
24
|
function generatedMetadata(destination: string) {
|
|
@@ -30,6 +33,7 @@ describe(`[startup] ${generateMetadata.name}`, () => {
|
|
|
30
33
|
vol.fromJSON(packageFS());
|
|
31
34
|
jest.mocked(getStartupVersion).mockReturnValue(startupVersion);
|
|
32
35
|
jest.mocked(getWebComponentsVersion).mockReturnValue(webComponentsVersion);
|
|
36
|
+
jest.mocked(getLaunchDarklySdkVersion).mockReturnValue(launchDarklySdkVersion);
|
|
33
37
|
|
|
34
38
|
context = {
|
|
35
39
|
destination,
|
|
@@ -51,6 +55,7 @@ describe(`[startup] ${generateMetadata.name}`, () => {
|
|
|
51
55
|
bundledWith: {
|
|
52
56
|
'@servicetitan/startup': startupVersion,
|
|
53
57
|
'@servicetitan/web-components': webComponentsVersion,
|
|
58
|
+
'launchdarkly-js-client-sdk': launchDarklySdkVersion,
|
|
54
59
|
},
|
|
55
60
|
dependencies: context.packageData!.dependencies,
|
|
56
61
|
sharedDependencies: context.sharedDependencies,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import { getLaunchDarklySdkVersion } from '../get-launchdarkly-sdk-version';
|
|
3
|
+
|
|
4
|
+
jest.mock('fs', () => fs);
|
|
5
|
+
|
|
6
|
+
describe(`[startup] ${getLaunchDarklySdkVersion.name}`, () => {
|
|
7
|
+
const launchDarklySdkVersion = '1.2.3';
|
|
8
|
+
|
|
9
|
+
const subject = () => getLaunchDarklySdkVersion();
|
|
10
|
+
|
|
11
|
+
test('returns undefined', () => {
|
|
12
|
+
expect(subject()).toBeUndefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('when package is present', () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
vol.fromJSON({
|
|
18
|
+
'node_modules/launchdarkly-js-client-sdk/package.json': JSON.stringify({
|
|
19
|
+
version: launchDarklySdkVersion,
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => vol.reset());
|
|
25
|
+
|
|
26
|
+
test('returns version from launchdarkly-js-client-sdk package', () => {
|
|
27
|
+
expect(subject()).toEqual(launchDarklySdkVersion);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -3,6 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import { log, getStartupVersion, readJsonSafe } from '../../../utils';
|
|
4
4
|
import { Context, Metadata } from '../types';
|
|
5
5
|
|
|
6
|
+
import { getLaunchDarklySdkVersion } from './get-launchdarkly-sdk-version';
|
|
6
7
|
import { getWebComponentsVersion } from './get-web-components-version';
|
|
7
8
|
|
|
8
9
|
export function generateMetadata(context: Context) {
|
|
@@ -19,6 +20,7 @@ export function generateMetadata(context: Context) {
|
|
|
19
20
|
bundledWith: {
|
|
20
21
|
'@servicetitan/startup': getStartupVersion(),
|
|
21
22
|
'@servicetitan/web-components': getWebComponentsVersion(),
|
|
23
|
+
'launchdarkly-js-client-sdk': getLaunchDarklySdkVersion(),
|
|
22
24
|
},
|
|
23
25
|
sharedDependencies,
|
|
24
26
|
dependencies: packageData.dependencies,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { readJson } from '../../../utils';
|
|
3
|
+
|
|
4
|
+
export function getLaunchDarklySdkVersion() {
|
|
5
|
+
try {
|
|
6
|
+
return readJson<{ version: string }>(
|
|
7
|
+
path.join(
|
|
8
|
+
path.dirname(require.resolve('launchdarkly-js-client-sdk')),
|
|
9
|
+
'../package.json'
|
|
10
|
+
)
|
|
11
|
+
).version;
|
|
12
|
+
} catch {
|
|
13
|
+
// ignore
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import { readJson } from '../../../utils';
|
|
3
3
|
|
|
4
4
|
export function getWebComponentsVersion() {
|
|
5
|
-
return readJson(
|
|
5
|
+
return readJson<{ version: string }>(
|
|
6
6
|
path.join(path.dirname(require.resolve('@servicetitan/web-components')), '../package.json')
|
|
7
7
|
).version;
|
|
8
8
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Context } from '../../types';
|
|
2
|
-
interface Dependency {
|
|
3
|
-
context: string;
|
|
4
|
-
resource: string;
|
|
5
|
-
packageContext: Context;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Ignore any Anvil dependency used in register.tsx that is not in the package.json dependencies,
|
|
9
|
-
* so that register.tsx's web-components/anvil2 requires will fail
|
|
10
|
-
* @see {@link file://./../../../../../../web-components/src/register.tsx}
|
|
11
|
-
*/
|
|
12
|
-
export declare function isOptionalAnvilPeerDependency({ context, packageContext, resource }: Dependency): boolean;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=is-optional-anvil-peer-dependency.d.ts.map
|
package/dist/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-optional-anvil-peer-dependency.d.ts","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,UAAU,UAAU;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;CAC3B;AAID;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,UAAU,WAM9F"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isOptionalAnvilPeerDependency = isOptionalAnvilPeerDependency;
|
|
4
|
-
const optionalAnvilPeerDependencies = ['@servicetitan/design-system', '@servicetitan/anvil2'];
|
|
5
|
-
/**
|
|
6
|
-
* Ignore any Anvil dependency used in register.tsx that is not in the package.json dependencies,
|
|
7
|
-
* so that register.tsx's web-components/anvil2 requires will fail
|
|
8
|
-
* @see {@link file://./../../../../../../web-components/src/register.tsx}
|
|
9
|
-
*/
|
|
10
|
-
function isOptionalAnvilPeerDependency({ context, packageContext, resource }) {
|
|
11
|
-
return (optionalAnvilPeerDependencies.includes(resource) &&
|
|
12
|
-
/(@servicetitan|packages)[\\/](web-components)/.test(context) &&
|
|
13
|
-
!Object.keys(packageContext.packageData.dependencies).includes(resource));
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=is-optional-anvil-peer-dependency.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-optional-anvil-peer-dependency.js","sourceRoot":"","sources":["../../../../../src/webpack/configs/plugins/ignore-plugin/is-optional-anvil-peer-dependency.ts"],"names":[],"mappings":";;AAeA,sEAMC;AAbD,MAAM,6BAA6B,GAAG,CAAC,6BAA6B,EAAE,sBAAsB,CAAC,CAAC;AAE9F;;;;GAIG;AACH,SAAgB,6BAA6B,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAc;IAC3F,OAAO,CACH,6BAA6B,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAChD,+CAA+C,CAAC,IAAI,CAAC,OAAO,CAAC;QAC7D,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC3E,CAAC;AACN,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { isOptionalAnvilPeerDependency } from '../is-optional-anvil-peer-dependency';
|
|
2
|
-
|
|
3
|
-
type PackageContext = Parameters<typeof isOptionalAnvilPeerDependency>[0]['packageContext'];
|
|
4
|
-
|
|
5
|
-
describe(`${isOptionalAnvilPeerDependency.name}`, () => {
|
|
6
|
-
const subject = (...args: Parameters<typeof isOptionalAnvilPeerDependency>) =>
|
|
7
|
-
isOptionalAnvilPeerDependency(...args);
|
|
8
|
-
|
|
9
|
-
describe.each([
|
|
10
|
-
{
|
|
11
|
-
packageContextDependencyName: '@servicetitan/anvil2',
|
|
12
|
-
resource: '@servicetitan/design-system',
|
|
13
|
-
contexts: ['@servicetitan/web-components', 'uikit/packages/web-components/dist'],
|
|
14
|
-
expectedResult: true,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
packageContextDependencyName: '@servicetitan/design-system',
|
|
18
|
-
resource: '@servicetitan/anvil2',
|
|
19
|
-
contexts: ['@servicetitan/web-components', 'uikit/packages/web-components/dist'],
|
|
20
|
-
expectedResult: true,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
packageContextDependencyName: '@servicetitan/anvil2',
|
|
24
|
-
resource: '@servicetitan/anvil2',
|
|
25
|
-
contexts: ['@servicetitan/web-components', 'uikit/packages/web-components/dist'],
|
|
26
|
-
expectedResult: false,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
packageContextDependencyName: '@servicetitan/anvil2',
|
|
30
|
-
resource: '@servicetitan/design-system',
|
|
31
|
-
contexts: ['@servicetitan/anvil2/Button'],
|
|
32
|
-
expectedResult: false,
|
|
33
|
-
},
|
|
34
|
-
])(
|
|
35
|
-
'with required dependency "$resource" and package.json dependencies containing "$packageContextDependencyName"',
|
|
36
|
-
({ packageContextDependencyName, resource, contexts, expectedResult }) => {
|
|
37
|
-
contexts.forEach(context => {
|
|
38
|
-
test(`with context ${context}, returns ${expectedResult}`, () => {
|
|
39
|
-
expect(
|
|
40
|
-
subject({
|
|
41
|
-
packageContext: {
|
|
42
|
-
packageData: {
|
|
43
|
-
dependencies: { [packageContextDependencyName]: 'x.x.x' },
|
|
44
|
-
},
|
|
45
|
-
} as unknown as PackageContext,
|
|
46
|
-
resource,
|
|
47
|
-
context,
|
|
48
|
-
})
|
|
49
|
-
).toBe(expectedResult);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Context } from '../../types';
|
|
2
|
-
|
|
3
|
-
interface Dependency {
|
|
4
|
-
context: string;
|
|
5
|
-
resource: string;
|
|
6
|
-
packageContext: Context;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const optionalAnvilPeerDependencies = ['@servicetitan/design-system', '@servicetitan/anvil2'];
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Ignore any Anvil dependency used in register.tsx that is not in the package.json dependencies,
|
|
13
|
-
* so that register.tsx's web-components/anvil2 requires will fail
|
|
14
|
-
* @see {@link file://./../../../../../../web-components/src/register.tsx}
|
|
15
|
-
*/
|
|
16
|
-
export function isOptionalAnvilPeerDependency({ context, packageContext, resource }: Dependency) {
|
|
17
|
-
return (
|
|
18
|
-
optionalAnvilPeerDependencies.includes(resource) &&
|
|
19
|
-
/(@servicetitan|packages)[\\/](web-components)/.test(context) &&
|
|
20
|
-
!Object.keys(packageContext.packageData.dependencies).includes(resource)
|
|
21
|
-
);
|
|
22
|
-
}
|