@teambit/bundler 1.0.107 → 1.0.109
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/preview/teambit_compilation_bundler-preview.js +1 -0
- package/dist/browser-runtime.d.ts +1 -1
- package/dist/bundler-context.d.ts +8 -8
- package/dist/bundler.composition.d.ts +2 -2
- package/dist/bundler.d.ts +6 -6
- package/dist/bundler.main.runtime.d.ts +5 -5
- package/dist/bundler.service.d.ts +1 -1
- package/dist/bundler.service.js +1 -1
- package/dist/bundler.service.js.map +1 -1
- package/dist/component-server.d.ts +1 -1
- package/dist/dedup-envs.d.ts +1 -1
- package/dist/dedup-envs.js +2 -3
- package/dist/dedup-envs.js.map +1 -1
- package/dist/dev-server.service.d.ts +5 -5
- package/dist/dev-server.service.js +5 -6
- package/dist/dev-server.service.js.map +1 -1
- package/dist/get-entry.d.ts +1 -1
- package/dist/{preview-1703590665075.js → preview-1703698405864.js} +2 -2
- package/package.json +19 -26
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.compilation/bundler-preview"]=t():e["teambit.compilation/bundler-preview"]=t()}(self,(()=>(()=>{"use strict";var e={2041:(e,t,o)=>{var n={id:"teambit.compilation/bundler@1.0.109",homepage:"https://bit.cloud/teambit/compilation/bundler",exported:!0};function r(){const e=i(o(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,i.__bit_component=n;const p=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/bundler.svg"}));p.__bit_component=n,t.Logo=p},87363:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>l,compositions_metadata:()=>f,overview:()=>u});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(2041);o(87363);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var p=["components"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},a.apply(this,arguments)}var c={},s="wrapper";function d(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,p);return(0,r.mdx)(s,a({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const l=[t],u=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '@teambit/component';
|
|
2
2
|
import { BuildContext } from '@teambit/builder';
|
|
3
|
-
export
|
|
3
|
+
export type LibraryOptions = {
|
|
4
4
|
/**
|
|
5
5
|
* Specify a name for the library
|
|
6
6
|
*/
|
|
@@ -11,7 +11,7 @@ export declare type LibraryOptions = {
|
|
|
11
11
|
*/
|
|
12
12
|
type?: string;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type Entry = {
|
|
15
15
|
/**
|
|
16
16
|
* Specifies the name of each output file on disk
|
|
17
17
|
*/
|
|
@@ -25,10 +25,10 @@ export declare type Entry = {
|
|
|
25
25
|
*/
|
|
26
26
|
library?: LibraryOptions;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type EntryMap = {
|
|
29
29
|
[entryName: string]: Entry;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type Target = {
|
|
32
32
|
/**
|
|
33
33
|
* entries of the target.
|
|
34
34
|
*/
|
|
@@ -98,7 +98,7 @@ export declare type Target = {
|
|
|
98
98
|
*/
|
|
99
99
|
aliasHostDependencies?: boolean;
|
|
100
100
|
};
|
|
101
|
-
export
|
|
101
|
+
export type ModuleTarget = {
|
|
102
102
|
/**
|
|
103
103
|
* name of the module.
|
|
104
104
|
*/
|
|
@@ -113,7 +113,7 @@ export declare type ModuleTarget = {
|
|
|
113
113
|
[key: string]: any;
|
|
114
114
|
};
|
|
115
115
|
};
|
|
116
|
-
export
|
|
116
|
+
export type HtmlConfig = {
|
|
117
117
|
/**
|
|
118
118
|
* The title to use for the generated HTML document
|
|
119
119
|
*/
|
|
@@ -144,13 +144,13 @@ export declare type HtmlConfig = {
|
|
|
144
144
|
*/
|
|
145
145
|
favicon?: string;
|
|
146
146
|
};
|
|
147
|
-
export
|
|
147
|
+
export type Chunking = {
|
|
148
148
|
/**
|
|
149
149
|
* include all types of chunks (async / non-async) in splitting
|
|
150
150
|
*/
|
|
151
151
|
splitChunks: boolean;
|
|
152
152
|
};
|
|
153
|
-
export
|
|
153
|
+
export type MetaData = {
|
|
154
154
|
/**
|
|
155
155
|
* Who initiate the bundling process
|
|
156
156
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Logo: () =>
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Logo: () => JSX.Element;
|
package/dist/bundler.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Component } from '@teambit/component';
|
|
|
2
2
|
export interface DevServer {
|
|
3
3
|
start(): void;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type Asset = {
|
|
6
6
|
/**
|
|
7
7
|
* name of the asset.
|
|
8
8
|
*/
|
|
@@ -16,10 +16,10 @@ export declare type Asset = {
|
|
|
16
16
|
*/
|
|
17
17
|
compressedSize?: number;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type ChunksAssetsMap = {
|
|
20
20
|
[assetName: string]: string[];
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type EntryAssets = {
|
|
23
23
|
assets: Asset[];
|
|
24
24
|
auxiliaryAssets: Asset[];
|
|
25
25
|
assetsSize: number;
|
|
@@ -27,10 +27,10 @@ export declare type EntryAssets = {
|
|
|
27
27
|
auxiliaryAssetsSize: number;
|
|
28
28
|
compressedAuxiliaryAssetsSize: number;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type EntriesAssetsMap = {
|
|
31
31
|
[entryId: string]: EntryAssets;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type BundlerResult = {
|
|
34
34
|
/**
|
|
35
35
|
* list of generated assets.
|
|
36
36
|
*/
|
|
@@ -71,4 +71,4 @@ export declare type BundlerResult = {
|
|
|
71
71
|
export interface Bundler {
|
|
72
72
|
run(): Promise<BundlerResult[]>;
|
|
73
73
|
}
|
|
74
|
-
export
|
|
74
|
+
export type BundlerMode = 'dev' | 'prod';
|
|
@@ -9,12 +9,12 @@ import { ComponentServer } from './component-server';
|
|
|
9
9
|
import { BundlerContext } from './bundler-context';
|
|
10
10
|
import { DevServerService } from './dev-server.service';
|
|
11
11
|
import { DevServer } from './dev-server';
|
|
12
|
-
export
|
|
12
|
+
export type DevServerTransformer = (devServer: DevServer, { envId }: {
|
|
13
13
|
envId: string;
|
|
14
14
|
}) => DevServer;
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
15
|
+
export type BrowserRuntimeSlot = SlotRegistry<BrowserRuntime>;
|
|
16
|
+
export type DevServerTransformerSlot = SlotRegistry<DevServerTransformer>;
|
|
17
|
+
export type BundlerConfig = {
|
|
18
18
|
dedicatedEnvDevServers: string[];
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
@@ -96,7 +96,7 @@ export declare class BundlerMain {
|
|
|
96
96
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
97
97
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
98
98
|
static defaultConfig: {
|
|
99
|
-
dedicatedEnvDevServers:
|
|
99
|
+
dedicatedEnvDevServers: any[];
|
|
100
100
|
};
|
|
101
101
|
static provider([pubsub, envs, graphql, dependencyResolver]: [PubsubMain, EnvsMain, GraphqlMain, DependencyResolverMain], config: any, [runtimeSlot, devServerTransformerSlot]: [BrowserRuntimeSlot, DevServerTransformerSlot]): Promise<BundlerMain>;
|
|
102
102
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
|
|
2
2
|
import { Bundler } from './bundler';
|
|
3
3
|
import { BundlerContext } from './bundler-context';
|
|
4
|
-
|
|
4
|
+
type BundlerTransformationMap = ServiceTransformationMap & {
|
|
5
5
|
getBundler?: (context: BundlerContext) => Promise<Bundler>;
|
|
6
6
|
};
|
|
7
7
|
export declare class BundlerService implements EnvService<any> {
|
package/dist/bundler.service.js
CHANGED
|
@@ -13,7 +13,7 @@ class BundlerService {
|
|
|
13
13
|
}
|
|
14
14
|
transform(env, envContext) {
|
|
15
15
|
// Old env
|
|
16
|
-
if (!
|
|
16
|
+
if (!env?.preview) return undefined;
|
|
17
17
|
const preview = env.preview()(envContext);
|
|
18
18
|
return {
|
|
19
19
|
getBundler: context => preview.getBundler(context)(envContext)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BundlerService","constructor","_defineProperty","transform","env","envContext","preview","undefined","getBundler","context","exports"],"sources":["bundler.service.tsx"],"sourcesContent":["import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { Bundler } from './bundler';\nimport { BundlerContext } from './bundler-context';\n\ntype BundlerTransformationMap = ServiceTransformationMap & {\n getBundler?: (context: BundlerContext) => Promise<Bundler>;\n};\nexport class BundlerService implements EnvService<any> {\n name = 'bundler';\n\n transform(env: Env, envContext: EnvContext): BundlerTransformationMap | undefined {\n // Old env\n if (!env?.preview) return undefined;\n const preview = env.preview()(envContext);\n\n return {\n getBundler: (context) => preview.getBundler(context)(envContext),\n };\n }\n}\n"],"mappings":";;;;;;;;;AAOO,MAAMA,cAAc,CAA4B;EAAAC,YAAA;IAAAC,eAAA,eAC9C,SAAS;EAAA;EAEhBC,SAASA,CAACC,GAAQ,EAAEC,UAAsB,EAAwC;IAChF;IACA,IAAI,
|
|
1
|
+
{"version":3,"names":["BundlerService","constructor","_defineProperty","transform","env","envContext","preview","undefined","getBundler","context","exports"],"sources":["bundler.service.tsx"],"sourcesContent":["import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { Bundler } from './bundler';\nimport { BundlerContext } from './bundler-context';\n\ntype BundlerTransformationMap = ServiceTransformationMap & {\n getBundler?: (context: BundlerContext) => Promise<Bundler>;\n};\nexport class BundlerService implements EnvService<any> {\n name = 'bundler';\n\n transform(env: Env, envContext: EnvContext): BundlerTransformationMap | undefined {\n // Old env\n if (!env?.preview) return undefined;\n const preview = env.preview()(envContext);\n\n return {\n getBundler: (context) => preview.getBundler(context)(envContext),\n };\n }\n}\n"],"mappings":";;;;;;;;;AAOO,MAAMA,cAAc,CAA4B;EAAAC,YAAA;IAAAC,eAAA,eAC9C,SAAS;EAAA;EAEhBC,SAASA,CAACC,GAAQ,EAAEC,UAAsB,EAAwC;IAChF;IACA,IAAI,CAACD,GAAG,EAAEE,OAAO,EAAE,OAAOC,SAAS;IACnC,MAAMD,OAAO,GAAGF,GAAG,CAACE,OAAO,CAAC,CAAC,CAACD,UAAU,CAAC;IAEzC,OAAO;MACLG,UAAU,EAAGC,OAAO,IAAKH,OAAO,CAACE,UAAU,CAACC,OAAO,CAAC,CAACJ,UAAU;IACjE,CAAC;EACH;AACF;AAACK,OAAA,CAAAV,cAAA,GAAAA,cAAA"}
|
|
@@ -41,7 +41,7 @@ export declare class ComponentServer {
|
|
|
41
41
|
/**
|
|
42
42
|
* determine whether component server contains a component.
|
|
43
43
|
*/
|
|
44
|
-
hasComponent(component: Component): Component
|
|
44
|
+
hasComponent(component: Component): Component;
|
|
45
45
|
get port(): number;
|
|
46
46
|
_port: number;
|
|
47
47
|
listen(): Promise<void>;
|
package/dist/dedup-envs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
2
2
|
import type { ExecutionContext } from '@teambit/envs';
|
|
3
|
-
|
|
3
|
+
type GroupIdContextMap = Record<string, ExecutionContext[]>;
|
|
4
4
|
/**
|
|
5
5
|
* de-duping dev servers by the amount of type the dev server configuration was overridden by envs.
|
|
6
6
|
* This will split the dev server to groups of dev server that share the same webpack config, and same peer dependencies
|
package/dist/dedup-envs.js
CHANGED
|
@@ -39,12 +39,11 @@ async function splitByPeers(idsGroups, dependencyResolver) {
|
|
|
39
39
|
return newGroupedEnvs;
|
|
40
40
|
}
|
|
41
41
|
function getEnvId(context, dedicatedServers) {
|
|
42
|
-
var _context$env;
|
|
43
42
|
const id = context.id.split('@')[0];
|
|
44
|
-
if (dedicatedServers
|
|
43
|
+
if (dedicatedServers?.includes(id)) {
|
|
45
44
|
return context.id;
|
|
46
45
|
}
|
|
47
|
-
return
|
|
46
|
+
return context.env?.getDevEnvId(context);
|
|
48
47
|
}
|
|
49
48
|
async function groupByPeersHash(contexts, dependencyResolver) {
|
|
50
49
|
const peerGroups = {};
|
package/dist/dedup-envs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dedupEnvs","contexts","dependencyResolver","dedicatedEnvDevServers","idsGroups","groupByEnvId","hasRootComponents","finalGroups","splitByPeers","groupedEnvs","forEach","context","envId","getEnvId","push","newGroupedEnvs","promises","Object","values","map","peersGroups","groupByPeersHash","assign","Promise","all","dedicatedServers","
|
|
1
|
+
{"version":3,"names":["dedupEnvs","contexts","dependencyResolver","dedicatedEnvDevServers","idsGroups","groupByEnvId","hasRootComponents","finalGroups","splitByPeers","groupedEnvs","forEach","context","envId","getEnvId","push","newGroupedEnvs","promises","Object","values","map","peersGroups","groupByPeersHash","assign","Promise","all","dedicatedServers","id","split","includes","env","getDevEnvId","peerGroups","policy","getComponentEnvPolicyFromEnv","peersHash","byLifecycleType","hashNameVersion","indexPeerGroupsById","result","reduce","acc","firstId"],"sources":["dedup-envs.ts"],"sourcesContent":["import { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport type { ExecutionContext } from '@teambit/envs';\n\ntype GroupIdContextMap = Record<string, ExecutionContext[]>;\n\n/**\n * de-duping dev servers by the amount of type the dev server configuration was overridden by envs.\n * This will split the dev server to groups of dev server that share the same webpack config, and same peer dependencies\n * @param contexts\n * @param dependencyResolver\n * @param dedicatedEnvDevServers\n */\nexport async function dedupEnvs(\n contexts: ExecutionContext[],\n dependencyResolver: DependencyResolverMain,\n dedicatedEnvDevServers?: string[]\n) {\n const idsGroups = groupByEnvId(contexts, dedicatedEnvDevServers);\n const hasRootComponents = dependencyResolver.hasRootComponents();\n // Do not split envs by peers if root components is enabled as it should be already handled by the package manager\n // this will improve the performance of the dev server when root components is enabled\n const finalGroups = hasRootComponents ? idsGroups : await splitByPeers(idsGroups, dependencyResolver);\n return finalGroups;\n}\n\nfunction groupByEnvId(contexts: ExecutionContext[], dedicatedEnvDevServers?: string[]) {\n const groupedEnvs: GroupIdContextMap = {};\n\n contexts.forEach((context) => {\n const envId = getEnvId(context, dedicatedEnvDevServers);\n if (!envId) return;\n if (!(envId in groupedEnvs)) groupedEnvs[envId] = [];\n\n groupedEnvs[envId].push(context);\n });\n\n return groupedEnvs;\n}\n\nasync function splitByPeers(idsGroups: GroupIdContextMap, dependencyResolver: DependencyResolverMain) {\n const newGroupedEnvs: GroupIdContextMap = {};\n const promises = Object.values(idsGroups).map(async (contexts) => {\n const peersGroups = await groupByPeersHash(contexts, dependencyResolver);\n Object.assign(newGroupedEnvs, peersGroups);\n });\n await Promise.all(promises);\n return newGroupedEnvs;\n}\n\nfunction getEnvId(context: ExecutionContext, dedicatedServers?: string[]): string | undefined {\n const id = context.id.split('@')[0];\n\n if (dedicatedServers?.includes(id)) {\n return context.id;\n }\n\n return context.env?.getDevEnvId(context);\n}\n\nasync function groupByPeersHash(contexts: ExecutionContext[], dependencyResolver: DependencyResolverMain) {\n const peerGroups: GroupIdContextMap = {};\n\n await Promise.all(\n contexts.map(async (context) => {\n const env = context.env;\n const policy = await dependencyResolver.getComponentEnvPolicyFromEnv(env, { envId: context.id });\n const peersHash = policy.byLifecycleType('peer').hashNameVersion();\n if (!peerGroups[peersHash]) {\n peerGroups[peersHash] = [];\n }\n peerGroups[peersHash].push(context);\n })\n );\n return indexPeerGroupsById(peerGroups);\n}\n\nfunction indexPeerGroupsById(peerGroups: GroupIdContextMap) {\n const result: GroupIdContextMap = Object.values(peerGroups).reduce((acc, contexts) => {\n const firstId = contexts[0].id;\n acc[firstId] = contexts;\n return acc;\n }, {});\n return result;\n}\n"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeA,SAASA,CAC7BC,QAA4B,EAC5BC,kBAA0C,EAC1CC,sBAAiC,EACjC;EACA,MAAMC,SAAS,GAAGC,YAAY,CAACJ,QAAQ,EAAEE,sBAAsB,CAAC;EAChE,MAAMG,iBAAiB,GAAGJ,kBAAkB,CAACI,iBAAiB,CAAC,CAAC;EAChE;EACA;EACA,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AEA,OAAOf,OAAO,CAACkB,GAAG,EAAEC,WAAW,CAACnB,OAAO,CAAC;AAC1C;AAEA,eAAeU,gBAAgBA,CAACpB,QAA4B,EAAEC,kBAA0C,EAAE;EACxG,MAAM6B,UAA6B,GAAG,CAAC,CAAC;EAExC,MAAMR,OAAO,CAACC,GAAG,CACfvB,QAAQ,CAACkB,GAAG,CAAC,MAAOR,OAAO,IAAK;IAC9B,MAAMkB,GAAG,GAAGlB,OAAO,CAACkB,GAAG;IACvB,MAAMG,MAAM,GAAG,MAAM9B,kBAAkB,CAAC+B,4BAA4B,CAACJ,GAAG,EAAE;MAAEjB,KAAK,EAAED,OAAO,CAACe;IAAG,CAAC,CAAC;IAChG,MAAMQ,SAAS,GAAGF,MAAM,CAACG,eAAe,CAAC,MAAM,CAAC,CAACC,eAAe,CAAC,CAAC;IAClE,IAAI,CAACL,UAAU,CAACG,SAAS,CAAC,EAAE;MAC1BH,UAAU,CAACG,SAAS,CAAC,GAAG,EAAE;IAC5B;IACAH,UAAU,CAACG,SAAS,CAAC,CAACpB,IAAI,CAACH,OAAO,CAAC;EACrC,CAAC,CACH,CAAC;EACD,OAAO0B,mBAAmB,CAACN,UAAU,CAAC;AACxC;AAEA,SAASM,mBAAmBA,CAACN,UAA6B,EAAE;EAC1D,MAAMO,MAAyB,GAAGrB,MAAM,CAACC,MAAM,CAACa,UAAU,CAAC,CAACQ,MAAM,CAAC,CAACC,GAAG,EAAEvC,QAAQ,KAAK;IACpF,MAAMwC,OAAO,GAAGxC,QAAQ,CAAC,CAAC,CAAC,CAACyB,EAAE;IAC9Bc,GAAG,CAACC,OAAO,CAAC,GAAGxC,QAAQ;IACvB,OAAOuC,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;EACN,OAAOF,MAAM;AACf"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
|
|
2
3
|
import { PubsubMain } from '@teambit/pubsub';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
5
5
|
import { BrowserRuntimeSlot, DevServerTransformerSlot } from './bundler.main.runtime';
|
|
6
6
|
import { ComponentServer } from './component-server';
|
|
7
7
|
import { DevServer } from './dev-server';
|
|
8
8
|
import { DevServerContext } from './dev-server-context';
|
|
9
|
-
export
|
|
9
|
+
export type DevServerServiceOptions = {
|
|
10
10
|
dedicatedEnvDevServers?: string[];
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type DevServiceTransformationMap = ServiceTransformationMap & {
|
|
13
13
|
/**
|
|
14
14
|
* Required for `bit start`
|
|
15
15
|
*/
|
|
@@ -20,7 +20,7 @@ declare type DevServiceTransformationMap = ServiceTransformationMap & {
|
|
|
20
20
|
*/
|
|
21
21
|
getDevServer?: (context: DevServerContext) => DevServer | Promise<DevServer>;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type DevServerDescriptor = {
|
|
24
24
|
/**
|
|
25
25
|
* id of the dev server (e.g. webpack)
|
|
26
26
|
*/
|
|
@@ -53,7 +53,7 @@ export declare class DevServerService implements EnvService<ComponentServer, Dev
|
|
|
53
53
|
* browser runtime slot
|
|
54
54
|
*/
|
|
55
55
|
runtimeSlot: BrowserRuntimeSlot, devServerTransformerSlot: DevServerTransformerSlot);
|
|
56
|
-
render(env: EnvDefinition, context: ExecutionContext[]): Promise<
|
|
56
|
+
render(env: EnvDefinition, context: ExecutionContext[]): Promise<JSX.Element>;
|
|
57
57
|
getDescriptor(environment: EnvDefinition, context?: ExecutionContext[]): Promise<DevServerDescriptor | undefined>;
|
|
58
58
|
transform(env: Env, envContext: EnvContext): DevServiceTransformationMap | undefined;
|
|
59
59
|
runOnce(contexts: ExecutionContext[], { dedicatedEnvDevServers }: DevServerServiceOptions): Promise<ComponentServer[]>;
|
|
@@ -79,13 +79,13 @@ class DevServerService {
|
|
|
79
79
|
async render(env, context) {
|
|
80
80
|
const descriptor = await this.getDescriptor(env, context);
|
|
81
81
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
82
|
-
key: descriptor
|
|
82
|
+
key: descriptor?.id
|
|
83
83
|
}, /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
84
84
|
color: "cyan"
|
|
85
|
-
}, "configured dev server: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor
|
|
85
|
+
}, "configured dev server: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor?.id, " (", descriptor?.displayName, " @ ", descriptor?.version, ")"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
86
86
|
underline: true,
|
|
87
87
|
color: "cyan"
|
|
88
|
-
}, "dev server config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null, (0, _cliHighlight().default)(
|
|
88
|
+
}, "dev server config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null, (0, _cliHighlight().default)(descriptor?.config || '', {
|
|
89
89
|
language: 'javascript',
|
|
90
90
|
ignoreIllegals: true
|
|
91
91
|
})), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
|
|
@@ -104,7 +104,7 @@ class DevServerService {
|
|
|
104
104
|
}
|
|
105
105
|
transform(env, envContext) {
|
|
106
106
|
// Old env
|
|
107
|
-
if (!
|
|
107
|
+
if (!env?.preview) return undefined;
|
|
108
108
|
const preview = env.preview()(envContext);
|
|
109
109
|
return {
|
|
110
110
|
getDevEnvId: () => {
|
|
@@ -151,11 +151,10 @@ class DevServerService {
|
|
|
151
151
|
* builds the execution context for the dev server.
|
|
152
152
|
*/
|
|
153
153
|
async buildContext(context, additionalContexts = []) {
|
|
154
|
-
var _context$envRuntime$e;
|
|
155
154
|
context.relatedContexts = additionalContexts.map(ctx => ctx.envDefinition.id);
|
|
156
155
|
context.components = context.components.concat(this.getComponentsFromContexts(additionalContexts));
|
|
157
156
|
const peers = await this.dependencyResolver.getPreviewHostDependenciesFromEnv(context.envDefinition.env);
|
|
158
|
-
const hostRootDir =
|
|
157
|
+
const hostRootDir = context.envRuntime.envAspectDefinition?.aspectPath;
|
|
159
158
|
return Object.assign(context, {
|
|
160
159
|
entry: await (0, _getEntry().getEntry)(context, this.runtimeSlot),
|
|
161
160
|
// don't start with a leading "/" because it generates errors on Windows
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_react","_interopRequireDefault","_ink","_cliHighlight","_path","_componentServer","_dedupEnvs","_getEntry","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","DevServerService","constructor","pubsub","dependencyResolver","runtimeSlot","devServerTransformerSlot","render","env","context","descriptor","getDescriptor","createElement","Text","id","color","displayName","version","Newline","underline","highlight","config","language","ignoreIllegals","environment","getDevServer","undefined","mergedContext","buildContext","devServer","icon","displayConfig","transform","envContext","preview","getDevEnvId","runOnce","contexts","dedicatedEnvDevServers","groupedEnvs","dedupEnvs","servers","Promise","all","entries","map","contextList","mainContext","find","envDefinition","additionalContexts","filter","devServerContext","envRuntime","transformedDevServer","transformDevServer","envId","ComponentServer","mergeContext","getComponentsFromContexts","flatten","components","_context$envRuntime$e","relatedContexts","ctx","concat","peers","getPreviewHostDependenciesFromEnv","hostRootDir","envAspectDefinition","aspectPath","assign","entry","getEntry","rootPath","publicPath","sep","hostDependencies","aliasHostDependencies","values","reduce","updatedDevServer","transformFn","exports"],"sources":["dev-server.service.tsx"],"sourcesContent":["import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { PubsubMain } from '@teambit/pubsub';\nimport { flatten } from 'lodash';\nimport React from 'react';\nimport { Text, Newline } from 'ink';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport highlight from 'cli-highlight';\nimport { sep } from 'path';\nimport { BrowserRuntimeSlot, DevServerTransformerSlot } from './bundler.main.runtime';\nimport { ComponentServer } from './component-server';\nimport { dedupEnvs } from './dedup-envs';\nimport { DevServer } from './dev-server';\nimport { DevServerContext } from './dev-server-context';\nimport { getEntry } from './get-entry';\n\nexport type DevServerServiceOptions = { dedicatedEnvDevServers?: string[] };\n\ntype DevServiceTransformationMap = ServiceTransformationMap & {\n /**\n * Required for `bit start`\n */\n getDevEnvId?: (context?: any) => string;\n\n /**\n * Returns and configures the dev server\n * Required for `bit start`\n */\n getDevServer?: (context: DevServerContext) => DevServer | Promise<DevServer>;\n};\n\nexport type DevServerDescriptor = {\n /**\n * id of the dev server (e.g. webpack)\n */\n id: string;\n\n /**\n * display name of the dev server (e.g. Webpack dev server)\n */\n displayName: string;\n\n /**\n * icon of the configured dev server.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class DevServerService implements EnvService<ComponentServer, DevServerDescriptor> {\n name = 'dev server';\n\n constructor(\n private pubsub: PubsubMain,\n\n private dependencyResolver: DependencyResolverMain,\n\n /**\n * browser runtime slot\n */\n private runtimeSlot: BrowserRuntimeSlot,\n\n private devServerTransformerSlot: DevServerTransformerSlot\n ) {}\n\n async render(env: EnvDefinition, context: ExecutionContext[]) {\n const descriptor = await this.getDescriptor(env, context);\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured dev server: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text underline color=\"cyan\">\n dev server config:\n </Text>\n <Newline />\n <Text>\n {/* refactor a separate component which highlights for cli */}\n {highlight(descriptor?.config || '', { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n async getDescriptor(\n environment: EnvDefinition,\n context?: ExecutionContext[]\n ): Promise<DevServerDescriptor | undefined> {\n if (!environment.env.getDevServer || !context) return undefined;\n const mergedContext = await this.buildContext(context[0], []);\n const devServer: DevServer = environment.env.getDevServer(mergedContext);\n\n return {\n id: devServer.id || '',\n displayName: devServer.displayName || '',\n icon: devServer.icon || '',\n config: devServer.displayConfig ? devServer.displayConfig() : '',\n version: devServer.version ? devServer.version() : '?',\n };\n }\n\n transform(env: Env, envContext: EnvContext): DevServiceTransformationMap | undefined {\n // Old env\n if (!env?.preview) return undefined;\n const preview = env.preview()(envContext);\n\n return {\n getDevEnvId: () => {\n return preview.getDevEnvId();\n },\n getDevServer: (context) => {\n return preview.getDevServer(context)(envContext);\n },\n };\n }\n\n // async run(context: ExecutionContext): Promise<ComponentServer[]> {\n // const devServerContext = await this.buildContext(context);\n // const devServer: DevServer = context.env.getDevServer(devServerContext);\n // const port = await selectPort();\n // // TODO: refactor to replace with a component server instance.\n // return new ComponentServer(this.pubsub, context, port, devServer);\n // }\n\n async runOnce(\n contexts: ExecutionContext[],\n { dedicatedEnvDevServers }: DevServerServiceOptions\n ): Promise<ComponentServer[]> {\n const groupedEnvs = await dedupEnvs(contexts, this.dependencyResolver, dedicatedEnvDevServers);\n\n const servers = await Promise.all(\n Object.entries(groupedEnvs).map(async ([id, contextList]) => {\n const mainContext = contextList.find((context) => context.envDefinition.id === id) || contextList[0];\n const additionalContexts = contextList.filter((context) => context.envDefinition.id !== id);\n\n const devServerContext = await this.buildContext(mainContext, additionalContexts);\n const devServer: DevServer = await devServerContext.envRuntime.env.getDevServer(devServerContext);\n const transformedDevServer: DevServer = this.transformDevServer(devServer, { envId: id });\n\n return new ComponentServer(this.pubsub, devServerContext, [3300, 3400], transformedDevServer);\n })\n );\n\n return servers;\n }\n\n mergeContext() {}\n\n private getComponentsFromContexts(contexts: ExecutionContext[]) {\n return flatten(\n contexts.map((context) => {\n return context.components;\n })\n );\n }\n\n /**\n * builds the execution context for the dev server.\n */\n private async buildContext(\n context: ExecutionContext,\n additionalContexts: ExecutionContext[] = []\n ): Promise<DevServerContext> {\n context.relatedContexts = additionalContexts.map((ctx) => ctx.envDefinition.id);\n context.components = context.components.concat(this.getComponentsFromContexts(additionalContexts));\n const peers = await this.dependencyResolver.getPreviewHostDependenciesFromEnv(context.envDefinition.env);\n const hostRootDir = context.envRuntime.envAspectDefinition?.aspectPath;\n\n return Object.assign(context, {\n entry: await getEntry(context, this.runtimeSlot),\n // don't start with a leading \"/\" because it generates errors on Windows\n rootPath: `preview/${context.envRuntime.id}`,\n publicPath: `${sep}public`,\n hostRootDir,\n hostDependencies: peers,\n aliasHostDependencies: true,\n });\n }\n\n private transformDevServer(devServer: DevServer, { envId }: { envId: string }): DevServer {\n return this.devServerTransformerSlot\n .values()\n .reduce((updatedDevServer, transformFn) => transformFn(updatedDevServer, { envId }), devServer);\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,iBAAA;EAAA,MAAAP,IAAA,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qB,EAAE;IACzB,CAAC,CAAC;EACJ;EAEQvB,kBAAkBA,CAAC1B,SAAoB,EAAE;IAAE2B;EAAyB,CAAC,EAAa;IACxF,OAAO,IAAI,CAAClD,wBAAwB,CACjCyE,MAAM,CAAC,CAAC,CACRC,MAAM,CAAC,CAACC,gBAAgB,EAAEC,WAAW,KAAKA,WAAW,CAACD,gBAAgB,EAAE;MAAEzB;IAAM,CAAC,CAAC,EAAE3B,SAAS,CAAC;EACnG;AACF;AAACsD,OAAA,CAAAlF,gBAAA,GAAAA,gBAAA"}
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_react","_interopRequireDefault","_ink","_cliHighlight","_path","_componentServer","_dedupEnvs","_getEntry","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","DevServerService","constructor","pubsub","dependencyResolver","runtimeSlot","devServerTransformerSlot","render","env","context","descriptor","getDescriptor","createElement","Text","id","color","displayName","version","Newline","underline","highlight","config","language","ignoreIllegals","environment","getDevServer","undefined","mergedContext","buildContext","devServer","icon","displayConfig","transform","envContext","preview","getDevEnvId","runOnce","contexts","dedicatedEnvDevServers","groupedEnvs","dedupEnvs","servers","Promise","all","entries","map","contextList","mainContext","find","envDefinition","additionalContexts","filter","devServerContext","envRuntime","transformedDevServer","transformDevServer","envId","ComponentServer","mergeContext","getComponentsFromContexts","flatten","components","relatedContexts","ctx","concat","peers","getPreviewHostDependenciesFromEnv","hostRootDir","envAspectDefinition","aspectPath","assign","entry","getEntry","rootPath","publicPath","sep","hostDependencies","aliasHostDependencies","values","reduce","updatedDevServer","transformFn","exports"],"sources":["dev-server.service.tsx"],"sourcesContent":["import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { PubsubMain } from '@teambit/pubsub';\nimport { flatten } from 'lodash';\nimport React from 'react';\nimport { Text, Newline } from 'ink';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport highlight from 'cli-highlight';\nimport { sep } from 'path';\nimport { BrowserRuntimeSlot, DevServerTransformerSlot } from './bundler.main.runtime';\nimport { ComponentServer } from './component-server';\nimport { dedupEnvs } from './dedup-envs';\nimport { DevServer } from './dev-server';\nimport { DevServerContext } from './dev-server-context';\nimport { getEntry } from './get-entry';\n\nexport type DevServerServiceOptions = { dedicatedEnvDevServers?: string[] };\n\ntype DevServiceTransformationMap = ServiceTransformationMap & {\n /**\n * Required for `bit start`\n */\n getDevEnvId?: (context?: any) => string;\n\n /**\n * Returns and configures the dev server\n * Required for `bit start`\n */\n getDevServer?: (context: DevServerContext) => DevServer | Promise<DevServer>;\n};\n\nexport type DevServerDescriptor = {\n /**\n * id of the dev server (e.g. webpack)\n */\n id: string;\n\n /**\n * display name of the dev server (e.g. Webpack dev server)\n */\n displayName: string;\n\n /**\n * icon of the configured dev server.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class DevServerService implements EnvService<ComponentServer, DevServerDescriptor> {\n name = 'dev server';\n\n constructor(\n private pubsub: PubsubMain,\n\n private dependencyResolver: DependencyResolverMain,\n\n /**\n * browser runtime slot\n */\n private runtimeSlot: BrowserRuntimeSlot,\n\n private devServerTransformerSlot: DevServerTransformerSlot\n ) {}\n\n async render(env: EnvDefinition, context: ExecutionContext[]) {\n const descriptor = await this.getDescriptor(env, context);\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured dev server: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text underline color=\"cyan\">\n dev server config:\n </Text>\n <Newline />\n <Text>\n {/* refactor a separate component which highlights for cli */}\n {highlight(descriptor?.config || '', { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n async getDescriptor(\n environment: EnvDefinition,\n context?: ExecutionContext[]\n ): Promise<DevServerDescriptor | undefined> {\n if (!environment.env.getDevServer || !context) return undefined;\n const mergedContext = await this.buildContext(context[0], []);\n const devServer: DevServer = environment.env.getDevServer(mergedContext);\n\n return {\n id: devServer.id || '',\n displayName: devServer.displayName || '',\n icon: devServer.icon || '',\n config: devServer.displayConfig ? devServer.displayConfig() : '',\n version: devServer.version ? devServer.version() : '?',\n };\n }\n\n transform(env: Env, envContext: EnvContext): DevServiceTransformationMap | undefined {\n // Old env\n if (!env?.preview) return undefined;\n const preview = env.preview()(envContext);\n\n return {\n getDevEnvId: () => {\n return preview.getDevEnvId();\n },\n getDevServer: (context) => {\n return preview.getDevServer(context)(envContext);\n },\n };\n }\n\n // async run(context: ExecutionContext): Promise<ComponentServer[]> {\n // const devServerContext = await this.buildContext(context);\n // const devServer: DevServer = context.env.getDevServer(devServerContext);\n // const port = await selectPort();\n // // TODO: refactor to replace with a component server instance.\n // return new ComponentServer(this.pubsub, context, port, devServer);\n // }\n\n async runOnce(\n contexts: ExecutionContext[],\n { dedicatedEnvDevServers }: DevServerServiceOptions\n ): Promise<ComponentServer[]> {\n const groupedEnvs = await dedupEnvs(contexts, this.dependencyResolver, dedicatedEnvDevServers);\n\n const servers = await Promise.all(\n Object.entries(groupedEnvs).map(async ([id, contextList]) => {\n const mainContext = contextList.find((context) => context.envDefinition.id === id) || contextList[0];\n const additionalContexts = contextList.filter((context) => context.envDefinition.id !== id);\n\n const devServerContext = await this.buildContext(mainContext, additionalContexts);\n const devServer: DevServer = await devServerContext.envRuntime.env.getDevServer(devServerContext);\n const transformedDevServer: DevServer = this.transformDevServer(devServer, { envId: id });\n\n return new ComponentServer(this.pubsub, devServerContext, [3300, 3400], transformedDevServer);\n })\n );\n\n return servers;\n }\n\n mergeContext() {}\n\n private getComponentsFromContexts(contexts: ExecutionContext[]) {\n return flatten(\n contexts.map((context) => {\n return context.components;\n })\n );\n }\n\n /**\n * builds the execution context for the dev server.\n */\n private async buildContext(\n context: ExecutionContext,\n additionalContexts: ExecutionContext[] = []\n ): Promise<DevServerContext> {\n context.relatedContexts = additionalContexts.map((ctx) => ctx.envDefinition.id);\n context.components = context.components.concat(this.getComponentsFromContexts(additionalContexts));\n const peers = await this.dependencyResolver.getPreviewHostDependenciesFromEnv(context.envDefinition.env);\n const hostRootDir = context.envRuntime.envAspectDefinition?.aspectPath;\n\n return Object.assign(context, {\n entry: await getEntry(context, this.runtimeSlot),\n // don't start with a leading \"/\" because it generates errors on Windows\n rootPath: `preview/${context.envRuntime.id}`,\n publicPath: `${sep}public`,\n hostRootDir,\n hostDependencies: peers,\n aliasHostDependencies: true,\n });\n }\n\n private transformDevServer(devServer: DevServer, { envId }: { envId: string }): DevServer {\n return this.devServerTransformerSlot\n .values()\n .reduce((updatedDevServer, transformFn) => transformFn(updatedDevServer, { envId }), devServer);\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,iBAAA;EAAA,MAAAP,IAAA,GAAAC,OA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M,CAAC,CAAC,EAAE3B,SAAS,CAAC;EACnG;AACF;AAACqD,OAAA,CAAAjF,gBAAA,GAAAA,gBAAA"}
|
package/dist/get-entry.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ExecutionContext } from '@teambit/envs';
|
|
|
3
3
|
import { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';
|
|
4
4
|
import { PathOsBased } from '@teambit/legacy/dist/utils/path';
|
|
5
5
|
import { BrowserRuntimeSlot } from './bundler.main.runtime';
|
|
6
|
-
export
|
|
6
|
+
export type ComponentDir = {
|
|
7
7
|
componentDir?: (componentId: ComponentID, bitMapOptions?: GetBitMapComponentOptions, options?: {
|
|
8
8
|
relative: boolean;
|
|
9
9
|
}) => PathOsBased | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@1.0.109/dist/bundler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@1.0.109/dist/bundler.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,43 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/bundler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/compilation/bundler",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "bundler",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.109"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"cli-highlight": "2.1.9",
|
|
13
|
-
"ink": "3.2.0",
|
|
14
13
|
"lodash": "4.17.21",
|
|
15
|
-
"
|
|
16
|
-
"@babel/runtime": "7.20.0",
|
|
14
|
+
"ink": "3.2.0",
|
|
17
15
|
"@teambit/harmony": "0.4.6",
|
|
18
|
-
"@teambit/envs": "1.0.
|
|
19
|
-
"@teambit/builder": "1.0.
|
|
20
|
-
"@teambit/component": "1.0.
|
|
21
|
-
"@teambit/cli": "0.0.
|
|
22
|
-
"@teambit/dependency-resolver": "1.0.
|
|
23
|
-
"@teambit/graphql": "1.0.
|
|
24
|
-
"@teambit/pubsub": "1.0.
|
|
16
|
+
"@teambit/envs": "1.0.109",
|
|
17
|
+
"@teambit/builder": "1.0.109",
|
|
18
|
+
"@teambit/component": "1.0.109",
|
|
19
|
+
"@teambit/cli": "0.0.841",
|
|
20
|
+
"@teambit/dependency-resolver": "1.0.109",
|
|
21
|
+
"@teambit/graphql": "1.0.109",
|
|
22
|
+
"@teambit/pubsub": "1.0.109",
|
|
25
23
|
"@teambit/toolbox.network.get-port": "1.0.4"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
|
-
"@types/react": "^17.0.8",
|
|
29
26
|
"@types/lodash": "4.14.165",
|
|
30
27
|
"@types/mocha": "9.1.0",
|
|
31
|
-
"@types/
|
|
32
|
-
"@types/
|
|
33
|
-
"@
|
|
34
|
-
"@types/testing-library__jest-dom": "5.9.5"
|
|
28
|
+
"@types/jest": "^29.2.2",
|
|
29
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
30
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.14"
|
|
35
31
|
},
|
|
36
32
|
"peerDependencies": {
|
|
37
33
|
"@apollo/client": "^3.6.0",
|
|
38
|
-
"
|
|
39
|
-
"react": "^
|
|
40
|
-
"
|
|
34
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
35
|
+
"@types/react": "^18.2.12",
|
|
36
|
+
"@teambit/legacy": "1.0.624"
|
|
41
37
|
},
|
|
42
38
|
"license": "Apache-2.0",
|
|
43
39
|
"optionalDependencies": {},
|
|
@@ -51,7 +47,7 @@
|
|
|
51
47
|
},
|
|
52
48
|
"private": false,
|
|
53
49
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
50
|
+
"node": ">=16.0.0"
|
|
55
51
|
},
|
|
56
52
|
"repository": {
|
|
57
53
|
"type": "git",
|
|
@@ -60,12 +56,9 @@
|
|
|
60
56
|
"keywords": [
|
|
61
57
|
"bit",
|
|
62
58
|
"bit-aspect",
|
|
59
|
+
"bit-core-aspect",
|
|
63
60
|
"components",
|
|
64
61
|
"collaboration",
|
|
65
|
-
"web"
|
|
66
|
-
"react",
|
|
67
|
-
"react-components",
|
|
68
|
-
"angular",
|
|
69
|
-
"angular-components"
|
|
62
|
+
"web"
|
|
70
63
|
]
|
|
71
64
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|