@teambit/webpack 1.0.227 → 1.0.229

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.
@@ -0,0 +1,2 @@
1
+ /** html template for Previews (docs, compositions, etc) */
2
+ export declare function html(title: string): () => string;
@@ -0,0 +1,4 @@
1
+ export declare const fallbacksAliases: {
2
+ process: string;
3
+ buffer: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare const fallbacksProvidePluginConfig: {
2
+ process: string;
3
+ Buffer: string[];
4
+ };
@@ -0,0 +1,27 @@
1
+ export declare const fallbacks: {
2
+ readonly assert: string;
3
+ readonly buffer: string;
4
+ readonly constants: string;
5
+ readonly crypto: string;
6
+ readonly domain: string;
7
+ readonly http: string;
8
+ readonly https: string;
9
+ readonly os: string;
10
+ readonly path: string;
11
+ readonly punycode: string;
12
+ readonly process: string;
13
+ readonly querystring: string;
14
+ readonly stream: string;
15
+ readonly string_decoder: string;
16
+ readonly sys: string;
17
+ readonly timers: string;
18
+ readonly tty: string;
19
+ readonly url: string;
20
+ readonly util: string;
21
+ readonly vm: string;
22
+ readonly zlib: string;
23
+ readonly fs: false;
24
+ readonly net: false;
25
+ readonly tls: false;
26
+ readonly child_process: false;
27
+ };
@@ -0,0 +1,3 @@
1
+ import { Configuration } from 'webpack';
2
+ import type { BundlerContext, Target } from '@teambit/bundler';
3
+ export declare function configFactory(target: Target, context: BundlerContext): Configuration;
@@ -0,0 +1,3 @@
1
+ import { PubsubMain } from '@teambit/pubsub';
2
+ import { WebpackConfigWithDevServer } from '../webpack.dev-server';
3
+ export declare function configFactory(devServerID: string, workspaceDir: string, entryFiles: string[], publicRoot: string, publicPath: string, componentPathsRegExps: RegExp[], pubsub: PubsubMain, title?: string, favicon?: string): WebpackConfigWithDevServer;
@@ -0,0 +1,2 @@
1
+ export * from './webpack-compilation-done-event';
2
+ export * from './webpack-compilation-started-event';
@@ -0,0 +1,15 @@
1
+ import type { Stats } from 'webpack';
2
+ import { BitBaseEvent } from '@teambit/pubsub';
3
+ declare class WebpackCompilationDoneEventData {
4
+ readonly stats: Stats;
5
+ readonly devServerID: string;
6
+ constructor(stats: Stats, devServerID: string);
7
+ }
8
+ export declare class WebpackCompilationDoneEvent extends BitBaseEvent<WebpackCompilationDoneEventData> {
9
+ readonly timestamp: number;
10
+ readonly stats: Stats;
11
+ readonly devServerID: string;
12
+ static readonly TYPE = "webpack-compilation-done";
13
+ constructor(timestamp: number, stats: Stats, devServerID: string);
14
+ }
15
+ export {};
@@ -0,0 +1,11 @@
1
+ import { BitBaseEvent } from '@teambit/pubsub';
2
+ type Params = {
3
+ devServerID: string;
4
+ };
5
+ export declare class WebpackCompilationStartedEvent extends BitBaseEvent<Params> {
6
+ readonly timestamp: any;
7
+ readonly params: Params;
8
+ static readonly TYPE = "webpack-compilation-started";
9
+ constructor(timestamp: any, params: Params);
10
+ }
11
+ export {};
@@ -0,0 +1,14 @@
1
+ export type { WebpackMain, WebpackConfigTransformer, WebpackConfigTransformContext, WebpackConfigDevServerTransformContext, GlobalWebpackConfigTransformContext, WebpackConfigDevServerTransformer, } from './webpack.main.runtime';
2
+ export { runTransformersWithContext } from './run-transformer';
3
+ export { WebpackAspect } from './webpack.aspect';
4
+ export { WebpackDevServer } from './webpack.dev-server';
5
+ export { WebpackBundler } from './webpack.bundler';
6
+ export type { WebpackConfigWithDevServer } from './webpack.dev-server';
7
+ export * from './events';
8
+ export type { Configuration } from 'webpack';
9
+ export { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
10
+ export { WebpackBitReporterPlugin } from './plugins/webpack-bit-reporter-plugin';
11
+ export { fallbacks } from './config/webpack-fallbacks';
12
+ export { fallbacksAliases } from './config/webpack-fallbacks-aliases';
13
+ export { fallbacksProvidePluginConfig } from './config/webpack-fallbacks-provide-plugin-config';
14
+ export { GenerateBodyInjectionTransformer, BodyInjectionOptions, generateAddAliasesFromPeersTransformer, generateExposePeersTransformer, generateExternalsTransformer, GenerateHeadInjectionTransformer, HeadInjectionOptions, } from './transformers';
@@ -0,0 +1,12 @@
1
+ import type { Compiler } from 'webpack';
2
+ /**
3
+ * Monitors Webpack's compilation, and updates progress to Bit
4
+ */
5
+ export declare class WebpackBitReporterPlugin {
6
+ pubsub: any;
7
+ devServerID: string;
8
+ constructor({ options }: {
9
+ options: any;
10
+ });
11
+ apply(compiler: Compiler | any): void;
12
+ }
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.227/dist/webpack.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.227/dist/webpack.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.229/dist/webpack.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.229/dist/webpack.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -0,0 +1,3 @@
1
+ import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
2
+ import type { WebpackConfigDevServerTransformer, WebpackConfigTransformer } from './webpack.main.runtime';
3
+ export declare function runTransformersWithContext(config: WebpackConfigMutator, transformers: (WebpackConfigTransformer | WebpackConfigDevServerTransformer)[] | undefined, context: any): WebpackConfigMutator;
@@ -0,0 +1,3 @@
1
+ import 'expose-loader';
2
+ import { Logger } from '@teambit/logger';
3
+ export declare function getExposedRules(peers: string[], logger: Logger, hostRootDir?: string): Object[];
@@ -0,0 +1 @@
1
+ export declare function getExternals(deps: string[]): Record<string, string>;
@@ -0,0 +1,3 @@
1
+ export { GenerateBodyInjectionTransformer, BodyInjectionOptions } from './inject-body';
2
+ export { GenerateHeadInjectionTransformer, HeadInjectionOptions } from './inject-head';
3
+ export { generateAddAliasesFromPeersTransformer, generateExposePeersTransformer, generateExternalsTransformer, } from './transformers';
@@ -0,0 +1,14 @@
1
+ import type { WebpackConfigTransformer } from '../webpack.main.runtime';
2
+ export type BodyInjectionOptions = {
3
+ content: string;
4
+ position?: 'start' | 'end';
5
+ };
6
+ /**
7
+ * A transformer that allow you to inject content into your html body
8
+ * We expose it from here, as it uses the inject-body-webpack-plugin which register to the html plugin hooks
9
+ * which means it depends on the fact that it has the same html plugin instance
10
+ * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
11
+ * @param options
12
+ * @returns
13
+ */
14
+ export declare function GenerateBodyInjectionTransformer(options: BodyInjectionOptions): WebpackConfigTransformer;
@@ -0,0 +1,14 @@
1
+ import type { WebpackConfigTransformer } from '../webpack.main.runtime';
2
+ export type HeadInjectionOptions = {
3
+ content: string;
4
+ position?: 'start' | 'end';
5
+ };
6
+ /**
7
+ * A transformer that allow you to inject content into your html head
8
+ * We expose it from here, as it uses the inject-head-webpack-plugin which register to the html plugin hooks
9
+ * which means it depends on the fact that it has the same html plugin instance
10
+ * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
11
+ * @param options
12
+ * @returns
13
+ */
14
+ export declare function GenerateHeadInjectionTransformer(options: HeadInjectionOptions): WebpackConfigTransformer;
@@ -0,0 +1,14 @@
1
+ import { Logger } from '@teambit/logger';
2
+ /**
3
+ * Get the package folder, and in case it's not found get the resolved file path
4
+ * @param peerName
5
+ * @returns
6
+ */
7
+ export declare function resolvePeerToDirOrFile(peerName: string, logger: Logger, hostRootDir?: string): string | undefined;
8
+ /**
9
+ * Make sure to resolve the peer path correctly
10
+ * we first resolve it to its dir (to be aligned with the aliases transformer)
11
+ * Then we resolve it to specific file, using enhanced resolve to make sure we resolve it using the correct main fields order
12
+ * @param peer
13
+ */
14
+ export declare function resolvePeerToFile(peer: string, logger: Logger, hostRootDir?: string): string | undefined;
@@ -0,0 +1,16 @@
1
+ import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
2
+ import { Logger } from '@teambit/logger';
3
+ import { WebpackConfigTransformContext } from '../webpack.main.runtime';
4
+ export declare function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger): (config: WebpackConfigMutator, context: WebpackConfigTransformContext) => WebpackConfigMutator;
5
+ /**
6
+ * Generate a transformer that expose all the peers as global via the expose loader
7
+ * @param peers
8
+ * @returns
9
+ */
10
+ export declare function generateExposePeersTransformer(peers: string[], logger: Logger): (config: WebpackConfigMutator, context: WebpackConfigTransformContext) => WebpackConfigMutator;
11
+ /**
12
+ * Generate a transformer that expose all the peers as global via the expose loader
13
+ * @param peers
14
+ * @returns
15
+ */
16
+ export declare function generateExternalsTransformer(depes: string[]): (config: WebpackConfigMutator) => WebpackConfigMutator;
@@ -0,0 +1,2 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const WebpackAspect: Aspect;
@@ -0,0 +1,31 @@
1
+ import type { Bundler, BundlerResult, Target, BundlerContextMetaData } from '@teambit/bundler';
2
+ import type { Logger } from '@teambit/logger';
3
+ import type { Configuration } from 'webpack';
4
+ export declare class WebpackBundler implements Bundler {
5
+ /**
6
+ * targets to bundle.
7
+ */
8
+ private targets;
9
+ /**
10
+ * webpack configuration.
11
+ */
12
+ private configs;
13
+ private logger;
14
+ private webpack;
15
+ private metaData?;
16
+ constructor(
17
+ /**
18
+ * targets to bundle.
19
+ */
20
+ targets: Target[],
21
+ /**
22
+ * webpack configuration.
23
+ */
24
+ configs: Configuration[], logger: Logger, webpack: any, metaData?: BundlerContextMetaData | undefined);
25
+ run(): Promise<BundlerResult[]>;
26
+ private getErrors;
27
+ private getAssets;
28
+ private getEntriesAssetsMap;
29
+ private getCompressedSize;
30
+ private getComponents;
31
+ }
@@ -0,0 +1 @@
1
+ export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,33 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="got/dist/source/core/utils/timed-out" />
3
+ import type { DevServer } from '@teambit/bundler';
4
+ import type { Server } from 'http';
5
+ import type { webpack as webpackCompiler, Configuration } from 'webpack';
6
+ import type * as WDS from 'webpack-dev-server';
7
+ export interface WebpackConfigWithDevServer extends Configuration {
8
+ devServer: WDS.Configuration;
9
+ favicon?: string;
10
+ }
11
+ export declare class WebpackDevServer implements DevServer {
12
+ private config;
13
+ private webpack;
14
+ /**
15
+ * path to the webpack-dev-server module or instance of webpack-dev-server.
16
+ * this accept getting an instance for backward compatibility.
17
+ */
18
+ private webpackDevServer;
19
+ private readonly WsDevServer;
20
+ constructor(config: WebpackConfigWithDevServer, webpack: typeof webpackCompiler,
21
+ /**
22
+ * path to the webpack-dev-server module or instance of webpack-dev-server.
23
+ * this accept getting an instance for backward compatibility.
24
+ */
25
+ webpackDevServer: string | typeof WDS);
26
+ private getCompiler;
27
+ id: string;
28
+ displayName: string;
29
+ version(): string;
30
+ displayConfig(): string;
31
+ listen(port: number): Promise<Server>;
32
+ private addSignalListener;
33
+ }
@@ -0,0 +1,76 @@
1
+ import webpack from 'webpack';
2
+ import { PubsubMain } from '@teambit/pubsub';
3
+ import { BundlerContext, BundlerMain, DevServer, DevServerContext, BundlerMode, Target } from '@teambit/bundler';
4
+ import { Logger, LoggerMain } from '@teambit/logger';
5
+ import { Workspace } from '@teambit/workspace';
6
+ import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
7
+ import { WebpackBundler } from './webpack.bundler';
8
+ export type WebpackConfigTransformContext = GlobalWebpackConfigTransformContext & {
9
+ target: Target;
10
+ };
11
+ export type WebpackConfigDevServerTransformContext = GlobalWebpackConfigTransformContext & DevServerContext;
12
+ export type GlobalWebpackConfigTransformContext = {
13
+ mode: BundlerMode;
14
+ /**
15
+ * Whether the config is for an env template bundling
16
+ */
17
+ isEnvTemplate?: boolean;
18
+ /**
19
+ * A path for the host root dir
20
+ * Host root dir is usually the env root dir
21
+ * This can be used in different bundle options which run require.resolve
22
+ * for example when configuring webpack aliases or webpack expose loader on the peers deps
23
+ */
24
+ hostRootDir?: string;
25
+ };
26
+ export type WebpackConfigTransformer = (config: WebpackConfigMutator, context: WebpackConfigTransformContext) => WebpackConfigMutator;
27
+ export type WebpackConfigDevServerTransformer = (config: WebpackConfigMutator, context: WebpackConfigDevServerTransformContext) => WebpackConfigMutator;
28
+ export declare class WebpackMain {
29
+ /**
30
+ * Pubsub extension.
31
+ */
32
+ pubsub: PubsubMain;
33
+ /**
34
+ * workspace extension.
35
+ */
36
+ private workspace;
37
+ /**
38
+ * bundler extension.
39
+ */
40
+ private bundler;
41
+ /**
42
+ * Logger extension
43
+ */
44
+ logger: Logger;
45
+ constructor(
46
+ /**
47
+ * Pubsub extension.
48
+ */
49
+ pubsub: PubsubMain,
50
+ /**
51
+ * workspace extension.
52
+ */
53
+ workspace: Workspace,
54
+ /**
55
+ * bundler extension.
56
+ */
57
+ bundler: BundlerMain,
58
+ /**
59
+ * Logger extension
60
+ */
61
+ logger: Logger);
62
+ /**
63
+ * create an instance of bit-compliant webpack dev server for a set of components
64
+ */
65
+ createDevServer(context: DevServerContext, transformers?: WebpackConfigTransformer[], webpackModulePath?: string, webpackDevServerModulePath?: string): DevServer;
66
+ mergeConfig(target: any, source: any): any;
67
+ createBundler(context: BundlerContext, transformers?: WebpackConfigTransformer[], initialConfigs?: webpack.Configuration[], webpackModuleOrPath?: string | any): WebpackBundler;
68
+ private createConfigs;
69
+ private generateTransformers;
70
+ private getWebpackInstance;
71
+ private createDevServerConfig;
72
+ static slots: never[];
73
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
74
+ static dependencies: import("@teambit/harmony").Aspect[];
75
+ static provider([pubsub, workspace, bundler, logger]: [PubsubMain, Workspace, BundlerMain, LoggerMain]): Promise<WebpackMain>;
76
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/webpack",
3
- "version": "1.0.227",
3
+ "version": "1.0.229",
4
4
  "homepage": "https://bit.cloud/teambit/webpack/webpack",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.webpack",
8
8
  "name": "webpack",
9
- "version": "1.0.227"
9
+ "version": "1.0.229"
10
10
  },
11
11
  "dependencies": {
12
12
  "webpack": "5.84.1",
@@ -46,11 +46,11 @@
46
46
  "@teambit/harmony": "0.4.6",
47
47
  "@teambit/bit-error": "0.0.404",
48
48
  "@teambit/webpack.modules.config-mutator": "0.0.166",
49
- "@teambit/bundler": "1.0.227",
50
- "@teambit/logger": "0.0.953",
51
- "@teambit/cli": "0.0.860",
52
- "@teambit/pubsub": "1.0.227",
53
- "@teambit/workspace": "1.0.227",
49
+ "@teambit/bundler": "1.0.229",
50
+ "@teambit/logger": "0.0.955",
51
+ "@teambit/cli": "0.0.862",
52
+ "@teambit/pubsub": "1.0.229",
53
+ "@teambit/workspace": "1.0.229",
54
54
  "@teambit/webpack.modules.generate-expose-loaders": "0.0.16",
55
55
  "@teambit/webpack.modules.generate-externals": "0.0.17",
56
56
  "@teambit/webpack.plugins.inject-head-webpack-plugin": "0.0.10"
@@ -62,7 +62,7 @@
62
62
  "@types/react-dev-utils": "9.0.10",
63
63
  "@types/mocha": "10.0.1",
64
64
  "chai": "4.3.0",
65
- "@teambit/harmony.envs.core-aspect-env": "0.0.30"
65
+ "@teambit/harmony.envs.core-aspect-env": "0.0.33"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@teambit/legacy": "1.0.682",
package/tsconfig.json CHANGED
@@ -20,8 +20,7 @@
20
20
  "emitDeclarationOnly": true,
21
21
  "strict": true,
22
22
  "strictPropertyInitialization": false,
23
- "noImplicitAny": false,
24
- "composite": true
23
+ "noImplicitAny": false
25
24
  },
26
25
  "exclude": [
27
26
  "artifacts",
@@ -36,22 +35,5 @@
36
35
  "include": [
37
36
  "**/*",
38
37
  "**/*.json"
39
- ],
40
- "references": [
41
- {
42
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@1.0.227"
43
- },
44
- {
45
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.953"
46
- },
47
- {
48
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.860"
49
- },
50
- {
51
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_pubsub@1.0.227"
52
- },
53
- {
54
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.227"
55
- }
56
38
  ]
57
39
  }