@teambit/bit 0.0.557 → 0.0.561

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/bit",
3
- "version": "0.0.557",
3
+ "version": "0.0.561",
4
4
  "homepage": "https://bit.dev/teambit/harmony/bit",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "bit",
9
- "version": "0.0.557"
9
+ "version": "0.0.561"
10
10
  },
11
11
  "dependencies": {
12
12
  "v8-compile-cache": "2.2.0",
@@ -25,78 +25,78 @@
25
25
  "reflect-metadata": "0.1.13",
26
26
  "browserslist": "4.16.3",
27
27
  "graphql": "14.7.0",
28
- "@teambit/legacy": "1.0.172",
28
+ "@teambit/legacy": "1.0.175",
29
29
  "@apollo/client": "3.3.6",
30
30
  "@babel/runtime": "7.12.18",
31
- "@teambit/cli": "0.0.386",
32
- "@teambit/aspect-loader": "0.0.555",
33
- "@teambit/config": "0.0.397",
34
- "@teambit/legacy-bit-id": "0.0.375",
35
- "@teambit/application": "0.0.197",
36
- "@teambit/aspect": "0.0.555",
37
- "@teambit/babel": "0.0.555",
38
- "@teambit/builder": "0.0.555",
39
- "@teambit/bundler": "0.0.555",
40
- "@teambit/cache": "0.0.471",
41
- "@teambit/changelog": "0.0.555",
42
- "@teambit/code": "0.0.555",
43
- "@teambit/command-bar": "0.0.555",
44
- "@teambit/compiler": "0.0.555",
45
- "@teambit/component-tree": "0.0.372",
46
- "@teambit/component": "0.0.555",
47
- "@teambit/compositions": "0.0.555",
48
- "@teambit/dependency-resolver": "0.0.555",
49
- "@teambit/deprecation": "0.0.555",
50
- "@teambit/dev-files": "0.0.555",
51
- "@teambit/docs": "0.0.555",
52
- "@teambit/eject": "0.0.55",
53
- "@teambit/elements": "0.0.8",
54
- "@teambit/envs": "0.0.555",
55
- "@teambit/eslint": "0.0.555",
56
- "@teambit/export": "0.0.555",
57
- "@teambit/express": "0.0.475",
58
- "@teambit/formatter": "0.0.106",
59
- "@teambit/generator": "0.0.555",
60
- "@teambit/global-config": "0.0.387",
61
- "@teambit/graph": "0.0.555",
62
- "@teambit/graphql": "0.0.555",
63
- "@teambit/harmony-ui-app": "0.0.197",
64
- "@teambit/html": "0.0.123",
65
- "@teambit/importer": "0.0.13",
66
- "@teambit/insights": "0.0.555",
67
- "@teambit/isolator": "0.0.555",
68
- "@teambit/jest": "0.0.555",
69
- "@teambit/lanes": "0.0.127",
70
- "@teambit/linter": "0.0.555",
71
- "@teambit/logger": "0.0.471",
72
- "@teambit/mdx": "0.0.535",
73
- "@teambit/multi-compiler": "0.0.555",
74
- "@teambit/node": "0.0.555",
75
- "@teambit/notifications": "0.0.555",
76
- "@teambit/panels": "0.0.386",
77
- "@teambit/pkg": "0.0.555",
78
- "@teambit/pnpm": "0.0.555",
79
- "@teambit/prettier": "0.0.106",
80
- "@teambit/preview": "0.0.555",
81
- "@teambit/pubsub": "0.0.555",
82
- "@teambit/react-elements": "0.0.8",
83
- "@teambit/react-native": "0.0.555",
84
- "@teambit/react-router": "0.0.555",
85
- "@teambit/react": "0.0.555",
86
- "@teambit/schema": "0.0.555",
87
- "@teambit/scope": "0.0.555",
88
- "@teambit/sidebar": "0.0.555",
89
- "@teambit/sign": "0.0.555",
90
- "@teambit/tester": "0.0.555",
91
- "@teambit/typescript": "0.0.555",
92
- "@teambit/ui": "0.0.555",
93
- "@teambit/update-dependencies": "0.0.555",
94
- "@teambit/user-agent": "0.0.241",
95
- "@teambit/variants": "0.0.473",
96
- "@teambit/webpack": "0.0.555",
97
- "@teambit/worker": "0.0.555",
98
- "@teambit/workspace": "0.0.555",
99
- "@teambit/yarn": "0.0.556"
31
+ "@teambit/cli": "0.0.389",
32
+ "@teambit/aspect-loader": "0.0.559",
33
+ "@teambit/config": "0.0.400",
34
+ "@teambit/legacy-bit-id": "0.0.378",
35
+ "@teambit/application": "0.0.201",
36
+ "@teambit/aspect": "0.0.559",
37
+ "@teambit/babel": "0.0.559",
38
+ "@teambit/builder": "0.0.559",
39
+ "@teambit/bundler": "0.0.559",
40
+ "@teambit/cache": "0.0.474",
41
+ "@teambit/changelog": "0.0.559",
42
+ "@teambit/code": "0.0.559",
43
+ "@teambit/command-bar": "0.0.559",
44
+ "@teambit/compiler": "0.0.559",
45
+ "@teambit/component-tree": "0.0.375",
46
+ "@teambit/component": "0.0.559",
47
+ "@teambit/compositions": "0.0.559",
48
+ "@teambit/dependency-resolver": "0.0.559",
49
+ "@teambit/deprecation": "0.0.559",
50
+ "@teambit/dev-files": "0.0.559",
51
+ "@teambit/docs": "0.0.559",
52
+ "@teambit/eject": "0.0.58",
53
+ "@teambit/elements": "0.0.12",
54
+ "@teambit/envs": "0.0.559",
55
+ "@teambit/eslint": "0.0.559",
56
+ "@teambit/export": "0.0.559",
57
+ "@teambit/express": "0.0.478",
58
+ "@teambit/formatter": "0.0.110",
59
+ "@teambit/generator": "0.0.559",
60
+ "@teambit/global-config": "0.0.390",
61
+ "@teambit/graph": "0.0.559",
62
+ "@teambit/graphql": "0.0.559",
63
+ "@teambit/harmony-ui-app": "0.0.201",
64
+ "@teambit/html": "0.0.127",
65
+ "@teambit/importer": "0.0.16",
66
+ "@teambit/insights": "0.0.559",
67
+ "@teambit/isolator": "0.0.559",
68
+ "@teambit/jest": "0.0.559",
69
+ "@teambit/lanes": "0.0.131",
70
+ "@teambit/linter": "0.0.559",
71
+ "@teambit/logger": "0.0.474",
72
+ "@teambit/mdx": "0.0.539",
73
+ "@teambit/multi-compiler": "0.0.559",
74
+ "@teambit/node": "0.0.559",
75
+ "@teambit/notifications": "0.0.559",
76
+ "@teambit/panels": "0.0.389",
77
+ "@teambit/pkg": "0.0.559",
78
+ "@teambit/pnpm": "0.0.559",
79
+ "@teambit/prettier": "0.0.110",
80
+ "@teambit/preview": "0.0.559",
81
+ "@teambit/pubsub": "0.0.559",
82
+ "@teambit/react-elements": "0.0.12",
83
+ "@teambit/react-native": "0.0.559",
84
+ "@teambit/react-router": "0.0.559",
85
+ "@teambit/react": "0.0.559",
86
+ "@teambit/schema": "0.0.559",
87
+ "@teambit/scope": "0.0.559",
88
+ "@teambit/sidebar": "0.0.559",
89
+ "@teambit/sign": "0.0.559",
90
+ "@teambit/tester": "0.0.559",
91
+ "@teambit/typescript": "0.0.559",
92
+ "@teambit/ui": "0.0.559",
93
+ "@teambit/update-dependencies": "0.0.559",
94
+ "@teambit/user-agent": "0.0.245",
95
+ "@teambit/variants": "0.0.476",
96
+ "@teambit/webpack": "0.0.559",
97
+ "@teambit/worker": "0.0.559",
98
+ "@teambit/workspace": "0.0.559",
99
+ "@teambit/yarn": "0.0.560"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@types/react": "^17.0.8",
@@ -107,7 +107,7 @@
107
107
  "@types/node": "12.20.4"
108
108
  },
