@teambit/bundler 0.0.625 → 0.0.631
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/__preview-1643039669895.js +1 -0
- package/dist/bundler-context.d.ts +156 -0
- package/dist/bundler-context.js +3 -0
- package/dist/bundler-context.js.map +1 -0
- package/dist/bundler.d.ts +43 -0
- package/dist/bundler.main.runtime.d.ts +1 -1
- package/dist/bundler.main.runtime.js.map +1 -1
- package/dist/dev-server-context.d.ts +0 -21
- package/dist/index.d.ts +3 -2
- package/dist/index.js +69 -3
- package/dist/index.js.map +1 -1
- package/package-tar/teambit-bundler-0.0.631.tgz +0 -0
- package/package.json +10 -10
- package/package-tar/teambit-bundler-0.0.625.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Component } from '@teambit/component';
|
|
2
|
+
import { BuildContext } from '@teambit/builder';
|
|
3
|
+
export declare type LibraryOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Specify a name for the library
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Configure how the library will be exposed
|
|
10
|
+
* could be values like: 'umd', 'umd2', 'amd', 'commonjs',
|
|
11
|
+
*/
|
|
12
|
+
type?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type Entry = {
|
|
15
|
+
/**
|
|
16
|
+
* Specifies the name of each output file on disk
|
|
17
|
+
*/
|
|
18
|
+
filename: string;
|
|
19
|
+
/**
|
|
20
|
+
* Module(s) that are loaded upon startup
|
|
21
|
+
*/
|
|
22
|
+
import: string | string[];
|
|
23
|
+
/**
|
|
24
|
+
* Specify library options to bundle a library from current entry
|
|
25
|
+
*/
|
|
26
|
+
library?: LibraryOptions;
|
|
27
|
+
};
|
|
28
|
+
export declare type EntryMap = {
|
|
29
|
+
[entryName: string]: Entry;
|
|
30
|
+
};
|
|
31
|
+
export declare type Target = {
|
|
32
|
+
/**
|
|
33
|
+
* entries of the target.
|
|
34
|
+
*/
|
|
35
|
+
entries: string[] | EntryMap;
|
|
36
|
+
/**
|
|
37
|
+
* array of components included in the target.
|
|
38
|
+
*/
|
|
39
|
+
components: Component[];
|
|
40
|
+
/**
|
|
41
|
+
* output path of the target
|
|
42
|
+
*/
|
|
43
|
+
outputPath: string;
|
|
44
|
+
/**
|
|
45
|
+
* This option determines the name of each output bundle
|
|
46
|
+
*/
|
|
47
|
+
filename?: string;
|
|
48
|
+
/**
|
|
49
|
+
* This option determines the name of non-initial chunk files
|
|
50
|
+
*/
|
|
51
|
+
chunkFilename?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Make the peer dependencies externals.
|
|
54
|
+
*/
|
|
55
|
+
externalizePeer?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* List of peer dependencies
|
|
58
|
+
*/
|
|
59
|
+
peers?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* config for html generation
|
|
62
|
+
*/
|
|
63
|
+
html?: HtmlConfig[];
|
|
64
|
+
/**
|
|
65
|
+
* module targets to expose.
|
|
66
|
+
*/
|
|
67
|
+
modules?: ModuleTarget[];
|
|
68
|
+
/**
|
|
69
|
+
* Name for the runtime chunk
|
|
70
|
+
*/
|
|
71
|
+
runtimeChunkName?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Different configuration related to chunking
|
|
74
|
+
*/
|
|
75
|
+
chunking?: Chunking;
|
|
76
|
+
};
|
|
77
|
+
export declare type ModuleTarget = {
|
|
78
|
+
/**
|
|
79
|
+
* name of the module.
|
|
80
|
+
*/
|
|
81
|
+
name: string;
|
|
82
|
+
/**
|
|
83
|
+
* module exposes.
|
|
84
|
+
*/
|
|
85
|
+
exposes: {
|
|
86
|
+
[internalPath: string]: string;
|
|
87
|
+
};
|
|
88
|
+
shared: {
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export declare type HtmlConfig = {
|
|
93
|
+
/**
|
|
94
|
+
* The title to use for the generated HTML document
|
|
95
|
+
*/
|
|
96
|
+
title: string;
|
|
97
|
+
/**
|
|
98
|
+
* The file to write the HTML to. Defaults to index.html
|
|
99
|
+
*/
|
|
100
|
+
filename?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Allows you to add only some chunks (e.g only the unit-test chunk)
|
|
103
|
+
*/
|
|
104
|
+
chunks?: string[];
|
|
105
|
+
/**
|
|
106
|
+
* provide an inline template
|
|
107
|
+
*/
|
|
108
|
+
templateContent: string;
|
|
109
|
+
/**
|
|
110
|
+
* Controls if and in what ways the output should be minified
|
|
111
|
+
*/
|
|
112
|
+
minify?: boolean;
|
|
113
|
+
};
|
|
114
|
+
export declare type Chunking = {
|
|
115
|
+
/**
|
|
116
|
+
* include all types of chunks (async / non-async) in splitting
|
|
117
|
+
*/
|
|
118
|
+
splitChunks: boolean;
|
|
119
|
+
};
|
|
120
|
+
export interface BundlerContext extends BuildContext {
|
|
121
|
+
/**
|
|
122
|
+
* targets for bundling.
|
|
123
|
+
*/
|
|
124
|
+
targets: Target[];
|
|
125
|
+
/**
|
|
126
|
+
* determines whether it is a production build, default is `true`.
|
|
127
|
+
* in development, expect the bundler to favour debugging on the expanse of optimization.
|
|
128
|
+
*/
|
|
129
|
+
development?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* public path output of the bundle.
|
|
132
|
+
*/
|
|
133
|
+
publicPath?: string;
|
|
134
|
+
/**
|
|
135
|
+
* root path
|
|
136
|
+
*/
|
|
137
|
+
rootPath?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Make the peer dependencies externals for all targets
|
|
140
|
+
*/
|
|
141
|
+
externalizePeer?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* config for html generation for all targets
|
|
144
|
+
*/
|
|
145
|
+
html?: HtmlConfig[];
|
|
146
|
+
/**
|
|
147
|
+
* modules for bundle to expose. used by module federation at webpack, or with different methods applied by various bundlers.
|
|
148
|
+
*/
|
|
149
|
+
modules?: {
|
|
150
|
+
name: string;
|
|
151
|
+
fileName: string;
|
|
152
|
+
exposes: {
|
|
153
|
+
[key: string]: string;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
package/dist/bundler.d.ts
CHANGED
|
@@ -2,9 +2,52 @@ import { Component } from '@teambit/component';
|
|
|
2
2
|
export interface DevServer {
|
|
3
3
|
start(): void;
|
|
4
4
|
}
|
|
5
|
+
export declare type Asset = {
|
|
6
|
+
/**
|
|
7
|
+
* name of the asset.
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* size of the asset in bytes.
|
|
12
|
+
*/
|
|
13
|
+
size: number;
|
|
14
|
+
};
|
|
15
|
+
export declare type ChunksAssetsMap = {
|
|
16
|
+
[assetName: string]: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare type EntryAssets = {
|
|
19
|
+
assets: Asset[];
|
|
20
|
+
auxiliaryAssets: Asset[];
|
|
21
|
+
assetsSize: number;
|
|
22
|
+
auxiliaryAssetsSize: number;
|
|
23
|
+
};
|
|
24
|
+
export declare type EntriesAssetsMap = {
|
|
25
|
+
[entryId: string]: EntryAssets;
|
|
26
|
+
};
|
|
5
27
|
export declare type BundlerResult = {
|
|
28
|
+
/**
|
|
29
|
+
* list of generated assets.
|
|
30
|
+
*/
|
|
31
|
+
assets: Asset[];
|
|
32
|
+
/**
|
|
33
|
+
* A map of assets names for each chunk
|
|
34
|
+
*/
|
|
35
|
+
assetsByChunkName?: ChunksAssetsMap;
|
|
36
|
+
/**
|
|
37
|
+
* A map of assets for each entry point
|
|
38
|
+
*/
|
|
39
|
+
entriesAssetsMap?: EntriesAssetsMap;
|
|
40
|
+
/**
|
|
41
|
+
* errors thrown during the bundling process.
|
|
42
|
+
*/
|
|
6
43
|
errors: Error[];
|
|
44
|
+
/**
|
|
45
|
+
* warnings thrown during the bundling process.
|
|
46
|
+
*/
|
|
7
47
|
warnings: string[];
|
|
48
|
+
/**
|
|
49
|
+
* components included in the bundling process.
|
|
50
|
+
*/
|
|
8
51
|
components: Component[];
|
|
9
52
|
/**
|
|
10
53
|
* timestamp in milliseconds when the task started
|
|
@@ -5,7 +5,7 @@ import { GraphqlMain } from '@teambit/graphql';
|
|
|
5
5
|
import { SlotRegistry } from '@teambit/harmony';
|
|
6
6
|
import { BrowserRuntime } from './browser-runtime';
|
|
7
7
|
import { ComponentServer } from './component-server';
|
|
8
|
-
import { BundlerContext } from './
|
|
8
|
+
import { BundlerContext } from './bundler-context';
|
|
9
9
|
import { DevServerService } from './dev-server.service';
|
|
10
10
|
export declare type BrowserRuntimeSlot = SlotRegistry<BrowserRuntime>;
|
|
11
11
|
export declare type BundlerConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["bundler.main.runtime.ts"],"names":["BundlerMain","constructor","config","pubsub","envs","devService","runtimeSlot","devServer","components","envRuntime","createEnvironment","servers","runOnce","dedicatedEnvDevServers","_componentServers","indexByComponent","getComponentServer","component","undefined","envId","getEnvId","server","find","componentServer","context","relatedContexts","includes","id","computeEntries","slotEntries","Promise","all","values","map","browserRuntime","entry","slotPaths","reduce","acc","current","concat","registerTarget","runtime","register","provider","graphql","devServerService","DevServerService","bundler","registerService","Slot","withType","MainRuntime","PubsubAspect","EnvsAspect","GraphqlAspect","ComponentAspect","BundlerAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AA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CAACF,QAAR,CAAiB,kCAAgBK,OAAhB,CAAjB;AAEA,WAAOA,OAAP;AACD;;AAhHsB;;;gCAAZhD,W,WA2FI,CAACkD,gBAAKC,QAAL,EAAD,C;gCA3FJnD,W,aA6FMoD,kB;gCA7FNpD,W,kBA8FW,CAACqD,iBAAD,EAAeC,kBAAf,EAA2BC,wBAA3B,EAA0CC,4BAA1C,C;gCA9FXxD,W,mBAgGY;AACrBa,EAAAA,sBAAsB,EAAE;AADH,C;;AAmBzB4C,yBAAcC,UAAd,CAAyB1D,WAAzB","sourcesContent":["import PubsubAspect, { PubsubMain } from '@teambit/pubsub';\nimport { MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { BrowserRuntime } from './browser-runtime';\nimport { BundlerAspect } from './bundler.aspect';\nimport { ComponentServer } from './component-server';\nimport { BundlerContext } from './
|
|
1
|
+
{"version":3,"sources":["bundler.main.runtime.ts"],"names":["BundlerMain","constructor","config","pubsub","envs","devService","runtimeSlot","devServer","components","envRuntime","createEnvironment","servers","runOnce","dedicatedEnvDevServers","_componentServers","indexByComponent","getComponentServer","component","undefined","envId","getEnvId","server","find","componentServer","context","relatedContexts","includes","id","computeEntries","slotEntries","Promise","all","values","map","browserRuntime","entry","slotPaths","reduce","acc","current","concat","registerTarget","runtime","register","provider","graphql","devServerService","DevServerService","bundler","registerService","Slot","withType","MainRuntime","PubsubAspect","EnvsAspect","GraphqlAspect","ComponentAspect","BundlerAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;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gCC,IAAhC,EAAsC0C,gBAAtC,EAAwDxC,WAAxD,CAAhB;AACAF,IAAAA,IAAI,CAAC6C,eAAL,CAAqBH,gBAArB;AAEAD,IAAAA,OAAO,CAACF,QAAR,CAAiB,kCAAgBK,OAAhB,CAAjB;AAEA,WAAOA,OAAP;AACD;;AAhHsB;;;gCAAZhD,W,WA2FI,CAACkD,gBAAKC,QAAL,EAAD,C;gCA3FJnD,W,aA6FMoD,kB;gCA7FNpD,W,kBA8FW,CAACqD,iBAAD,EAAeC,kBAAf,EAA2BC,wBAA3B,EAA0CC,4BAA1C,C;gCA9FXxD,W,mBAgGY;AACrBa,EAAAA,sBAAsB,EAAE;AADH,C;;AAmBzB4C,yBAAcC,UAAd,CAAyB1D,WAAzB","sourcesContent":["import PubsubAspect, { PubsubMain } from '@teambit/pubsub';\nimport { MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { BrowserRuntime } from './browser-runtime';\nimport { BundlerAspect } from './bundler.aspect';\nimport { ComponentServer } from './component-server';\nimport { BundlerContext } from './bundler-context';\nimport { devServerSchema } from './dev-server.graphql';\nimport { DevServerService } from './dev-server.service';\n\nexport type BrowserRuntimeSlot = SlotRegistry<BrowserRuntime>;\n\nexport type BundlerConfig = {\n dedicatedEnvDevServers: string[];\n};\n\n/**\n * bundler extension.\n */\nexport class BundlerMain {\n constructor(\n readonly config: BundlerConfig,\n /**\n * Pubsub extension.\n */\n private pubsub: PubsubMain,\n\n /**\n * environments extension.\n */\n private envs: EnvsMain,\n\n /**\n * dev server service.\n */\n private devService: DevServerService,\n\n /**\n * browser runtime slot.\n */\n private runtimeSlot: BrowserRuntimeSlot\n ) {}\n\n /**\n * load all given components in corresponding dev servers.\n * @param components defaults to all components in the workspace.\n */\n async devServer(components: Component[]): Promise<ComponentServer[]> {\n const envRuntime = await this.envs.createEnvironment(components);\n // TODO: this must be refactored away from here. this logic should be in the Preview.\n const servers: ComponentServer[] = await envRuntime.runOnce<ComponentServer[]>(this.devService, {\n dedicatedEnvDevServers: this.config.dedicatedEnvDevServers,\n });\n this._componentServers = servers;\n\n this.indexByComponent();\n\n return this._componentServers;\n }\n\n /**\n * get a dev server instance containing a component.\n * @param component\n */\n getComponentServer(component: Component): undefined | ComponentServer {\n if (!this._componentServers) return undefined;\n const envId = this.envs.getEnvId(component);\n const server = this._componentServers.find(\n (componentServer) =>\n componentServer.context.relatedContexts.includes(envId) || componentServer.context.id === envId\n );\n\n return server;\n }\n\n /**\n * compute entry files for bundling components in a given execution context.\n */\n async computeEntries(context: BundlerContext) {\n const slotEntries = await Promise.all(\n this.runtimeSlot.values().map(async (browserRuntime) => browserRuntime.entry(context))\n );\n\n const slotPaths = slotEntries.reduce((acc, current) => {\n acc = acc.concat(current);\n return acc;\n });\n\n return slotPaths;\n }\n\n /**\n * register a new browser runtime environment.\n * @param browserRuntime\n */\n registerTarget(browserRuntime: BrowserRuntime[]) {\n browserRuntime.map((runtime) => {\n return this.runtimeSlot.register(runtime);\n });\n\n return this;\n }\n\n /**\n * component servers.\n */\n private _componentServers: null | ComponentServer[];\n\n private indexByComponent() {}\n\n static slots = [Slot.withType<BrowserRuntime>()];\n\n static runtime = MainRuntime;\n static dependencies = [PubsubAspect, EnvsAspect, GraphqlAspect, ComponentAspect];\n\n static defaultConfig = {\n dedicatedEnvDevServers: [],\n };\n\n static async provider(\n [pubsub, envs, graphql]: [PubsubMain, EnvsMain, GraphqlMain],\n config,\n [runtimeSlot]: [BrowserRuntimeSlot]\n ) {\n const devServerService = new DevServerService(pubsub, runtimeSlot);\n const bundler = new BundlerMain(config, pubsub, envs, devServerService, runtimeSlot);\n envs.registerService(devServerService);\n\n graphql.register(devServerSchema(bundler));\n\n return bundler;\n }\n}\n\nBundlerAspect.addRuntime(BundlerMain);\n"]}
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
import { Component } from '@teambit/component';
|
|
2
|
-
import { BuildContext } from '@teambit/builder';
|
|
3
1
|
import { ExecutionContext } from '@teambit/envs';
|
|
4
|
-
export declare type Target = {
|
|
5
|
-
/**
|
|
6
|
-
* entries of the target.
|
|
7
|
-
*/
|
|
8
|
-
entries: string[];
|
|
9
|
-
/**
|
|
10
|
-
* array of components included in the target.
|
|
11
|
-
*/
|
|
12
|
-
components: Component[];
|
|
13
|
-
/**
|
|
14
|
-
* output path of the target
|
|
15
|
-
*/
|
|
16
|
-
outputPath: string;
|
|
17
|
-
};
|
|
18
|
-
export interface BundlerContext extends BuildContext {
|
|
19
|
-
targets: Target[];
|
|
20
|
-
publicPath?: string;
|
|
21
|
-
rootPath?: string;
|
|
22
|
-
}
|
|
23
2
|
export interface DevServerContext extends ExecutionContext {
|
|
24
3
|
/**
|
|
25
4
|
* array of files to include.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DevServer } from './dev-server';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { DevServerContext } from './dev-server-context';
|
|
3
|
+
export { BundlerContext, Target, ModuleTarget, HtmlConfig as BundlerHtmlConfig, EntryMap as BundlerEntryMap, Entry as BundlerEntry, } from './bundler-context';
|
|
4
|
+
export { Bundler, BundlerResult, BundlerMode, Asset, ChunksAssetsMap, EntriesAssetsMap, EntryAssets } from './bundler';
|
|
4
5
|
export type { BundlerMain } from './bundler.main.runtime';
|
|
5
6
|
export { BundlerAspect } from './bundler.aspect';
|
|
6
7
|
export { ComponentDir } from './get-entry';
|
package/dist/index.js
CHANGED
|
@@ -5,16 +5,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
DevServer: true,
|
|
8
|
+
DevServerContext: true,
|
|
8
9
|
BundlerContext: true,
|
|
9
10
|
Target: true,
|
|
10
|
-
|
|
11
|
+
ModuleTarget: true,
|
|
12
|
+
BundlerHtmlConfig: true,
|
|
13
|
+
BundlerEntryMap: true,
|
|
14
|
+
BundlerEntry: true,
|
|
11
15
|
Bundler: true,
|
|
12
16
|
BundlerResult: true,
|
|
13
17
|
BundlerMode: true,
|
|
18
|
+
Asset: true,
|
|
19
|
+
ChunksAssetsMap: true,
|
|
20
|
+
EntriesAssetsMap: true,
|
|
21
|
+
EntryAssets: true,
|
|
14
22
|
BundlerAspect: true,
|
|
15
23
|
ComponentDir: true,
|
|
16
24
|
ComponentServer: true
|
|
17
25
|
};
|
|
26
|
+
Object.defineProperty(exports, "Asset", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _bundler().Asset;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
18
32
|
Object.defineProperty(exports, "Bundler", {
|
|
19
33
|
enumerable: true,
|
|
20
34
|
get: function () {
|
|
@@ -30,7 +44,25 @@ Object.defineProperty(exports, "BundlerAspect", {
|
|
|
30
44
|
Object.defineProperty(exports, "BundlerContext", {
|
|
31
45
|
enumerable: true,
|
|
32
46
|
get: function () {
|
|
33
|
-
return
|
|
47
|
+
return _bundlerContext().BundlerContext;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "BundlerEntry", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return _bundlerContext().Entry;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "BundlerEntryMap", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return _bundlerContext().EntryMap;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "BundlerHtmlConfig", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () {
|
|
65
|
+
return _bundlerContext().HtmlConfig;
|
|
34
66
|
}
|
|
35
67
|
});
|
|
36
68
|
Object.defineProperty(exports, "BundlerMode", {
|
|
@@ -45,6 +77,12 @@ Object.defineProperty(exports, "BundlerResult", {
|
|
|
45
77
|
return _bundler().BundlerResult;
|
|
46
78
|
}
|
|
47
79
|
});
|
|
80
|
+
Object.defineProperty(exports, "ChunksAssetsMap", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () {
|
|
83
|
+
return _bundler().ChunksAssetsMap;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
48
86
|
Object.defineProperty(exports, "ComponentDir", {
|
|
49
87
|
enumerable: true,
|
|
50
88
|
get: function () {
|
|
@@ -69,10 +107,28 @@ Object.defineProperty(exports, "DevServerContext", {
|
|
|
69
107
|
return _devServerContext().DevServerContext;
|
|
70
108
|
}
|
|
71
109
|
});
|
|
110
|
+
Object.defineProperty(exports, "EntriesAssetsMap", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function () {
|
|
113
|
+
return _bundler().EntriesAssetsMap;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "EntryAssets", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _bundler().EntryAssets;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "ModuleTarget", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function () {
|
|
125
|
+
return _bundlerContext().ModuleTarget;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
72
128
|
Object.defineProperty(exports, "Target", {
|
|
73
129
|
enumerable: true,
|
|
74
130
|
get: function () {
|
|
75
|
-
return
|
|
131
|
+
return _bundlerContext().Target;
|
|
76
132
|
}
|
|
77
133
|
});
|
|
78
134
|
|
|
@@ -96,6 +152,16 @@ function _devServerContext() {
|
|
|
96
152
|
return data;
|
|
97
153
|
}
|
|
98
154
|
|
|
155
|
+
function _bundlerContext() {
|
|
156
|
+
const data = require("./bundler-context");
|
|
157
|
+
|
|
158
|
+
_bundlerContext = function () {
|
|
159
|
+
return data;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return data;
|
|
163
|
+
}
|
|
164
|
+
|
|
99
165
|
function _bundler() {
|
|
100
166
|
const data = require("./bundler");
|
|
101
167
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { DevServer } from './dev-server';\nexport { DevServerContext } from './dev-server-context';\nexport {\n BundlerContext,\n Target,\n ModuleTarget,\n HtmlConfig as BundlerHtmlConfig,\n EntryMap as BundlerEntryMap,\n Entry as BundlerEntry,\n} from './bundler-context';\nexport { Bundler, BundlerResult, BundlerMode, Asset, ChunksAssetsMap, EntriesAssetsMap, EntryAssets } from './bundler';\nexport type { BundlerMain } from './bundler.main.runtime';\nexport { BundlerAspect } from './bundler.aspect';\nexport { ComponentDir } from './get-entry';\nexport { ComponentServer } from './component-server';\nexport * from './events';\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/bundler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.631",
|
|
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.
|
|
9
|
+
"version": "0.0.631"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/harmony": "0.2.11",
|
|
@@ -15,12 +15,12 @@
|
|
|
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.
|
|
19
|
-
"@teambit/
|
|
20
|
-
"@teambit/component": "0.0.
|
|
21
|
-
"@teambit/
|
|
22
|
-
"@teambit/
|
|
23
|
-
"@teambit/
|
|
18
|
+
"@teambit/envs": "0.0.631",
|
|
19
|
+
"@teambit/builder": "0.0.631",
|
|
20
|
+
"@teambit/component": "0.0.631",
|
|
21
|
+
"@teambit/cli": "0.0.433",
|
|
22
|
+
"@teambit/graphql": "0.0.631",
|
|
23
|
+
"@teambit/pubsub": "0.0.631",
|
|
24
24
|
"@teambit/toolbox.network.get-port": "0.0.112"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@apollo/client": "^3.0.0",
|
|
37
|
-
"@teambit/legacy": "1.0.
|
|
37
|
+
"@teambit/legacy": "1.0.209",
|
|
38
38
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
39
39
|
"react": "^16.8.0 || ^17.0.0"
|
|
40
40
|
},
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"react": "-"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@teambit/legacy": "1.0.
|
|
65
|
+
"@teambit/legacy": "1.0.209",
|
|
66
66
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
67
67
|
"react": "^16.8.0 || ^17.0.0"
|
|
68
68
|
}
|
|
Binary file
|