@teambit/node 1.0.413 → 1.0.414
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/artifacts/env-template/public/314.3776669ccd7cd7f3b7a8.js +690 -0
- package/artifacts/env-template/public/453.042e4d7752cf6b24cd7e.js +41 -0
- package/artifacts/env-template/public/769.df90c4d201536c9ea25a.js +232 -0
- package/artifacts/env-template/public/871.9a7e9061377f8f261632.js +257 -0
- package/artifacts/env-template/public/assets-manifest.json +58 -0
- package/artifacts/env-template/public/compositions.41cda91fc8ee91998a51.js +1 -0
- package/artifacts/env-template/public/compositions.html +2 -0
- package/artifacts/env-template/public/overview.884c7fc963e1ad9fb2ef.js +1 -0
- package/artifacts/env-template/public/overview.html +2 -0
- package/artifacts/env-template/public/peers.6b6cf7c90265d63bde46.js +1 -0
- package/artifacts/env-template/public/preview-root.2182a25a76a310169ca9.js +1 -0
- package/artifacts/env-template/public/static/css/314.3571d7f7.css +1 -0
- package/artifacts/env-template/public/static/css/compositions.7f2d907d.css +1 -0
- package/artifacts/env-template/public/static/css/preview-root.ebd38a13.css +1 -0
- package/dist/{preview-1727148128138.js → preview-1727262607766.js} +2 -2
- package/package.json +21 -21
- package/index.ts +0 -6
- package/node-app-options.ts +0 -46
- package/node.app-type.ts +0 -21
- package/node.application.ts +0 -59
- package/node.aspect.ts +0 -9
- package/node.env.ts +0 -82
- package/node.main.runtime.ts +0 -190
- package/node.templates.ts +0 -29
- /package/{compositions-1727148128138.js → compositions-1727262607766.js} +0 -0
- /package/{overview-1727148128138.js → overview-1727262607766.js} +0 -0
package/node.env.ts
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
import { pathNormalizeToLinux } from '@teambit/toolbox.path.path';
|
2
|
-
import { DependenciesEnv, PackageEnv, PipeServiceModifier, PipeServiceModifiersMap } from '@teambit/envs';
|
3
|
-
import { VariantPolicyConfigObject } from '@teambit/dependency-resolver';
|
4
|
-
import { TsConfigTransformer, TypescriptMain } from '@teambit/typescript';
|
5
|
-
import { ReactMain } from '@teambit/react';
|
6
|
-
import { Tester } from '@teambit/tester';
|
7
|
-
import { BuildTask } from '@teambit/builder';
|
8
|
-
import { COMPONENT_PREVIEW_STRATEGY_NAME, PreviewStrategyName } from '@teambit/preview';
|
9
|
-
import { SchemaExtractor } from '@teambit/schema';
|
10
|
-
import { TsConfigSourceFile } from 'typescript';
|
11
|
-
import { join } from 'path';
|
12
|
-
|
13
|
-
export const NodeEnvType = 'node';
|
14
|
-
|
15
|
-
type GetBuildPipeModifiers = PipeServiceModifiersMap & {
|
16
|
-
tsModifier?: PipeServiceModifier;
|
17
|
-
jestModifier?: PipeServiceModifier;
|
18
|
-
};
|
19
|
-
export class NodeEnv implements DependenciesEnv, PackageEnv {
|
20
|
-
constructor(protected tsAspect: TypescriptMain, protected reactAspect: ReactMain) {}
|
21
|
-
|
22
|
-
icon = 'https://static.bit.dev/extensions-icons/nodejs.svg';
|
23
|
-
|
24
|
-
getDependencies(): VariantPolicyConfigObject {
|
25
|
-
return {
|
26
|
-
devDependencies: {
|
27
|
-
'@types/jest': '26.0.20',
|
28
|
-
'@types/node': '12.20.4',
|
29
|
-
// This is added as dev dep since our jest file transformer uses babel plugins that require this to be installed
|
30
|
-
'@babel/runtime': '7.20.0',
|
31
|
-
},
|
32
|
-
};
|
33
|
-
}
|
34
|
-
|
35
|
-
getCompiler(transformers: TsConfigTransformer[] = [], tsModule) {
|
36
|
-
return this.reactAspect.reactEnv.getTsCjsCompiler('dev', transformers, tsModule);
|
37
|
-
}
|
38
|
-
|
39
|
-
/**
|
40
|
-
* returns the component build pipeline.
|
41
|
-
*/
|
42
|
-
getBuildPipe(modifiers: GetBuildPipeModifiers = {}): BuildTask[] {
|
43
|
-
const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', '');
|
44
|
-
const jestConfigPath = modifiers?.jestModifier?.transformers?.[0]() || join(pathToSource, './jest/jest.config.js');
|
45
|
-
modifiers.jestModifier = modifiers.jestModifier || {};
|
46
|
-
modifiers.jestModifier.transformers = [() => jestConfigPath];
|
47
|
-
return this.reactAspect.reactEnv.getBuildPipe(modifiers);
|
48
|
-
}
|
49
|
-
|
50
|
-
/**
|
51
|
-
* returns a component tester.
|
52
|
-
*/
|
53
|
-
getTester(jestConfigPath: string, jestModulePath?: string): Tester {
|
54
|
-
const config = jestConfigPath || require.resolve('./jest/jest.config');
|
55
|
-
return this.reactAspect.reactEnv.createCjsJestTester(config, jestModulePath);
|
56
|
-
}
|
57
|
-
|
58
|
-
getPreviewConfig() {
|
59
|
-
return {
|
60
|
-
strategyName: COMPONENT_PREVIEW_STRATEGY_NAME as PreviewStrategyName,
|
61
|
-
splitComponentBundle: false,
|
62
|
-
};
|
63
|
-
}
|
64
|
-
|
65
|
-
getPackageJsonProps() {
|
66
|
-
return this.tsAspect.getCjsPackageJsonProps();
|
67
|
-
}
|
68
|
-
|
69
|
-
getSchemaExtractor(tsconfig: TsConfigSourceFile, tsserverPath?: string, contextPath?: string): SchemaExtractor {
|
70
|
-
return this.tsAspect.createSchemaExtractor(
|
71
|
-
this.reactAspect.reactEnv.getTsConfig(tsconfig),
|
72
|
-
tsserverPath,
|
73
|
-
contextPath
|
74
|
-
);
|
75
|
-
}
|
76
|
-
|
77
|
-
async __getDescriptor() {
|
78
|
-
return {
|
79
|
-
type: NodeEnvType,
|
80
|
-
};
|
81
|
-
}
|
82
|
-
}
|
package/node.main.runtime.ts
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
import { Harmony } from '@teambit/harmony';
|
2
|
-
import { EnvPolicyConfigObject } from '@teambit/dependency-resolver';
|
3
|
-
import { TsConfigSourceFile } from 'typescript';
|
4
|
-
import { TsCompilerOptionsWithoutTsConfig, TypescriptAspect, TypescriptMain } from '@teambit/typescript';
|
5
|
-
import { ApplicationAspect, ApplicationMain } from '@teambit/application';
|
6
|
-
import { merge } from 'lodash';
|
7
|
-
import { LoggerAspect, LoggerMain } from '@teambit/logger';
|
8
|
-
import { MainRuntime } from '@teambit/cli';
|
9
|
-
import { GeneratorAspect, GeneratorMain } from '@teambit/generator';
|
10
|
-
import { BuildTask } from '@teambit/builder';
|
11
|
-
import { ComponentID } from '@teambit/component-id';
|
12
|
-
import { WorkerAspect, WorkerMain } from '@teambit/worker';
|
13
|
-
import { Compiler } from '@teambit/compiler';
|
14
|
-
import { PackageJsonProps } from '@teambit/pkg';
|
15
|
-
import { EnvsAspect, EnvsMain, EnvTransformer, Environment, EnvContext } from '@teambit/envs';
|
16
|
-
import { ReactAspect, ReactEnv, ReactMain, UseTypescriptModifiers } from '@teambit/react';
|
17
|
-
import { NodeAspect } from './node.aspect';
|
18
|
-
import { NodeEnv } from './node.env';
|
19
|
-
import { getTemplates } from './node.templates';
|
20
|
-
import { NodeAppType } from './node.app-type';
|
21
|
-
|
22
|
-
export class NodeMain {
|
23
|
-
constructor(
|
24
|
-
private react: ReactMain,
|
25
|
-
|
26
|
-
private tsAspect: TypescriptMain,
|
27
|
-
|
28
|
-
readonly nodeEnv: NodeEnv,
|
29
|
-
|
30
|
-
private envs: EnvsMain
|
31
|
-
) {}
|
32
|
-
|
33
|
-
icon() {
|
34
|
-
return 'https://static.bit.dev/extensions-icons/nodejs.svg';
|
35
|
-
}
|
36
|
-
|
37
|
-
/**
|
38
|
-
* @deprecated use useTypescript()
|
39
|
-
* override the TS config of the environment.
|
40
|
-
*/
|
41
|
-
overrideTsConfig: (
|
42
|
-
tsconfig: TsConfigSourceFile,
|
43
|
-
compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>,
|
44
|
-
tsModule?: any
|
45
|
-
) => EnvTransformer = this.react.overrideTsConfig.bind(this.react);
|
46
|
-
|
47
|
-
/**
|
48
|
-
* override the jest config of the environment.
|
49
|
-
*/
|
50
|
-
overrideJestConfig = this.react.overrideJestConfig.bind(this.react);
|
51
|
-
|
52
|
-
/**
|
53
|
-
* override the env build pipeline.
|
54
|
-
*/
|
55
|
-
overrideBuildPipe: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideBuildPipe.bind(this.react);
|
56
|
-
|
57
|
-
/**
|
58
|
-
* override the env compilers list.
|
59
|
-
*/
|
60
|
-
overrideCompiler: (compiler: Compiler) => EnvTransformer = this.react.overrideCompiler.bind(this.react);
|
61
|
-
|
62
|
-
/**
|
63
|
-
* override the env compilers tasks in the build pipe.
|
64
|
-
*/
|
65
|
-
overrideCompilerTasks: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideCompilerTasks.bind(this.react);
|
66
|
-
|
67
|
-
/**
|
68
|
-
* @deprecated use useTypescript()
|
69
|
-
* override the build ts config.
|
70
|
-
*/
|
71
|
-
overrideBuildTsConfig: (
|
72
|
-
tsconfig: any,
|
73
|
-
compilerOptions?: Partial<TsCompilerOptionsWithoutTsConfig>
|
74
|
-
) => EnvTransformer = this.react.overrideBuildTsConfig.bind(this.react);
|
75
|
-
|
76
|
-
/**
|
77
|
-
* override package json properties.
|
78
|
-
*/
|
79
|
-
overridePackageJsonProps: (props: PackageJsonProps) => EnvTransformer = this.react.overridePackageJsonProps.bind(
|
80
|
-
this.react
|
81
|
-
);
|
82
|
-
|
83
|
-
/**
|
84
|
-
* @deprecated - use useWebpack
|
85
|
-
* override the preview config in the env.
|
86
|
-
*/
|
87
|
-
overridePreviewConfig = this.react.overridePreviewConfig.bind(this.react);
|
88
|
-
|
89
|
-
/**
|
90
|
-
* @deprecated - use useWebpack
|
91
|
-
* override the dev server configuration.
|
92
|
-
*/
|
93
|
-
overrideDevServerConfig = this.react.overrideDevServerConfig.bind(this.react);
|
94
|
-
|
95
|
-
/**
|
96
|
-
* override the env's typescript config for both dev and build time.
|
97
|
-
* Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig)
|
98
|
-
*/
|
99
|
-
useTypescript(modifiers?: UseTypescriptModifiers, tsModule?: any) {
|
100
|
-
const overrides: any = {};
|
101
|
-
const devTransformers = modifiers?.devConfig;
|
102
|
-
if (devTransformers) {
|
103
|
-
overrides.getCompiler = () => this.nodeEnv.getCompiler(devTransformers, tsModule);
|
104
|
-
}
|
105
|
-
const buildTransformers = modifiers?.buildConfig;
|
106
|
-
if (buildTransformers) {
|
107
|
-
const buildPipeModifiers = {
|
108
|
-
tsModifier: {
|
109
|
-
transformers: buildTransformers,
|
110
|
-
module: tsModule,
|
111
|
-
},
|
112
|
-
};
|
113
|
-
overrides.getBuildPipe = () => this.nodeEnv.getBuildPipe(buildPipeModifiers);
|
114
|
-
}
|
115
|
-
return this.envs.override(overrides);
|
116
|
-
}
|
117
|
-
|
118
|
-
/**
|
119
|
-
* override the env's dev server and preview webpack configurations.
|
120
|
-
* Replaces both overrideDevServerConfig and overridePreviewConfig
|
121
|
-
*/
|
122
|
-
useWebpack = this.react.useWebpack.bind(this.react);
|
123
|
-
|
124
|
-
/**
|
125
|
-
* An API to mutate the prettier config
|
126
|
-
*/
|
127
|
-
usePrettier = this.react.usePrettier.bind(this.react);
|
128
|
-
|
129
|
-
/**
|
130
|
-
* An API to mutate the eslint config
|
131
|
-
*/
|
132
|
-
useEslint = this.react.useEslint.bind(this.react);
|
133
|
-
|
134
|
-
/**
|
135
|
-
* override the dependency configuration of the component environment.
|
136
|
-
*/
|
137
|
-
overrideDependencies(dependencyPolicy: EnvPolicyConfigObject) {
|
138
|
-
return this.envs.override({
|
139
|
-
getDependencies: () => merge(this.nodeEnv.getDependencies(), dependencyPolicy),
|
140
|
-
});
|
141
|
-
}
|
142
|
-
|
143
|
-
overrideMounter = this.react.overrideMounter.bind(this.react);
|
144
|
-
|
145
|
-
/**
|
146
|
-
* create a new composition of the node environment.
|
147
|
-
*/
|
148
|
-
compose(transformers: EnvTransformer[], targetEnv: Environment = {}) {
|
149
|
-
return this.envs.compose(this.envs.merge(targetEnv, this.nodeEnv), transformers);
|
150
|
-
}
|
151
|
-
|
152
|
-
static runtime = MainRuntime;
|
153
|
-
static dependencies = [
|
154
|
-
LoggerAspect,
|
155
|
-
EnvsAspect,
|
156
|
-
ApplicationAspect,
|
157
|
-
ReactAspect,
|
158
|
-
GeneratorAspect,
|
159
|
-
TypescriptAspect,
|
160
|
-
WorkerAspect,
|
161
|
-
];
|
162
|
-
|
163
|
-
static async provider(
|
164
|
-
[loggerAspect, envs, application, react, generator, tsAspect, workerMain]: [
|
165
|
-
LoggerMain,
|
166
|
-
EnvsMain,
|
167
|
-
ApplicationMain,
|
168
|
-
ReactMain,
|
169
|
-
GeneratorMain,
|
170
|
-
TypescriptMain,
|
171
|
-
WorkerMain
|
172
|
-
],
|
173
|
-
config,
|
174
|
-
slots,
|
175
|
-
harmony: Harmony
|
176
|
-
) {
|
177
|
-
const logger = loggerAspect.createLogger(NodeAspect.id);
|
178
|
-
const nodeEnv = envs.merge<NodeEnv, ReactEnv>(new NodeEnv(tsAspect, react), react.reactEnv);
|
179
|
-
envs.registerEnv(nodeEnv);
|
180
|
-
const nodeAppType = new NodeAppType('node-app', nodeEnv, logger);
|
181
|
-
application.registerAppType(nodeAppType);
|
182
|
-
if (generator) {
|
183
|
-
const envContext = new EnvContext(ComponentID.fromString(ReactAspect.id), loggerAspect, workerMain, harmony);
|
184
|
-
generator.registerComponentTemplate(getTemplates(envContext));
|
185
|
-
}
|
186
|
-
return new NodeMain(react, tsAspect, nodeEnv, envs);
|
187
|
-
}
|
188
|
-
}
|
189
|
-
|
190
|
-
NodeAspect.addRuntime(NodeMain);
|
package/node.templates.ts
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
NodeModuleTemplate,
|
3
|
-
NodeAppTemplate,
|
4
|
-
PlatformTemplate,
|
5
|
-
GraphQLServerTemplate,
|
6
|
-
EntityTemplate,
|
7
|
-
ExpressAppTemplate,
|
8
|
-
NodeEnvTemplate,
|
9
|
-
BitAppTemplate,
|
10
|
-
} from '@bitdev/node.generators.node-templates';
|
11
|
-
|
12
|
-
import { EnvContext } from '@teambit/envs';
|
13
|
-
import { ComponentTemplate, TemplateList } from '@teambit/generator';
|
14
|
-
|
15
|
-
const templateListHandler = TemplateList.from([
|
16
|
-
NodeModuleTemplate.from({ env: 'bitdev.node/node-env' }),
|
17
|
-
GraphQLServerTemplate.from({ env: 'bitdev.node/node-env' }),
|
18
|
-
EntityTemplate.from({ env: 'bitdev.node/node-env' }),
|
19
|
-
ExpressAppTemplate.from({ env: 'bitdev.node/node-env' }),
|
20
|
-
BitAppTemplate.from({ env: 'bitdev.node/node-env' }),
|
21
|
-
PlatformTemplate.from({ env: 'bitdev.node/node-env' }),
|
22
|
-
NodeAppTemplate.from({ env: 'bitdev.node/node-env' }),
|
23
|
-
NodeEnvTemplate.from({}),
|
24
|
-
]);
|
25
|
-
|
26
|
-
export function getTemplates(envContext: EnvContext): ComponentTemplate[] {
|
27
|
-
const templateList = templateListHandler(envContext);
|
28
|
-
return templateList.compute();
|
29
|
-
}
|
File without changes
|
File without changes
|