109
109
  "peerDependencies": {
110
- "@teambit/legacy": "1.0.172"
110
+ "@teambit/legacy": "1.0.175"
111
111
  },
112
112
  "license": "Apache-2.0",
113
113
  "bit": {
@@ -127,7 +127,7 @@
127
127
  "reflect-metadata": "0.1.13",
128
128
  "browserslist": "4.16.3",
129
129
  "graphql": "14.7.0",
130
- "@teambit/legacy": "1.0.172",
130
+ "@teambit/legacy": "1.0.175",
131
131
  "@apollo/client": "3.3.6",
132
132
  "@babel/runtime": "7.12.18"
133
133
  },
@@ -152,6 +152,21 @@
152
152
  }
153
153
  }
154
154
  },
155
+ "files": [
156
+ "dist",
157
+ "!dist/tsconfig.tsbuildinfo",
158
+ "**/*.md",
159
+ "**/*.mdx",
160
+ "**/*.js",
161
+ "**/*.json",
162
+ "**/*.sass",
163
+ "**/*.scss",
164
+ "**/*.less",
165
+ "**/*.css",
166
+ "**/*.css",
167
+ "**/*.jpeg",
168
+ "**/*.gif"
169
+ ],
155
170
  "packageManagerPublishArgs": [
156
171
  "--access public"
157
172
  ],
package/tsconfig.json CHANGED
@@ -15,9 +15,9 @@
15
15
  "skipLibCheck": true,
