@teambit/bundler 0.0.555 → 0.0.559

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/bundler",
3
- "version": "0.0.555",
3
+ "version": "0.0.559",
4
4
  "homepage": "https://bit.dev/teambit/compilation/bundler",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.compilation",
8
8
  "name": "bundler",
9
- "version": "0.0.555"
9
+ "version": "0.0.559"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -15,13 +15,13 @@
15
15
  "lodash": "4.17.21",
16
16
  "@babel/runtime": "7.12.18",
17
17
  "core-js": "^3.0.0",
18
- "@teambit/envs": "0.0.555",
19
- "@teambit/cli": "0.0.386",
20
- "@teambit/component": "0.0.555",
21
- "@teambit/graphql": "0.0.555",
22
- "@teambit/pubsub": "0.0.555",
23
- "@teambit/builder": "0.0.555",
24
- "@teambit/toolbox.network.get-port": "0.0.90"
18
+ "@teambit/envs": "0.0.559",
19
+ "@teambit/cli": "0.0.389",
20
+ "@teambit/component": "0.0.559",
21
+ "@teambit/graphql": "0.0.559",
22
+ "@teambit/pubsub": "0.0.559",
23
+ "@teambit/builder": "0.0.559",
24
+ "@teambit/toolbox.network.get-port": "0.0.93"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/lodash": "4.14.165",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@apollo/client": "^3.0.0",
37
- "@teambit/legacy": "1.0.172",
37
+ "@teambit/legacy": "1.0.175",
38
38
  "react-dom": "^16.8.0 || ^17.0.0",
39
39
  "react": "^16.8.0 || ^17.0.0"
40
40
  },
@@ -62,12 +62,27 @@
62
62
  "react": "-"
63
63
  },
64
64
  "peerDependencies": {
65
- "@teambit/legacy": "1.0.172",
65
+ "@teambit/legacy": "1.0.175",
66
66
  "react-dom": "^16.8.0 || ^17.0.0",
67
67
  "react": "^16.8.0 || ^17.0.0"
68
68
  }
69
69
  }
70
70
  },
71
+ "files": [
72
+ "dist",
73
+ "!dist/tsconfig.tsbuildinfo",
74
+ "**/*.md",
75
+ "**/*.mdx",
76
+ "**/*.js",
77
+ "**/*.json",
78
+ "**/*.sass",
79
+ "**/*.scss",
80
+ "**/*.less",
81
+ "**/*.css",
82
+ "**/*.css",
83
+ "**/*.jpeg",
84
+ "**/*.gif"
85
+ ],
71
86
  "private": false,
