@unisphere/cli 1.20.0 → 1.20.1

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.
@@ -9,8 +9,8 @@ const shim = require('rollup-plugin-shim');
9
9
  const { withNx } = require('@nx/rollup/with-nx');
10
10
  const url = require('@rollup/plugin-url');
11
11
  const svg = require('@svgr/rollup');
12
- const { findUnisphereWorkspaceFile } = require('../../src/lib/utils/unisphere/find-unisphere-workspace-file');
13
12
  const { getEnvVariables } = require('../../src/lib/utils/unisphere/get-env-variables');
13
+ const { getUnisphereWorkspaceFile } = require('../../src/lib/utils/unisphere/unisphere-workspace-file');
14
14
 
15
15
  const { envVariables, isUnisphereEnvironment } = getEnvVariables();
16
16
 
@@ -26,31 +26,23 @@ const isProduction = envVariables.UNISPHERE_ENV === 'production';
26
26
  console.log('[unisphere] Helpful Tip: When running a build if it is using outdated rollup file, you should clear the nx cache by running `rm -rf node_modules/.cache/nx && npx nx reset`.');
27
27
 
28
28
 
29
- const getUnisphereTSInterceptorsConfig = () => {
29
+ const getUnisphereTSInterceptorsConfig = (unispherePackagesDistList) => {
30
30
  return {
31
31
  interceptors: {
32
32
  compilerOptions : (options) => {
33
33
  // Monkey patch TS paths for shared libraries to be consumed by contexts from dist like other dependencies
34
- // const sharedPackagesPath = path.resolve(__dirname, '../../../unisphere/shared-packages');
35
- // const sharedPackages = fs.readdirSync(sharedPackagesPath)
36
- // .filter(folder => fs.statSync(path.join(sharedPackagesPath, folder)).isDirectory())
37
- // .reduce((acc, folder) => {
38
- // const packageJsonPath = path.join(sharedPackagesPath, folder, 'package.json');
39
- // if (fs.existsSync(packageJsonPath)) {
40
- // const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
41
- // acc[packageJson.name] = [`dist/unisphere/shared-packages/${folder}`];
42
- // }
43
- // return acc;
44
- // }, {});
45
-
46
- const sharedPackages = {};
47
-
48
- console.log(`mapping shared packages to dist folders:`, sharedPackages)
34
+ const projectPackages = unispherePackagesDistList.reduce((acc, item) => {
35
+ acc[item.packageName] = [item.distPath];
36
+ return acc;
37
+ }, {});
38
+
39
+ console.log(`mapping project packages to dist folders:`, projectPackages)
40
+
49
41
  const result = {
50
42
  ...options,
51
43
  paths: {
52
44
  ...options.paths,
53
- ...sharedPackages
45
+ ...projectPackages
54
46
  }
55
47
  };
56
48
 
@@ -62,7 +54,7 @@ const getUnisphereTSInterceptorsConfig = () => {
62
54
 
63
55
  const getWithNx = (unisphereConfig) => {
64
56
 
65
- const relativeSourcePath = path.relative(unisphereConfig.cwd, unisphereConfig.repositoryRootPath);
57
+ const relativeSourcePath = path.relative(unisphereConfig.cwd, unisphereConfig.workspaceConfiguration.cwd);
66
58
 
67
59
  const outputPath = `${relativeSourcePath}/dist/${unisphereConfig.sourcePath.join('/')}`;
68
60
 
@@ -88,13 +80,15 @@ const getWithNx = (unisphereConfig) => {
88
80
  }),
89
81
  ]
90
82
  }
91
-
83
+
92
84
  if (isDeployingContext) {
93
- secondArgument.unisphere = getUnisphereTSInterceptorsConfig();
94
- return withUnisphere(unisphereConfig, withNx(
85
+ const unispherePackagesDistList = getUnispherePackagesDistList(unisphereConfig.workspaceConfiguration.cwd);
86
+
87
+ secondArgument.unisphere = getUnisphereTSInterceptorsConfig(unispherePackagesDistList);
88
+ return withUnisphere(withNx(
95
89
  firstArgument,
96
90
  secondArgument
97
- ));
91
+ ), unispherePackagesDistList);
98
92
  }
99
93
 
100
94
  return withNx(
@@ -103,7 +97,7 @@ const getWithNx = (unisphereConfig) => {
103
97
  );
104
98
  }
105
99
 
106
- function getSubfoldersWithPackageNames(cwd) {
100
+ function getUnispherePackagesDistList(cwd) {
107
101
 
108
102
  const folderPattern = path.resolve(cwd, 'dist/unisphere/packages/*');
109
103
 
@@ -112,26 +106,25 @@ function getSubfoldersWithPackageNames(cwd) {
112
106
  const result = [];
113
107
 
114
108
  // Iterate through each subfolder
115
- folderPaths.forEach(folderPath => {
116
- const packageJsonPath = path.join(folderPath, 'package.json');
109
+ folderPaths.forEach(distPath => {
110
+ const packageJsonPath = path.join(distPath, 'package.json');
117
111
  if (fs.existsSync(packageJsonPath)) {
118
112
  // Read and parse the package.json file
119
113
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
120
114
  const packageName = packageJson.name;
121
115
 
122
116
  if (packageName) {
123
- result.push({folderName: path.join(folderPath), packageName});
117
+ result.push({distPath, packageName});
124
118
  }
125
119
  }
126
120
  });
127
121
 
122
+ console.log('[unisphere] found packages', result);
123
+
128
124
  return result;
129
125
  }
130
126
 
131
- const withUnisphere = (unisphereConfig, rollupConfig) => {
132
-
133
- const subfoldersWithPackageNames = getSubfoldersWithPackageNames(unisphereConfig.repositoryRootPath);
134
-
127
+ const withUnisphere = (rollupConfig, unispherePackagesDistList) => {
135
128
 
136
129
  console.log('[unisphere] removing unisphere config used to monkey patch @nw/rollup');
137
130
  delete rollupConfig.unisphere;
@@ -152,8 +145,8 @@ const withUnisphere = (unisphereConfig, rollupConfig) => {
152
145
 
153
146
  rollupConfig.plugins.push(
154
147
  alias({
155
- entries: subfoldersWithPackageNames.map(item => {
156
- return {find: item.packageName, replacement: item.folderName}
148
+ entries: unispherePackagesDistList.map(item => {
149
+ return {find: item.packageName, replacement: item.distPath}
157
150
  })
158
151
  }),
159
152
  analyze({
@@ -181,29 +174,28 @@ module.exports = (unisphereConfig) => {
181
174
 
182
175
  console.log('[unisphere] unisphere rollup args before stripping', unisphereConfig);
183
176
 
184
- const repositoryRootPath = findUnisphereWorkspaceFile(unisphereConfig.cwd);
177
+ const workspaceConfiguration = getUnisphereWorkspaceFile(unisphereConfig.cwd);
185
178
 
186
- if (!repositoryRootPath) {
179
+ if (!workspaceConfiguration) {
187
180
  throw new Error('the library must be run from the root of the unisphere workspace');
188
181
  }
189
-
190
182
 
191
183
  const projectJsonPath = path.join(unisphereConfig.cwd, 'project.json');
192
184
 
193
185
  const projectJson = JSON.parse(fs.readFileSync(projectJsonPath, 'utf8'));
194
186
  const sourcePath = projectJson.sourceRoot.replace(/\/src$/, '').split('/');
195
187
 
196
-
197
188
  const expectedType = (unisphereConfig.allowedType || 'contexts');
198
189
  const pathCheck = unisphereConfig.bypassPathHierarchyCheck ? true : (sourcePath.length === 3);
199
190
  if (!pathCheck || sourcePath[0] !== 'unisphere' || sourcePath[1] !== expectedType) {
200
191
  throw new Error(`sourcePath must follow pattern unisphere/${expectedType}/<context-name>, got ${sourcePath.join('/')}`)
201
192
  }
202
193
 
194
+ // todo can improve code readability by moving the calculation of the 'outputPath' here instead of in getWithNx
203
195
  return getWithNx(
204
196
  {
205
197
  ...unisphereConfig,
206
- repositoryRootPath,
198
+ workspaceConfiguration,
207
199
  sourcePath
208
200
  }
209
201
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/cli",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "bin": {
5
5
  "unisphere": "./src/index.js"
6
6
  },
@@ -18,6 +18,7 @@ interface AugmentedUnisphereElement {
18
18
  }
19
19
  export declare const UnisphereRepositoryFileSchema: Schema;
20
20
  export interface UnisphereRepositoryFile {
21
+ cwd: string;
21
22
  name: string;
22
23
  type?: 'widget' | 'core';
23
24
  company: string;
@@ -4,6 +4,7 @@ exports.UnisphereRepositoryFileSchema = void 0;
4
4
  exports.UnisphereRepositoryFileSchema = {
5
5
  type: 'object',
6
6
  properties: {
7
+ cwd: { type: 'primitive', value: 'string' },
7
8
  company: { type: 'primitive', value: 'string' },
8
9
  name: { type: 'primitive', value: 'string' },
9
10
  type: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/types.ts"],"names":[],"mappings":";;;AAuBa,QAAA,6BAA6B,GAAW;IACnD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;Q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;oBACD,QAAQ,EAAE,IAAI;iBACf;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,KAAK;oBACX,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;4BAClD,mBAAmB,EAAE;gCACnB,IAAI,EAAE,MAAM;gCACZ,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;6BAC9B;yBACF;qBACF;oBACD,QAAQ,EAAE,IAAI;iBACf;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,UAAU,EAAE;wBACV,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;wBAClD,mBAAmB,EAAE;4BACnB,IAAI,EAAE,MAAM;4BACZ,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;yBAC9B;qBACF;iBACF;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,UAAU,EAAE;wBACV,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;wBAClD,mBAAmB,EAAE;4BACnB,IAAI,EAAE,MAAM;4BACZ,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;yBAC9B;qBACF;iBACF;aACF;YACD,sBAAsB,EAAE,KAAK;SAC9B;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/types.ts"],"names":[],"mappings":";;;AAuBa,QAAA,6BAA6B,GAAW;IACnD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC3C,OAAO,EAAE,EAAE,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AAC,QAAQ,EAAE,QAAQ,CAAC;6BAC7B;yBACF;qBACF;oBACD,QAAQ,EAAE,IAAI;iBACf;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,KAAK;oBACX,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;4BAClD,mBAAmB,EAAE;gCACnB,IAAI,EAAE,MAAM;gCACZ,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;6BAC9B;yBACF;qBACF;oBACD,QAAQ,EAAE,IAAI;iBACf;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,UAAU,EAAE;wBACV,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;wBAClD,mBAAmB,EAAE;4BACnB,IAAI,EAAE,MAAM;4BACZ,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;yBAC9B;qBACF;iBACF;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,IAAI;oBACd,UAAU,EAAE;wBACV,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;wBAClD,mBAAmB,EAAE;4BACnB,IAAI,EAAE,MAAM;4BACZ,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC;yBAC9B;qBACF;iBACF;aACF;YACD,sBAAsB,EAAE,KAAK;SAC9B;KACF;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { UnisphereRepositoryFile } from './types';
2
+ export declare function getUnisphereWorkspaceFile(dir?: string, suspendRecursion?: boolean): UnisphereRepositoryFile | null;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUnisphereWorkspaceFile = exports.findUnisphereWorkspaceFile = void 0;
3
+ exports.getUnisphereWorkspaceFile = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
6
  const process = require("process");
7
7
  const createDebug = require("debug");
8
+ const read_json_file_1 = require("../read-json-file");
8
9
  const debug = createDebug('unisphere:utils:unisphere:find-unisphere-workspace-file');
9
10
  function findUnisphereWorkspaceFile(dir = process.cwd(), suspendRecursion = false) {
10
11
  const filePath = path.join(dir, '.unisphere');
@@ -23,13 +24,13 @@ function findUnisphereWorkspaceFile(dir = process.cwd(), suspendRecursion = fals
23
24
  // Recursively search in the parent directory
24
25
  return findUnisphereWorkspaceFile(parentDir);
25
26
  }
26
- exports.findUnisphereWorkspaceFile = findUnisphereWorkspaceFile;
27
- function getUnisphereWorkspaceFile(dir = process.cwd()) {
28
- const unisphereWorkspace = findUnisphereWorkspaceFile(dir);
29
- if (!unisphereWorkspace) {
30
- return null;
27
+ function getUnisphereWorkspaceFile(dir = process.cwd(), suspendRecursion = false) {
28
+ const repositoryRootPath = findUnisphereWorkspaceFile(dir, suspendRecursion);
29
+ if (!repositoryRootPath) {
30
+ throw new Error('Failed to find repository root path');
31
31
  }
32
- return path.join(unisphereWorkspace, '.unisphere');
32
+ const workspaceConfigurationPath = path.join(repositoryRootPath, '.unisphere');
33
+ return Object.assign(Object.assign({}, (0, read_json_file_1.readJsonFile)(workspaceConfigurationPath)), { cwd: repositoryRootPath });
33
34
  }
34
35
  exports.getUnisphereWorkspaceFile = getUnisphereWorkspaceFile;
35
- //# sourceMappingURL=find-unisphere-workspace-file.js.map
36
+ //# sourceMappingURL=unisphere-workspace-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unisphere-workspace-file.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/unisphere-workspace-file.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,mCAAmC;AACnC,qCAAqC;AACrC,sDAAiD;AAGjD,MAAM,KAAK,GAAG,WAAW,CACvB,yDAAyD,CAC1D,CAAC;AAEF,SAAS,0BAA0B,CACjC,MAAc,OAAO,CAAC,GAAG,EAAE,EAC3B,mBAA4B,KAAK;IAEjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAE9C,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC3B,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;QAClD,OAAO,GAAG,CAAC,CAAC,8CAA8C;KAC3D;IAED,IAAI,gBAAgB,EAAE;QACpB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAE1C,IAAI,SAAS,KAAK,GAAG,EAAE;QACrB,4DAA4D;QAC5D,OAAO,IAAI,CAAC;KACb;IAED,6CAA6C;IAC7C,OAAO,0BAA0B,CAAC,SAAS,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,yBAAyB,CACvC,MAAc,OAAO,CAAC,GAAG,EAAE,EAC3B,mBAA4B,KAAK;IAEjC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAE7E,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACxD;IAED,MAAM,0BAA0B,GAAG,IAAI,CAAC,IAAI,CAC1C,kBAAkB,EAClB,YAAY,CACb,CAAC;IAEF,uCACK,IAAA,6BAAY,EAAC,0BAA0B,CAAC,KAC3C,GAAG,EAAE,kBAAkB,IACvB;AACJ,CAAC;AAnBD,8DAmBC"}
@@ -2,9 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUnisphereWorkspace = exports.getRuntimeBucketKey = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const find_unisphere_workspace_file_1 = require("./find-unisphere-workspace-file");
6
- const path = require("path");
7
- const read_json_file_1 = require("../read-json-file");
5
+ const unisphere_workspace_file_1 = require("./unisphere-workspace-file");
8
6
  const debug_1 = require("debug");
9
7
  const types_1 = require("./types");
10
8
  const prompts_1 = require("../prompts/prompts");
@@ -16,12 +14,7 @@ exports.getRuntimeBucketKey = getRuntimeBucketKey;
16
14
  const getUnisphereWorkspace = (cwd, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
17
15
  var _a;
18
16
  debug('looking for workspace root (assume root contains file named .unisphere)');
19
- const repositoryRootPath = (0, find_unisphere_workspace_file_1.findUnisphereWorkspaceFile)(cwd, (_a = options === null || options === void 0 ? void 0 : options.suspendRecursion) !== null && _a !== void 0 ? _a : false);
20
- if (!repositoryRootPath) {
21
- throw new Error('Failed to find repository root path');
22
- }
23
- const workspaceConfigurationPath = path.join(repositoryRootPath, '.unisphere');
24
- const workspaceConfiguration = yield (0, read_json_file_1.readJsonFile)(workspaceConfigurationPath);
17
+ const workspaceConfiguration = (0, unisphere_workspace_file_1.getUnisphereWorkspaceFile)(cwd, (_a = options === null || options === void 0 ? void 0 : options.suspendRecursion) !== null && _a !== void 0 ? _a : false);
25
18
  if (!workspaceConfiguration) {
26
19
  (0, prompts_1.logErrorAndExit)('Failed to read workspace configuration');
27
20
  }
@@ -36,10 +29,10 @@ const getUnisphereWorkspace = (cwd, options) => tslib_1.__awaiter(void 0, void 0
36
29
  if (!['kaltura', 'unisphere'].includes(workspaceConfiguration.company)) {
37
30
  (0, prompts_1.logErrorAndExit)(`Only Kaltura widgets are supported, got '${workspaceConfiguration.company}'`);
38
31
  }
39
- const config = (0, augment_workspace_config_1.augmentWorkspaceConfig)(repositoryRootPath, workspaceConfiguration);
32
+ const config = (0, augment_workspace_config_1.augmentWorkspaceConfig)(workspaceConfiguration.cwd, workspaceConfiguration);
40
33
  return {
41
34
  repository: {
42
- repositoryRootPath,
35
+ repositoryRootPath: workspaceConfiguration.cwd,
43
36
  },
44
37
  config,
45
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/workspace.ts"],"names":[],"mappings":";;;;AAAA,mFAA6E;AAC7E,6BAA6B;AAC7B,sDAAiD;AACjD,iCAA0B;AAE1B,mCAIiB;AACjB,gDAAiE;AACjE,yEAAoE;AACpE,4CAA8C;AAE9C,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,2BAA2B,CAAC,CAAC;AAE1C,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC;AAA9C,QAAA,mBAAmB,uBAA2B;AAEpD,MAAM,qBAAqB,GAAG,CACnC,GAAW,EACX,OAEC,EAC4B,EAAE;;IAC/B,KAAK,CACH,yEAAyE,CAC1E,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,0DAA0B,EACnD,GAAG,EACH,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,mCAAI,KAAK,CACnC,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACxD;IAED,MAAM,0BAA0B,GAAG,IAAI,CAAC,IAAI,CAC1C,kBAAkB,EAClB,YAAY,CACb,CAAC;IACF,MAAM,sBAAsB,GAA4B,MAAM,IAAA,6BAAY,EACxE,0BAA0B,CAC3B,CAAC;IAEF,IAAI,CAAC,sBAAsB,EAAE;QAC3B,IAAA,yBAAe,EAAC,wCAAwC,CAAC,CAAC;KAC3D;IAED,MAAM,gBAAgB,GAAG,IAAA,0BAAc,EACrC,sBAAsB,EACtB,qCAA6B,EAC7B,yBAAyB,CAC1B,CAAC;IAEF,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAC1C,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACjC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QACH,IAAA,yBAAe,EAAC,iCAAiC,CAAC,CAAC;KACpD;IAED,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE;QACtE,IAAA,yBAAe,EACb,4CAA4C,sBAAsB,CAAC,OAAO,GAAG,CAC9E,CAAC;KACH;IAED,MAAM,MAAM,GAAG,IAAA,iDAAsB,EACnC,kBAAkB,EAClB,sBAAsB,CACvB,CAAC;IAEF,OAAO;QACL,UAAU,EAAE;YACV,kBAAkB;SACnB;QACD,MAAM;KACP,CAAC;AACJ,CAAC,CAAA,CAAC;AA7DW,QAAA,qBAAqB,yBA6DhC"}
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/workspace.ts"],"names":[],"mappings":";;;;AAAA,yEAAuE;AACvE,iCAA0B;AAC1B,mCAA4E;AAC5E,gDAAiE;AACjE,yEAAoE;AACpE,4CAA8C;AAE9C,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,2BAA2B,CAAC,CAAC;AAE1C,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC;AAA9C,QAAA,mBAAmB,uBAA2B;AAEpD,MAAM,qBAAqB,GAAG,CACnC,GAAW,EACX,OAEC,EAC4B,EAAE;;IAC/B,KAAK,CACH,yEAAyE,CAC1E,CAAC;IAEF,MAAM,sBAAsB,GAAG,IAAA,oDAAyB,EACtD,GAAG,EACH,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,mCAAI,KAAK,CACnC,CAAC;IAEF,IAAI,CAAC,sBAAsB,EAAE;QAC3B,IAAA,yBAAe,EAAC,wCAAwC,CAAC,CAAC;KAC3D;IAED,MAAM,gBAAgB,GAAG,IAAA,0BAAc,EACrC,sBAAsB,EACtB,qCAA6B,EAC7B,yBAAyB,CAC1B,CAAC;IAEF,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAC1C,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACjC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QACH,IAAA,yBAAe,EAAC,iCAAiC,CAAC,CAAC;KACpD;IAED,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE;QACtE,IAAA,yBAAe,EACb,4CAA4C,sBAAsB,CAAC,OAAO,GAAG,CAC9E,CAAC;KACH;IAED,MAAM,MAAM,GAAG,IAAA,iDAAsB,EACnC,sBAAsB,CAAC,GAAG,EAC1B,sBAAsB,CACvB,CAAC;IAEF,OAAO;QACL,UAAU,EAAE;YACV,kBAAkB,EAAE,sBAAsB,CAAC,GAAG;SAC/C;QACD,MAAM;KACP,CAAC;AACJ,CAAC,CAAA,CAAC;AAlDW,QAAA,qBAAqB,yBAkDhC"}
@@ -1,2 +0,0 @@
1
- export declare function findUnisphereWorkspaceFile(dir?: string, suspendRecursion?: boolean): string | null;
2
- export declare function getUnisphereWorkspaceFile(dir?: string): string | null;
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-unisphere-workspace-file.js","sourceRoot":"","sources":["../../../../../../../packages/unisphere-cli/src/lib/utils/unisphere/find-unisphere-workspace-file.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,mCAAmC;AACnC,qCAAqC;AAErC,MAAM,KAAK,GAAG,WAAW,CAAC,yDAAyD,CAAC,CAAC;AAErF,SAAgB,0BAA0B,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE,EAAE,mBAA4B,KAAK;IACvG,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAE9C,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC3B,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;QAClD,OAAO,GAAG,CAAC,CAAE,8CAA8C;KAC5D;IAED,IAAI,gBAAgB,EAAE;QACpB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAE1C,IAAI,SAAS,KAAK,GAAG,EAAE;QACrB,4DAA4D;QAC5D,OAAO,IAAI,CAAC;KACb;IAED,6CAA6C;IAC7C,OAAO,0BAA0B,CAAC,SAAS,CAAC,CAAC;AAC/C,CAAC;AArBD,gEAqBC;AAED,SAAgB,yBAAyB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACnE,MAAM,kBAAkB,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAC;IAC3D,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;AACrD,CAAC;AAND,8DAMC"}