16
16
  "moduleResolution": "node",
17
17
  "esModuleInterop": true,
18
- "outDir": "dist",
19
18
  "composite": true,
20
19
  "emitDeclarationOnly": true,
20
+ "outDir": "dist",
21
21
  "experimentalDecorators": true,
22
22
  "emitDecoratorMetadata": true,
23
23
  "allowSyntheticDefaultImports": true,
package/app.ts DELETED
@@ -1,29 +0,0 @@
1
- /* eslint-disable import/no-dynamic-require */
2
- /* eslint-disable import/first */
3
- process.on('uncaughtException', (err) => {
4
- // eslint-disable-next-line no-console
5
- console.error('uncaughtException', err);
6
- process.exit(1);
7
- });
8
-
9
- require('v8-compile-cache');
10
-
11
- import './hook-require';
12
- import { bootstrap } from '@teambit/legacy/dist/bootstrap';
13
- import { handleErrorAndExit } from '@teambit/legacy/dist/cli/handle-errors';
14
- import { runCLI } from './load-bit';
15
-
16
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
17
- initApp();
18
-
19
- async function initApp() {
20
- try {
21
- await bootstrap();
22
- // registerCoreExtensions();
23
- // const harmony = await Harmony.load([ConfigExt], {});
24
- await runCLI();
25
- } catch (err: any) {
26
- const originalError = err.originalError || err;
27
- await handleErrorAndExit(originalError, process.argv[2]);
28
- }
29
- }
package/bit.aspect.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const BitAspect = Aspect.create({
4
- id: 'teambit.harmony/bit',
5
- dependencies: [],
6
- });
package/bit.docs.tsx DELETED
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
-
3
- export const tags = ['components', 'compositions'];
4
-
5
- export const abstract = 'Bit is a toolchain for development of component-based applications';
6
-
7
- export default function Docs() {
8
- return <div>hi </div>;
9
- }
@@ -1,22 +0,0 @@
1
- import { MainRuntime } from '@teambit/cli';
2
- import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
3
-
4
- import { BitAspect } from './bit.aspect';
5
- import { provideBit } from './bit.provider';
6
- import { manifestsMap } from './manifests';
7
-
8
- const manifests = Object.values(manifestsMap);
9
-
10
- export function registerCoreExtensions() {
11
- const allCoreExtensionsNames = Object.keys(manifestsMap);
12
- ExtensionDataList.registerManyCoreExtensionNames(allCoreExtensionsNames);
13
- }
14
-
15
- export const BitMain = {
16
- name: 'bit',
17
- runtime: MainRuntime,
18
- dependencies: manifests,
19
- provider: provideBit,
20
- };
21
-
22
- BitAspect.addRuntime(BitMain);
package/bit.provider.ts DELETED
@@ -1,11 +0,0 @@
1
- import { manifestsMap } from './manifests';
2
-
3
- export type BitDeps = [];
4
-
5
- export type BitConfig = {};
6
-
7
- export async function provideBit() {
8
- return {
9
- manifestsMap,
10
- };
11
- }
@@ -1,26 +0,0 @@
1
- // // import { Slot, SlotRegistry } from '@teambit/harmony';
2
-
3
- // export interface Extension {
4
- // /**
5
- // * icon of the extension.
6
- // */
7
- // icon?: string
8
- // }
9
-
10
- // // export type ExtensionContext<CT, DT> = {
11
- // // dependencies: DT,
12
- // // config: CT,
13
- // // slots: SlotRegistry
14
- // // };
15
-
16
- // export type ExtensionProvider = () => Extension;
17
-
18
- // export type ExtensionProps = {
19
- // name: string,
20
- // slots: Slot[],
21
- // provider: ExtensionProvider
22
- // };
23
-
24
- // export function createExtension<>(props: ExtensionProps) {
25
-
26
- // }
File without changes
package/hook-require.ts DELETED
@@ -1,15 +0,0 @@
1
- export function hookRequire() {
2
- module.constructor.prototype.require = function (path) {
3
- if (typeof path !== 'string') throw new Error('hookRequire - path must be a string');
4
- if (!path) throw new Error('hookRequire - missing path');
5
-
6
- // TODO: this should be refactored away to be handled by the dev.
7
- if (path.endsWith('.scss') || path.endsWith('.css') || path.endsWith('.less') || path === 'reset-css') {
8
- return {};
9
- }
10
-
11
- return this.constructor._load(path, this);
12
- };
13
- }
14
-
15
- hookRequire();
package/hooks/hook.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Slot, SlotRegistry } from '@teambit/harmony';
2
-
3
- export { Slot as Hook, SlotRegistry as HookRegistry };
package/hooks/index.ts DELETED
@@ -1 +0,0 @@
1
- export { Hook, HookRegistry } from './hook';
package/index.ts DELETED
@@ -1,7 +0,0 @@
1
- export { Aspect, RuntimeManifest, RuntimeDefinition } from '@teambit/harmony';
2
- export { Hook, HookRegistry } from './hooks';
3
- export { manifestsMap, isCoreAspect, getAllCoreAspectsIds } from './manifests';
4
- export { registerCoreExtensions } from './bit.main.runtime';
5
- export { BitAspect } from './bit.aspect';
6
- export type { BitMain } from './bit.main.runtime';
7
- export { loadBit } from './load-bit';
package/load-bit.ts DELETED
@@ -1,275 +0,0 @@
1
- /* eslint-disable import/no-dynamic-require */
2
- /* eslint-disable import/first */
3
- process.on('uncaughtException', (err) => {
4
- // eslint-disable-next-line no-console
5
- console.error('uncaughtException', err);
6
- process.exit(1);
7
- });
8
-
9
- require('v8-compile-cache');
10
-
11
- import './hook-require';
12
-
13
- import {
14
- getAspectDir,
15
- getAspectDistDir,
16
- AspectLoaderMain,
17
- getCoreAspectPackageName,
18
- getCoreAspectName,
19
- } from '@teambit/aspect-loader';
20
- import json from 'comment-json';
21
- import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';
22
- import { ConfigAspect, ConfigRuntime } from '@teambit/config';
23
- import { Harmony, RuntimeDefinition } from '@teambit/harmony';
24
- import { Extension } from '@teambit/harmony/dist/extension';
25
- import { Config } from '@teambit/harmony/dist/harmony-config';
26
- // TODO: expose this type from harmony
27
- import { ConfigOptions } from '@teambit/harmony/dist/harmony-config/harmony-config';
28
- import { BitId, VERSION_DELIMITER } from '@teambit/legacy-bit-id';
29
- import { DependencyResolver } from '@teambit/legacy/dist/consumer/component/dependencies/dependency-resolver';
30
- import { getConsumerInfo, loadConsumer } from '@teambit/legacy/dist/consumer';
31
- import { ConsumerInfo } from '@teambit/legacy/dist/consumer/consumer-locator';
32
- import BitMap from '@teambit/legacy/dist/consumer/bit-map';
33
- import ComponentLoader from '@teambit/legacy/dist/consumer/component/component-loader';
34
- import ComponentConfig from '@teambit/legacy/dist/consumer/config/component-config';
35
- import ComponentOverrides from '@teambit/legacy/dist/consumer/config/component-overrides';
36
- import { PackageJsonTransformer } from '@teambit/legacy/dist/consumer/component/package-json-transformer';
37
- import ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';
38
- import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';
39
- import WorkspaceConfig from '@teambit/legacy/dist/consumer/config/workspace-config';
40
- import { BitIds } from '@teambit/legacy/dist/bit-id';
41
- import { propogateUntil as propagateUntil } from '@teambit/legacy/dist/utils';
42
- import loader from '@teambit/legacy/dist/cli/loader';
43
- import { readdir } from 'fs-extra';
44
- import { resolve } from 'path';
45
- import { manifestsMap } from './manifests';
46
- import { BitAspect } from './bit.aspect';
47
- import { registerCoreExtensions } from './bit.main.runtime';
48
-
49
- async function loadLegacyConfig(config: any) {
50
- const harmony = await Harmony.load([ConfigAspect], ConfigRuntime.name, config.toObject());
51
- await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime));
52
- }
53
-
54
- async function getConfig(cwd = process.cwd()) {
55
- const consumerInfo = await getConsumerInfo(cwd);
56
- const scopePath = propagateUntil(cwd);
57
- const globalConfigOpts = {
58
- name: '.bitrc.jsonc',
59
- };
60
- const configOpts: ConfigOptions = {
61
- global: globalConfigOpts,
62
- shouldThrow: false,
63
- cwd: consumerInfo?.path || scopePath,
64
- };
65
-
66
- if (consumerInfo) {
67
- const config = Config.load('workspace.jsonc', configOpts);
68
- return attachVersionsFromBitmap(config, consumerInfo);
69
- }
70
-
71
- if (scopePath && !consumerInfo) {
72
- return Config.load('scope.jsonc', configOpts);
73
- }
74
-
75
- return Config.loadGlobal(globalConfigOpts);
76
- }
77
-
78
- /**
79
- * This will attach versions of aspects configured in the config without version by resolves them from the bitmap file
80
- * It's required in order to support a usecase which you develop a local aspect and configure it in your workspace.jsonc
81
- * in that case you always want the workspace.jsonc config to be linked to your local aspect
82
- * but you don't want to change your workspace.jsonc version after each tag of the aspect
83
- * @param config
84
- */
85
- function attachVersionsFromBitmap(config: Config, consumerInfo: ConsumerInfo): Config {
86
- if (!consumerInfo || !consumerInfo.hasBitMap) {
87
- return config;
88
- }
89
- const rawConfig = config.toObject();
90
- const rawBitmap = BitMap.loadRawSync(consumerInfo.path);
91
- let parsedBitMap = {};
92
- try {
93
- parsedBitMap = rawBitmap ? json.parse(rawBitmap?.toString('utf8'), undefined, true) : {};
94
- BitMap.removeNonComponentFields(parsedBitMap);
95
- // Do nothing here, invalid bitmaps will be handled later
96
- // eslint-disable-next-line no-empty
97
- } catch (e: any) {}
98
- const allBitmapIds = Object.keys(parsedBitMap).map((id) => BitMap.getBitIdFromComponentJson(id, parsedBitMap[id]));
99
- const bitMapBitIds = BitIds.fromArray(allBitmapIds);
100
- const result = Object.entries(rawConfig).reduce((acc, [aspectId, aspectConfig]) => {
101
- let newAspectEntry = aspectId;
102
- // In case the id already has a version we don't want to get it from the bitmap
103
- // We also don't want to add versions for core aspects
104
- if (!aspectId.includes(VERSION_DELIMITER) && !manifestsMap[aspectId]) {
105
- const versionFromBitmap = getVersionFromBitMapIds(bitMapBitIds, aspectId);
106
- if (versionFromBitmap) {
107
- newAspectEntry = `${aspectId}${VERSION_DELIMITER}${versionFromBitmap}`;
108
- }
109
- }
110
- acc[newAspectEntry] = aspectConfig;
111
- return acc;
112
- }, {});
113
- return new Config(result);
114
- }
115
-
116
- function getVersionFromBitMapIds(allBitmapIds: BitIds, aspectId: string): string | undefined {
117
- let aspectBitId: BitId;
118
- try {
119
- aspectBitId = BitId.parse(aspectId, true);
120
- } catch (err: any) {
121
- throw new Error(
122
- `unable to parse the component-id "${aspectId}" from the workspace.jsonc file, make sure this is a component id`
123
- );
124
- }
125
- // start by searching id in the bitmap with exact match (including scope name)
126
- // in case the aspect is not exported yet, it will be in the bitmap without a scope,
127
- // while in the aspect id it will have the default scope
128
- const found =
129
- allBitmapIds.searchWithoutVersion(aspectBitId) || allBitmapIds.searchWithoutScopeAndVersion(aspectBitId);
130
- return found && found.hasVersion() ? found.version : undefined;
131
- }
132
-
133
- export async function requireAspects(aspect: Extension, runtime: RuntimeDefinition) {
134
- const id = aspect.name;
135
- if (!id) throw new Error('could not retrieve aspect id');
136
- const dirPath = getAspectDistDir(id);
137
- const files = await readdir(dirPath);
138
- const runtimeFile = files.find((file) => file.includes(`.${runtime.name}.runtime.js`));
139
- if (!runtimeFile) return;
140
- // eslint-disable-next-line
141
- require(resolve(`${dirPath}/${runtimeFile}`));
142
- }
143
-
144
- function getMainAspect() {
145
- const mainAspectDir = getAspectDir(BitAspect.id);
146
- let version: string | undefined;
147
- const packageName = getCoreAspectPackageName(BitAspect.id);
148
-
149
- try {
150
- // eslint-disable-next-line global-require
151
- const packageJson = require(`${mainAspectDir}/package.json`);
152
- version = packageJson.version;
153
- } catch (err: any) {
154
- version = undefined;
155
- }
156
-
157
- return {
158
- path: mainAspectDir,
159
- version,
160
- packageName,
161
- aspect: BitAspect,
162
- name: getCoreAspectName(BitAspect.id),
163
- id: BitAspect.id,
164
- };
165
- }
166
-
167
- /**
168
- * Bit may crush during the aspect loading phase or workspace/consumer initialization.
169
- * normally, this is the desired behavior, however, some commands are there to help overcome these
170
- * errors, such as "bit clear-cache". for these commands we're better off loading the bare minimum,
171
- * which is only the CLI aspect.
172
- *
173
- * at this stage we don't have the commands objects, so we can't check the command/flags from there
174
- * instead, we have to check the `process.argv.` directly instead, which is not 100% accurate.
175
- */
176
- function shouldLoadInSafeMode() {
177
- const currentCommand = process.argv[2];
178
- const safeModeCommands = [
179
- 'cc',
180
- 'clear-cache',
181
- 'init',
182
- 'cat-scope',
183
- 'cat-object',
184
- 'cat-component',
185
- 'cmp',
186
- 'cat-lane',
187
- 'login',
188
- 'logout',
189
- 'config',
190
- ];
191
- const hasSafeModeFlag = process.argv.includes('--safe-mode');
192
- const isSafeModeCommand = safeModeCommands.includes(currentCommand);
193
- return isSafeModeCommand || hasSafeModeFlag;
194
- }
195
-
196
- export async function loadBit(path = process.cwd()) {
197
- clearGlobalsIfNeeded();
198
- const loadCLIOnly = shouldLoadInSafeMode();
199
- const config = await getConfig(path);
200
- registerCoreExtensions();
201
- await loadLegacyConfig(config);
202
- const configMap = config.toObject();
203
-
204
- configMap['teambit.harmony/bit'] = {
205
- cwd: path,
206
- };
207
-
208
- const aspectsToLoad = [CLIAspect];
209
- if (!loadCLIOnly) {
210
- aspectsToLoad.push(BitAspect);
211
- }
212
- const harmony = await Harmony.load(aspectsToLoad, MainRuntime.name, configMap);
213
-
214
- await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime));
215
- if (loadCLIOnly) return harmony;
216
- loader.start('loading aspects...');
217
- const aspectLoader = harmony.get<AspectLoaderMain>('teambit.harmony/aspect-loader');
218
- aspectLoader.setCoreAspects(Object.values(manifestsMap));
219
- aspectLoader.setMainAspect(getMainAspect());
220
- registerCoreAspectsToLegacyDepResolver(aspectLoader);
221
- return harmony;
222
- }
223
-
224
- export async function runCLI() {
225
- const harmony = await loadBit();
226
- const cli = harmony.get<CLIMain>('teambit.harmony/cli');
227
- let hasWorkspace = true;
228
- try {
229
- harmony.get('teambit.workspace/workspace');
230
- } catch (err: any) {
231
- hasWorkspace = false;
232
- }
233
- await cli.run(hasWorkspace);
234
- }
235
-
236
- function registerCoreAspectsToLegacyDepResolver(aspectLoader: AspectLoaderMain) {
237
- const allCoreAspectsIds = aspectLoader.getCoreAspectIds();
238
- const coreAspectsPackagesAndIds = {};
239
-
240
- allCoreAspectsIds.forEach((id) => {
241
- const packageName = getCoreAspectPackageName(id);
242
- coreAspectsPackagesAndIds[packageName] = id;
243
- });
244
- // @ts-ignore
245
- DependencyResolver.getCoreAspectsPackagesAndIds = () => coreAspectsPackagesAndIds;
246
- }
247
-
248
- /**
249
- * loadBit may gets called multiple times (currently, it's happening during e2e-tests that call loadBit).
250
- * when it happens, the static methods in this function still have the callbacks that were added in
251
- * the previous loadBit call. this callbacks have the old data such as workspace/bitmap/consumer
252
- * of the previous workspace, which leads to hard-to-debug issues.
253
- */
254
- function clearGlobalsIfNeeded() {
255
- if (!loadConsumer.cache && !PackageJsonTransformer.packageJsonTransformersRegistry.length) {
256
- return;
257
- }
258
- delete loadConsumer.cache;
259
- ComponentLoader.onComponentLoadSubscribers = [];
260
- ComponentOverrides.componentOverridesLoadingRegistry = {};
261
- ComponentConfig.componentConfigLegacyLoadingRegistry = {};
262
- ComponentConfig.componentConfigLoadingRegistry = {};
263
- PackageJsonTransformer.packageJsonTransformersRegistry = [];
264
- // @ts-ignore
265
- DependencyResolver.getWorkspacePolicy = undefined;
266
- // @ts-ignore
267
- ManyComponentsWriter.externalInstaller = {};
268
- ExtensionDataList.coreExtensionsNames = new Map();
269
- // @ts-ignore
270
- WorkspaceConfig.workspaceConfigEnsuringRegistry = undefined;
271
- // @ts-ignore
272
- WorkspaceConfig.workspaceConfigIsExistRegistry = undefined;
273
- // @ts-ignore
274
- WorkspaceConfig.workspaceConfigLoadingRegistry = undefined;
275
- }
package/manifests.ts DELETED
@@ -1,152 +0,0 @@
1
- import { AspectAspect } from '@teambit/aspect';
2
- import AspectLoaderAspect from '@teambit/aspect-loader';
3
- import { BuilderAspect } from '@teambit/builder';
4
- import { BundlerAspect } from '@teambit/bundler';
5
- import { CacheAspect } from '@teambit/cache';
6
- import { CLIAspect } from '@teambit/cli';
7
- import { CompilerAspect } from '@teambit/compiler';
8
- import { ComponentAspect } from '@teambit/component';
9
- import { CompositionsAspect } from '@teambit/compositions';
10
- import { ConfigAspect } from '@teambit/config';
11
- import { DependencyResolverAspect } from '@teambit/dependency-resolver';
12
- import { DeprecationAspect } from '@teambit/deprecation';
13
- import { DocsAspect } from '@teambit/docs';
14
- import { EnvsAspect } from '@teambit/envs';
15
- import { ExpressAspect } from '@teambit/express';
16
- import { YarnAspect } from '@teambit/yarn';
17
- import { GeneratorAspect } from '@teambit/generator';
18
- import { HarmonyUiAppAspect } from '@teambit/harmony-ui-app';
19
- import { GraphAspect } from '@teambit/graph';
20
- import { GraphqlAspect } from '@teambit/graphql';
21
- import { InsightsAspect } from '@teambit/insights';
22
- import { IsolatorAspect } from '@teambit/isolator';
23
- import { JestAspect } from '@teambit/jest';
24
- import { LoggerAspect } from '@teambit/logger';
25
- import { NodeAspect } from '@teambit/node';
26
- import { NotificationsAspect } from '@teambit/notifications';
27
- import { PanelUiAspect } from '@teambit/panels';
28
- import { PkgAspect } from '@teambit/pkg';
29
- import { PnpmAspect } from '@teambit/pnpm';
30
- import { PreviewAspect } from '@teambit/preview';
31
- import { ReactAspect } from '@teambit/react';
32
- import { ReactNativeAspect } from '@teambit/react-native';
33
- import { ReactRouterAspect } from '@teambit/react-router';
34
- import { ReactElementsAspect } from '@teambit/react-elements';
35
- import { ElementsAspect } from '@teambit/elements';
36
- import { SchemaAspect } from '@teambit/schema';
37
- import { PubsubAspect } from '@teambit/pubsub';
38
- import { ScopeAspect } from '@teambit/scope';
39
- // import { StencilAspect } from '@teambit/stencil';
40
- import { TesterAspect } from '@teambit/tester';
41
- import { TypescriptAspect } from '@teambit/typescript';
42
- import { BabelAspect } from '@teambit/babel';
43
- import { UIAspect } from '@teambit/ui';
44
- import { VariantsAspect } from '@teambit/variants';
45
- import { WebpackAspect } from '@teambit/webpack';
46
- import { WorkspaceAspect } from '@teambit/workspace';
47
- import { LinterAspect } from '@teambit/linter';
48
- import { FormatterAspect } from '@teambit/formatter';
49
- import { ChangelogAspect } from '@teambit/changelog';
50
- import { CodeAspect } from '@teambit/code';
51
- import { CommandBarAspect } from '@teambit/command-bar';
52
- import { SidebarAspect } from '@teambit/sidebar';
53
- import { ComponentTreeAspect } from '@teambit/component-tree';
54
- import { DevFilesAspect } from '@teambit/dev-files';
55
- import { ESLintAspect } from '@teambit/eslint';
56
- import { PrettierAspect } from '@teambit/prettier';
57
- import { SignAspect } from '@teambit/sign';
58
- import WorkerAspect from '@teambit/worker';
59
- import { GlobalConfigAspect } from '@teambit/global-config';
60
- import MultiCompilerAspect from '@teambit/multi-compiler';
61
- import MDXAspect from '@teambit/mdx';
62
- import { ApplicationAspect } from '@teambit/application';
63
- import { UpdateDependenciesAspect } from '@teambit/update-dependencies';
64
- import { ExportAspect } from '@teambit/export';
65
- import { ImporterAspect } from '@teambit/importer';
66
- import { EjectAspect } from '@teambit/eject';
67
- import { UserAgentAspect } from '@teambit/user-agent';
68
- import { HtmlAspect } from '@teambit/html';
69
- import { LanesAspect } from '@teambit/lanes';
70
- import { BitAspect } from './bit.aspect';
71
-
72
- export const manifestsMap = {
73
- [AspectLoaderAspect.id]: AspectLoaderAspect,
74
- [CLIAspect.id]: CLIAspect,
75
- [DevFilesAspect.id]: DevFilesAspect,
76
- [WorkspaceAspect.id]: WorkspaceAspect,
77
- [ESLintAspect.id]: ESLintAspect,
78
- [PrettierAspect.id]: PrettierAspect,
79
- [CompilerAspect.id]: CompilerAspect,
80
- [LinterAspect.id]: LinterAspect,
81
- [FormatterAspect.id]: FormatterAspect,
82
- [ComponentAspect.id]: ComponentAspect,
83
- [MDXAspect.id]: MDXAspect,
84
- [PreviewAspect.id]: PreviewAspect,
85
- [DocsAspect.id]: DocsAspect,
86
- [YarnAspect.id]: YarnAspect,
87
- [CompositionsAspect.id]: CompositionsAspect,
88
- [GlobalConfigAspect.id]: GlobalConfigAspect,
89
- [GraphqlAspect.id]: GraphqlAspect,
90
- [PnpmAspect.id]: PnpmAspect,
91
- [MultiCompilerAspect.id]: MultiCompilerAspect,
92
- [UIAspect.id]: UIAspect,
93
- [GeneratorAspect.id]: GeneratorAspect,
94
- [EnvsAspect.id]: EnvsAspect,
95
- [GraphAspect.id]: GraphAspect,
96
- [PubsubAspect.id]: PubsubAspect,
97
- [DependencyResolverAspect.id]: DependencyResolverAspect,
98
- [InsightsAspect.id]: InsightsAspect,
99
- [IsolatorAspect.id]: IsolatorAspect,
100
- [LoggerAspect.id]: LoggerAspect,
101
- [PkgAspect.id]: PkgAspect,
102
- [ReactAspect.id]: ReactAspect,
103
- [ReactNativeAspect.id]: ReactNativeAspect,
104
- [ReactElementsAspect.id]: ReactElementsAspect,
105
- [ElementsAspect.id]: ElementsAspect,
106
- [WorkerAspect.id]: WorkerAspect,
107
- // [StencilAspect.id]: StencilAspect,
108
- [ScopeAspect.id]: ScopeAspect,
109
- [TesterAspect.id]: TesterAspect,
110
- [BuilderAspect.id]: BuilderAspect,
111
- [VariantsAspect.id]: VariantsAspect,
112
- [DeprecationAspect.id]: DeprecationAspect,
113
- [ExpressAspect.id]: ExpressAspect,
114
- [AspectAspect.id]: AspectAspect,
115
- [WebpackAspect.id]: WebpackAspect,
116
- [SchemaAspect.id]: SchemaAspect,
117
- [ReactRouterAspect.id]: ReactRouterAspect,
118
- [TypescriptAspect.id]: TypescriptAspect,
119
- [PanelUiAspect.id]: PanelUiAspect,
120
- [BabelAspect.id]: BabelAspect,
121
- [NodeAspect.id]: NodeAspect,
122
- [NotificationsAspect.id]: NotificationsAspect,
123
- [BundlerAspect.id]: BundlerAspect,
124
- [JestAspect.id]: JestAspect,
125
- [CacheAspect.id]: CacheAspect,
126
- [ChangelogAspect.id]: ChangelogAspect,
127
- [CodeAspect.id]: CodeAspect,
128
- [CommandBarAspect.id]: CommandBarAspect,
129
- [SidebarAspect.id]: SidebarAspect,
130
- [ComponentTreeAspect.id]: ComponentTreeAspect,
131
- [SignAspect.id]: SignAspect,
132
- [UpdateDependenciesAspect.id]: UpdateDependenciesAspect,
133
- [ExportAspect.id]: ExportAspect,
134
- [ImporterAspect.id]: ImporterAspect,
135
- [HarmonyUiAppAspect.id]: HarmonyUiAppAspect,
136
- [UserAgentAspect.id]: UserAgentAspect,
137
- [ApplicationAspect.id]: ApplicationAspect,
138
- [EjectAspect.id]: EjectAspect,
139
- [HtmlAspect.id]: HtmlAspect,
140
- [LanesAspect.id]: LanesAspect,
141
- };
142
-
143
- export function isCoreAspect(id: string) {
144
- const _reserved = [BitAspect.id, ConfigAspect.id];
145
- if (_reserved.includes(id)) return true;
146
- return !!manifestsMap[id];
147
- }
148
-
149
- export function getAllCoreAspectsIds(): string[] {
150
- const _reserved = [BitAspect.id, ConfigAspect.id];
151
- return [...Object.keys(manifestsMap), ..._reserved];
152
- }
Binary file
package/types/asset.d.ts DELETED
@@ -1,29 +0,0 @@
1
- declare module '*.png' {
2
- const value: any;
3
- export = value;
4
- }
5
- declare module '*.svg' {
6
- import type { FunctionComponent, SVGProps } from 'react';
7
-
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
- const src: string;
10
- export default src;
11
- }
12
-
13
- // @TODO Gilad
14
- declare module '*.jpg' {
15
- const value: any;
16
- export = value;
17
- }
18
- declare module '*.jpeg' {
19
- const value: any;
20
- export = value;
21
- }
22
- declare module '*.gif' {
23
- const value: any;
24
- export = value;
25
- }
26
- declare module '*.bmp' {
27
- const value: any;
28
- export = value;
29
- }
package/types/style.d.ts DELETED
@@ -1,42 +0,0 @@
1
- declare module '*.module.css' {
2
- const classes: { readonly [key: string]: string };
3
- export default classes;
4
- }
5
- declare module '*.module.scss' {
6
- const classes: { readonly [key: string]: string };
7
- export default classes;
8
- }
9
- declare module '*.module.sass' {
10
- const classes: { readonly [key: string]: string };
11
- export default classes;
12
- }
13
-
14
- declare module '*.module.less' {
15
- const classes: { readonly [key: string]: string };
16
- export default classes;
17
- }
18
-
19
- declare module '*.less' {
20
- const classes: { readonly [key: string]: string };
21
- export default classes;
22
- }
23
-
24
- declare module '*.css' {
25
- const classes: { readonly [key: string]: string };
26
- export default classes;
27
- }
28
-
29
- declare module '*.sass' {
30
- const classes: { readonly [key: string]: string };
31
- export default classes;
32
- }
33
-
34
- declare module '*.scss' {
35
- const classes: { readonly [key: string]: string };
36
- export default classes;
37
- }
38
-
39
- declare module '*.mdx' {
40
- const component: any;
41
- export default component;
42
- }