72
87
  "engines": {
73
88
  "node": ">=12.22.0"
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,
@@ -1,5 +0,0 @@
1
- import { ExecutionContext } from '@teambit/envs';
2
-
3
- export type BrowserRuntime = {
4
- entry: (context: ExecutionContext) => Promise<string[]>;
5
- };
package/bundle.ts DELETED
@@ -1,3 +0,0 @@
1
- export class Bundle {
2
- constructor(readonly errors: Error) {}
3
- }
package/bundler.aspect.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const BundlerAspect = Aspect.create({
4
- id: 'teambit.compilation/bundler',
5
- });
@@ -1,138 +0,0 @@
1
- import PubsubAspect, { PubsubMain } from '@teambit/pubsub';
2
- import { MainRuntime } from '@teambit/cli';
3
- import { Component, ComponentAspect } from '@teambit/component';
4
- import { EnvsAspect, EnvsMain } from '@teambit/envs';
5
- import { GraphqlAspect, GraphqlMain } from '@teambit/graphql';
6
- import { Slot, SlotRegistry } from '@teambit/harmony';
7
- import { BrowserRuntime } from './browser-runtime';
8
- import { BundlerAspect } from './bundler.aspect';
9
- import { ComponentServer } from './component-server';
10
- import { BundlerContext } from './dev-server-context';
11
- import { devServerSchema } from './dev-server.graphql';
12
- import { DevServerService } from './dev-server.service';
13
-
14
- export type BrowserRuntimeSlot = SlotRegistry<BrowserRuntime>;
15
-
16
- export type BundlerConfig = {
17
- dedicatedEnvDevServers: string[];
18
- };
19
-
20
- /**
21
- * bundler extension.
22
- */
23
- export class BundlerMain {
24
- constructor(
25
- readonly config: BundlerConfig,
26
- /**
27
- * Pubsub extension.
28
- */
29
- private pubsub: PubsubMain,
30
-
31
- /**
32
- * environments extension.
33
- */
34
- private envs: EnvsMain,
35
-
36
- /**
37
- * dev server service.
38
- */
39
- private devService: DevServerService,
40
-
41
- /**
42
- * browser runtime slot.
43
- */
44
- private runtimeSlot: BrowserRuntimeSlot
45
- ) {}
46
-
47
- /**
48
- * load all given components in corresponding dev servers.
49
- * @param components defaults to all components in the workspace.
50
- */
51
- async devServer(components: Component[]): Promise<ComponentServer[]> {
52
- const envRuntime = await this.envs.createEnvironment(components);
53
- // TODO: this must be refactored away from here. this logic should be in the Preview.
54
- const servers: ComponentServer[] = await envRuntime.runOnce<ComponentServer[]>(this.devService, {
55
- dedicatedEnvDevServers: this.config.dedicatedEnvDevServers,
56
- });
57
- this._componentServers = servers;
58
-
59
- this.indexByComponent();
60
-
61
- return this._componentServers;
62
- }
63
-
64
- /**
65
- * get a dev server instance containing a component.
66
- * @param component
67
- */
68
- getComponentServer(component: Component): undefined | ComponentServer {
69
- if (!this._componentServers) return undefined;
70
- const envId = this.envs.getEnvId(component);
71
- const server = this._componentServers.find(
72
- (componentServer) =>
73
- componentServer.context.relatedContexts.includes(envId) || componentServer.context.id === envId
74
- );
75
-
76
- return server;
77
- }
78
-
79
- /**
80
- * compute entry files for bundling components in a given execution context.
81
- */
82
- async computeEntries(context: BundlerContext) {
83
- const slotEntries = await Promise.all(
84
- this.runtimeSlot.values().map(async (browserRuntime) => browserRuntime.entry(context))
85
- );
86
-
87
- const slotPaths = slotEntries.reduce((acc, current) => {
88
- acc = acc.concat(current);
89
- return acc;
90
- });
91
-
92
- return slotPaths;
93
- }
94
-
95
- /**
96
- * register a new browser runtime environment.
97
- * @param browserRuntime
98
- */
99
- registerTarget(browserRuntime: BrowserRuntime[]) {
100
- browserRuntime.map((runtime) => {
101
- return this.runtimeSlot.register(runtime);
102
- });
103
-
104
- return this;
105
- }
106
-
107
- /**
108
- * component servers.
109
- */
110
- private _componentServers: null | ComponentServer[];
111
-
112
- private indexByComponent() {}
113
-
114
- static slots = [Slot.withType<BrowserRuntime>()];
115
-
116
- static runtime = MainRuntime;
117
- static dependencies = [PubsubAspect, EnvsAspect, GraphqlAspect, ComponentAspect];
118
-
119
- static defaultConfig = {
120
- dedicatedEnvDevServers: [],
121
- };
122
-
123
- static async provider(
124
- [pubsub, envs, graphql]: [PubsubMain, EnvsMain, GraphqlMain],
125
- config,
126
- [runtimeSlot]: [BrowserRuntimeSlot]
127
- ) {
128
- const devServerService = new DevServerService(pubsub, runtimeSlot);
129
- const bundler = new BundlerMain(config, pubsub, envs, devServerService, runtimeSlot);
130
- envs.registerService(devServerService);
131
-
132
- graphql.register(devServerSchema(bundler));
133
-
134
- return bundler;
135
- }
136
- }
137
-
138
- BundlerAspect.addRuntime(BundlerMain);
package/bundler.ts DELETED
@@ -1,26 +0,0 @@
1
- import { Component } from '@teambit/component';
2
-
3
- export interface DevServer {
4
- start(): void;
5
- }
6
-
7
- export type BundlerResult = {
8
- errors: Error[];
9
- warnings: string[];
10
- components: Component[];
11
- /**
12
- * timestamp in milliseconds when the task started
13
- */
14
- startTime?: number;
15
-
16
- /**
17
- * timestamp in milliseconds when the task ended
18
- */
19
- endTime?: number;
20
- };
21
-
22
- export interface Bundler {
23
- run(): Promise<BundlerResult[]>;
24
- }
25
-
26
- export type BundlerMode = 'dev' | 'prod';
@@ -1,93 +0,0 @@
1
- import { Component } from '@teambit/component';
2
- import { ExecutionContext } from '@teambit/envs';
3
- import { PubsubMain } from '@teambit/pubsub';
4
-
5
- import { AddressInfo } from 'net';
6
-
7
- import { DevServer } from './dev-server';
8
- import { BindError } from './exceptions';
9
- import { ComponentsServerStartedEvent } from './events';
10
- import { BundlerAspect } from './bundler.aspect';
11
- import { selectPort } from './select-port';
12
-
13
- export class ComponentServer {
14
- // why is this here
15
- errors?: Error[];
16
- constructor(
17
- /**
18
- * browser runtime slot
19
- */
20
- private pubsub: PubsubMain,
21
-
22
- /**
23
- * components contained in the existing component server.
24
- */
25
- readonly context: ExecutionContext,
26
-
27
- /**
28
- * port range of the component server.
29
- */
30
- readonly portRange: number[],
31
-
32
- /**
33
- * env dev server.
34
- */
35
- readonly devServer: DevServer
36
- ) {}
37
-
38
- hostname: string | undefined;
39
-
40
- /**
41
- * determine whether component server contains a component.
42
- */
43
- hasComponent(component: Component) {
44
- return this.context.components.find((contextComponent) => contextComponent.equals(component));
45
- }
46
-
47
- get port() {
48
- return this._port;
49
- }
50
-
51
- _port: number;
52
- async listen() {
53
- const port = await selectPort(this.portRange);
54
- this._port = port;
55
- const server = await this.devServer.listen(port);
56
- const address = server.address();
57
- const hostname = this.getHostname(address);
58
- if (!address) throw new BindError();
59
- this.hostname = hostname;
60
-
61
- this.pubsub.pub(BundlerAspect.id, this.createComponentsServerStartedEvent(server, this.context, hostname, port));
62
- }
63
-
64
- private getHostname(address: string | AddressInfo | null) {
65
- if (address === null) throw new BindError();
66
- if (typeof address === 'string') return address;
67
-
68
- let hostname = address.address;
69
- if (hostname === '::') {
70
- hostname = 'localhost';
71
- }
72
-
73
- return hostname;
74
- }
75
-
76
- private onChange() {}
77
-
78
- private createComponentsServerStartedEvent: (
79
- DevServer,
80
- ExecutionContext,
81
- string,
82
- number
83
- ) => ComponentsServerStartedEvent = (componentsServer, context, hostname, port) => {
84
- return new ComponentsServerStartedEvent(Date.now(), componentsServer, context, hostname, port);
85
- };
86
-
87
- /**
88
- * get the url of the component server.
89
- */
90
- get url() {
91
- return `/preview/${this.context.envRuntime.id}`;
92
- }
93
- }
package/dedup-envs.ts DELETED
@@ -1,26 +0,0 @@
1
- import type { ExecutionContext } from '@teambit/envs';
2
-
3
- // de-duping dev servers by the amount of type the dev server configuration was overridden by envs.
4
- export function dedupEnvs(contexts: ExecutionContext[], dedicatedEnvDevServers?: string[]) {
5
- const groupedEnvs: Record<string, ExecutionContext[]> = {};
6
-
7
- contexts.forEach((context) => {
8
- const envId = getEnvId(context, dedicatedEnvDevServers);
9
- if (!envId) return;
10
- if (!(envId in groupedEnvs)) groupedEnvs[envId] = [];
11
-
12
- groupedEnvs[envId].push(context);
13
- });
14
-
15
- return groupedEnvs;
16
- }
17
-
18
- function getEnvId(context: ExecutionContext, dedicatedServers?: string[]): string | undefined {
19
- const id = context.id.split('@')[0];
20
-
21
- if (dedicatedServers?.includes(id)) {
22
- return context.id;
23
- }
24
-
25
- return context.env?.getDevEnvId(context);
26
- }
@@ -1,48 +0,0 @@
1
- import { Component } from '@teambit/component';
2
- import { BuildContext } from '@teambit/builder';
3
- import { ExecutionContext } from '@teambit/envs';
4
-
5
- export type Target = {
6
- /**
7
- * entries of the target.
8
- */
9
- entries: string[];
10
-
11
- /**
12
- * array of components included in the target.
13
- */
14
- components: Component[];
15
-
16
- /**
17
- * output path of the target
18
- */
19
- outputPath: string;
20
- };
21
-
22
- export interface BundlerContext extends BuildContext {
23
- targets: Target[];
24
- publicPath?: string;
25
- rootPath?: string;
26
- }
27
-
28
- export interface DevServerContext extends ExecutionContext {
29
- /**
30
- * array of files to include.
31
- */
32
- entry: string[];
33
-
34
- /**
35
- * public path.
36
- */
37
- publicPath: string;
38
-
39
- /**
40
- * root path of the workspace.
41
- */
42
- rootPath: string;
43
-
44
- /**
45
- * title of the page.
46
- */
47
- title?: string;
48
- }
@@ -1,34 +0,0 @@
1
- import { Component } from '@teambit/component';
2
- import { Schema } from '@teambit/graphql';
3
- import { gql } from '@apollo/client';
4
-
5
- import { BundlerMain } from './bundler.main.runtime';
6
-
7
- // TODO: this has to be refactored to the Preview aspect. with the entire preview logic here.
8
- export function devServerSchema(bundler: BundlerMain): Schema {
9
- return {
10
- typeDefs: gql`
11
- extend type Component {
12
- server: ComponentServer
13
- }
14
-
15
- type ComponentServer {
16
- env: String
17
- url: String
18
- }
19
- `,
20
- resolvers: {
21
- Component: {
22
- server: (component: Component) => {
23
- const componentServer = bundler.getComponentServer(component);
24
- if (!componentServer) return {};
25
-
26
- return {
27
- env: componentServer.context.envRuntime.id,
28
- url: componentServer.url,
29
- };
30
- },
31
- },
32
- },
33
- };
34
- }
@@ -1,150 +0,0 @@
1
- import { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';
2
- import { PubsubMain } from '@teambit/pubsub';
3
- import { flatten } from 'lodash';
4
- import React from 'react';
5
- import { Text, Newline } from 'ink';
6
- import highlight from 'cli-highlight';
7
- import { BrowserRuntimeSlot } from './bundler.main.runtime';
8
- import { ComponentServer } from './component-server';
9
- import { dedupEnvs } from './dedup-envs';
10
- import { DevServer } from './dev-server';
11
- import { DevServerContext } from './dev-server-context';
12
- import { getEntry } from './get-entry';
13
-
14
- export type DevServerServiceOptions = { dedicatedEnvDevServers?: string[] };
15
-
16
- export type DevServerDescriptor = {
17
- /**
18
- * id of the dev server (e.g. jest/mocha)
19
- */
20
- id: string;
21
-
22
- /**
23
- * display name of the dev server (e.g. Jest / Mocha)
24
- */
25
- displayName: string;
26
-
27
- /**
28
- * icon of the configured dev server.
29
- */
30
- icon: string;
31
-
32
- /**
33
- * string containing the config for display.
34
- */
35
- config: string;
36
-
37
- version?: string;
38
- };
39
-
40
- export class DevServerService implements EnvService<ComponentServer, DevServerDescriptor> {
41
- name = 'dev server';
42
-
43
- constructor(
44
- /**
45
- * browser runtime slot
46
- */
47
- private pubsub: PubsubMain,
48
-
49
- /**
50
- * browser runtime slot
51
- */
52
- private runtimeSlot: BrowserRuntimeSlot
53
- ) {}
54
-
55
- async render(env: EnvDefinition, context: ExecutionContext[]) {
56
- const descriptor = await this.getDescriptor(env, context);
57
- return (
58
- <Text key={descriptor?.id}>
59
- <Text color="cyan">configured dev server: </Text>
60
- <Text>
61
- {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})
62
- </Text>
63
- <Newline />
64
- <Text underline color="cyan">
65
- dev server config:
66
- </Text>
67
- <Newline />
68
- <Text>
69
- {/* refactor a separate component which highlights for cli */}
70
- {highlight(descriptor?.config || '', { language: 'javascript', ignoreIllegals: true })}
71
- </Text>
72
- <Newline />
73
- </Text>
74
- );
75
- }
76
-
77
- async getDescriptor(
78
- environment: EnvDefinition,
79
- context?: ExecutionContext[]
80
- ): Promise<DevServerDescriptor | undefined> {
81
- if (!environment.env.getDevServer || !context) return undefined;
82
- const mergedContext = await this.buildContext(context[0], []);
83
- const devServer: DevServer = environment.env.getDevServer(mergedContext);
84
-
85
- return {
86
- id: devServer.id || '',
87
- displayName: devServer.displayName || '',
88
- icon: devServer.icon || '',
89
- config: devServer.displayConfig ? devServer.displayConfig() : '',
90
- version: devServer.version ? devServer.version() : '?',
91
- };
92
- }
93
-
94
- // async run(context: ExecutionContext): Promise<ComponentServer[]> {
95
- // const devServerContext = await this.buildContext(context);
96
- // const devServer: DevServer = context.env.getDevServer(devServerContext);
97
- // const port = await selectPort();
98
- // // TODO: refactor to replace with a component server instance.
99
- // return new ComponentServer(this.pubsub, context, port, devServer);
100
- // }
101
-
102
- async runOnce(
103
- contexts: ExecutionContext[],
104
- { dedicatedEnvDevServers }: DevServerServiceOptions
105
- ): Promise<ComponentServer[]> {
106
- const groupedEnvs = dedupEnvs(contexts, dedicatedEnvDevServers);
107
-
108
- const servers = await Promise.all(
109
- Object.entries(groupedEnvs).map(async ([id, contextList]) => {
110
- const mainContext = contextList.find((context) => context.envDefinition.id === id) || contextList[0];
111
- const additionalContexts = contextList.filter((context) => context.envDefinition.id !== id);
112
-
113
- const devServerContext = await this.buildContext(mainContext, additionalContexts);
114
- const devServer: DevServer = await devServerContext.envRuntime.env.getDevServer(devServerContext);
115
-
116
- return new ComponentServer(this.pubsub, devServerContext, [3300, 3400], devServer);
117
- })
118
- );
119
-
120
- return servers;
121
- }
122
-
123
- mergeContext() {}
124
-
125
- private getComponentsFromContexts(contexts: ExecutionContext[]) {
126
- return flatten(
127
- contexts.map((context) => {
128
- return context.components;
129
- })
130
- );
131
- }
132
-
133
- /**
134
- * builds the execution context for the dev server.
135
- */
136
- private async buildContext(
137
- context: ExecutionContext,
138
- additionalContexts: ExecutionContext[] = []
139
- ): Promise<DevServerContext> {
140
- context.relatedContexts = additionalContexts.map((ctx) => ctx.envDefinition.id);
141
- context.components = context.components.concat(this.getComponentsFromContexts(additionalContexts));
142
-
143
- return Object.assign(context, {
144
- entry: await getEntry(context, this.runtimeSlot),
145
- // don't start with a leading "/" because it generates errors on Windows
146
- rootPath: `preview/${context.envRuntime.id}`,
147
- publicPath: `/public`,
148
- });
149
- }
150
- }
package/dev-server.ts DELETED
@@ -1,41 +0,0 @@
1
- import { Server } from 'http';
2
-
3
- /**
4
- * interface for implementing dev servers.
5
- */
6
- export interface DevServer {
7
- /**
8
- * attach to given port and start an http server
9
- */
10
- listen(port: number): Server | Promise<Server>;
11
-
12
- /**
13
- * display name of the tester.
14
- */
15
- displayName?: string;
16
-
17
- /**
18
- * icon of the tester.
19
- */
20
- icon?: string;
21
-
22
- /**
23
- * serialized config of the tester.
24
- */
25
- displayConfig?(): string;
26
-
27
- /**
28
- * path to the config in the filesystem.
29
- */
30
- configPath?: string;
31
-
32
- /**
33
- * id of the tester.
34
- */
35
- id: string;
36
-
37
- /**
38
- * return the tester version.
39
- */
40
- version?(): string;
41
- }
@@ -1,20 +0,0 @@
1
- /* eslint-disable max-classes-per-file */
2
-
3
- import { BitBaseEvent } from '@teambit/pubsub';
4
-
5
- class ComponentsServerStartedEventData {
6
- constructor(readonly componentsServer, readonly context, readonly hostname, readonly port) {}
7
- }
8
-
9
- export class ComponentsServerStartedEvent extends BitBaseEvent<ComponentsServerStartedEventData> {
10
- static readonly TYPE = 'components-server-started';
11
-
12
- constructor(readonly timestamp, readonly componentsServer, readonly context, readonly hostname, readonly port) {
13
- super(
14
- ComponentsServerStartedEvent.TYPE,
15
- '0.0.1',
16
- timestamp,
17
- new ComponentsServerStartedEventData(componentsServer, context, hostname, port)
18
- );
19
- }
20
- }
package/events/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components-server-started-event';
@@ -1 +0,0 @@
1
- export class BindError extends Error {}
@@ -1 +0,0 @@
1
- export { BindError } from './bind-error';
package/get-entry.ts DELETED
@@ -1,31 +0,0 @@
1
- import { ComponentID } from '@teambit/component';
2
- import { ExecutionContext } from '@teambit/envs';
3
- import { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';
4
- import { PathOsBased } from '@teambit/legacy/dist/utils/path';
5
-
6
- import { BrowserRuntimeSlot } from './bundler.main.runtime';
7
-
8
- export type ComponentDir = {
9
- componentDir?: (
10
- componentId: ComponentID,
11
- bitMapOptions?: GetBitMapComponentOptions,
12
- options?: { relative: boolean }
13
- ) => PathOsBased | undefined;
14
- };
15
-
16
- /**
17
- * computes the bundler entry.
18
- */
19
- export async function getEntry(context: ExecutionContext, runtimeSlot: BrowserRuntimeSlot): Promise<string[]> {
20
- // TODO: refactor this away from here and use computePaths instead
21
- const slotEntries = await Promise.all(
22
- runtimeSlot.values().map(async (browserRuntime) => browserRuntime.entry(context))
23
- );
24
-
25
- const slotPaths = slotEntries.reduce((acc, current) => {
26
- acc = acc.concat(current);
27
- return acc;
28
- });
29
-
30
- return slotPaths;
31
- }
package/index.ts DELETED
@@ -1,8 +0,0 @@
1
- export { DevServer } from './dev-server';
2
- export { BundlerContext, Target, DevServerContext } from './dev-server-context';
3
- export { Bundler, BundlerResult, BundlerMode } from './bundler';
4
- export type { BundlerMain } from './bundler.main.runtime';
5
- export { BundlerAspect } from './bundler.aspect';
6
- export { ComponentDir } from './get-entry';
7
- export { ComponentServer } from './component-server';
8
- export * from './events';
package/select-port.ts DELETED
@@ -1,8 +0,0 @@
1
- import { Port } from '@teambit/toolbox.network.get-port';
2
-
3
- /**
4
- * get an available port between range 3000 to 3200 or from port range
5
- */
6
- export async function selectPort(range: number[] | number): Promise<number> {
7
- return Port.getPortFromRange(range);
8
- }
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
- }