@teambit/webpack 1.0.142 → 1.0.143

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,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuites>
3
+ <testsuite name="teambit.webpack/webpack@1.0.143" tests="0" failures="0" errors="0" skipped="0"/>
4
+ </testsuites>
@@ -1 +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.webpack/webpack-preview"]=t():e["teambit.webpack/webpack-preview"]=t()}(self,(()=>(()=>{"use strict";var e={73107:(e,t,o)=>{var r={id:"teambit.webpack/webpack@1.0.142",homepage:"https://bit.cloud/teambit/webpack/webpack",exported:!0};function n(){const e=i(o(87363));return n=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,i.__bit_component=r;const p=()=>n().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},n().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-webpack.svg"}));p.__bit_component=r,t.Logo=p},87363:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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 r={};return(()=>{o.r(r),o.d(r,{compositions:()=>u,compositions_metadata:()=>b,overview:()=>l});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(73107);o(87363);const n=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 r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}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,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,p);return(0,n.mdx)(s,a({},c,o,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const u=[t],l=[e],b={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),r})()));
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.webpack/webpack-preview"]=t():e["teambit.webpack/webpack-preview"]=t()}(self,(()=>(()=>{"use strict";var e={16804:(e,t,o)=>{var r={id:"teambit.webpack/webpack@1.0.143",homepage:"https://bit.cloud/teambit/webpack/webpack",exported:!0};function n(){const e=i(o(87363));return n=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,i.__bit_component=r;const p=()=>n().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},n().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-webpack.svg"}));p.__bit_component=r,t.Logo=p},87363:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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 r={};return(()=>{o.r(r),o.d(r,{compositions:()=>u,compositions_metadata:()=>b,overview:()=>l});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(16804);o(87363);const n=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 r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}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,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,p);return(0,n.mdx)(s,a({},c,o,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const u=[t],l=[e],b={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),r})()));
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.142/dist/webpack.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.142/dist/webpack.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.143/dist/webpack.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.143/dist/webpack.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,3 +1,3 @@
1
1
  import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
2
2
  import type { WebpackConfigDevServerTransformer, WebpackConfigTransformer } from './webpack.main.runtime';
3
- export declare function runTransformersWithContext(config: WebpackConfigMutator, transformers: Array<WebpackConfigTransformer | WebpackConfigDevServerTransformer>, context: any): WebpackConfigMutator;
3
+ export declare function runTransformersWithContext(config: WebpackConfigMutator, transformers: (WebpackConfigTransformer | WebpackConfigDevServerTransformer)[] | undefined, context: any): WebpackConfigMutator;
@@ -1,4 +1,4 @@
1
- import type { WebpackConfigTransformer } from '@teambit/webpack';
1
+ import type { WebpackConfigTransformer } from '../webpack.main.runtime';
2
2
  export type BodyInjectionOptions = {
3
3
  content: string;
4
4
  position?: 'start' | 'end';
@@ -1 +1 @@
1
- {"version":3,"names":["_injectBodyWebpackPlugin","data","_interopRequireDefault","require","obj","__esModule","default","GenerateBodyInjectionTransformer","options","config","plugin","InjectBodyPlugin","addPlugin"],"sources":["inject-body.ts"],"sourcesContent":["import InjectBodyPlugin from 'inject-body-webpack-plugin';\nimport type { WebpackConfigTransformer } from '@teambit/webpack';\n\nexport type BodyInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html body\n * We expose it from here, as it uses the inject-body-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n */\nexport function GenerateBodyInjectionTransformer(options: BodyInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n // @ts-ignore - https://github.com/Jaid/inject-body-webpack-plugin/issues/12\n const plugin = new InjectBodyPlugin(options);\n\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,yBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,wBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQ1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB;IACA,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAE5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH"}
1
+ {"version":3,"names":["_injectBodyWebpackPlugin","data","_interopRequireDefault","require","obj","__esModule","default","GenerateBodyInjectionTransformer","options","config","plugin","InjectBodyPlugin","addPlugin"],"sources":["inject-body.ts"],"sourcesContent":["import InjectBodyPlugin from 'inject-body-webpack-plugin';\nimport type { WebpackConfigTransformer } from '../webpack.main.runtime';\n\nexport type BodyInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html body\n * We expose it from here, as it uses the inject-body-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n */\nexport function GenerateBodyInjectionTransformer(options: BodyInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n // @ts-ignore - https://github.com/Jaid/inject-body-webpack-plugin/issues/12\n const plugin = new InjectBodyPlugin(options);\n\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,yBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,wBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQ1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB;IACA,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAE5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import type { WebpackConfigTransformer } from '@teambit/webpack';
1
+ import type { WebpackConfigTransformer } from '../webpack.main.runtime';
2
2
  export type HeadInjectionOptions = {
3
3
  content: string;
4
4
  position?: 'start' | 'end';
@@ -1 +1 @@
1
- {"version":3,"names":["_webpackPlugins","data","require","GenerateHeadInjectionTransformer","options","config","plugin","InjectHeadPlugin","addPlugin"],"sources":["inject-head.ts"],"sourcesContent":["import { InjectHeadPlugin } from '@teambit/webpack.plugins.inject-head-webpack-plugin';\nimport type { WebpackConfigTransformer } from '@teambit/webpack';\n\nexport type HeadInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html head\n * We expose it from here, as it uses the inject-head-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n */\nexport function GenerateHeadInjectionTransformer(options: HeadInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n const plugin = new InjectHeadPlugin(options);\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAC5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH"}
1
+ {"version":3,"names":["_webpackPlugins","data","require","GenerateHeadInjectionTransformer","options","config","plugin","InjectHeadPlugin","addPlugin"],"sources":["inject-head.ts"],"sourcesContent":["import { InjectHeadPlugin } from '@teambit/webpack.plugins.inject-head-webpack-plugin';\nimport type { WebpackConfigTransformer } from '../webpack.main.runtime';\n\nexport type HeadInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html head\n * We expose it from here, as it uses the inject-head-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n */\nexport function GenerateHeadInjectionTransformer(options: HeadInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n const plugin = new InjectHeadPlugin(options);\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAC5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH"}
@@ -1,6 +1,6 @@
1
- import { WebpackConfigTransformContext } from '@teambit/webpack';
2
1
  import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
3
2
  import { Logger } from '@teambit/logger';
3
+ import { WebpackConfigTransformContext } from '../webpack.main.runtime';
4
4
  export declare function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger): (config: WebpackConfigMutator, context: WebpackConfigTransformContext) => WebpackConfigMutator;
5
5
  /**
6
6
  * Generate a transformer that expose all the peers as global via the expose loader
@@ -1 +1 @@
1
- {"version":3,"names":["_getExposedRules","data","require","_resolvePeer","_getExternals","generateAddAliasesFromPeersTransformer","peers","logger","config","context","hostRootDir","target","peerAliases","reduce","acc","peerName","resolved","resolvePeerToDirOrFile","addAliases","generateExposePeersTransformer","exposedRules","getExposedRules","addModuleRules","generateExternalsTransformer","depes","externals","getExternals","addExternals"],"sources":["transformers.ts"],"sourcesContent":["import { WebpackConfigTransformContext } from '@teambit/webpack';\nimport { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport { Logger } from '@teambit/logger';\nimport { getExposedRules } from './get-exposed-rules';\nimport { resolvePeerToDirOrFile } from './resolve-peer';\nimport { getExternals } from './get-externals';\n\nexport function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const peerAliases = peers.reduce((acc, peerName) => {\n // gets the correct module folder of the package.\n // this allows us to resolve internal files, for example:\n // node_modules/react-dom/test-utils\n //\n // we can't use require.resolve() because it resolves to a specific file.\n // for example, if we used \"react-dom\": require.resolve(\"react-dom\"),\n // it would try to resolve \"react-dom/test-utils\" as:\n // node_modules/react-dom/index.js/test-utils\n const resolved = resolvePeerToDirOrFile(peerName, logger, hostRootDir);\n // Sometime there are packages that only hold icons for example, so there is no main property in their package.json\n // so they can't be resolved.\n // in such cases do not add them to the aliases.\n // We already log that cases in the resolvePeerToDirOrFile function.\n if (resolved) {\n acc[peerName] = resolved;\n }\n return acc;\n }, {});\n\n config.addAliases(peerAliases);\n return config;\n };\n}\n\n// [dead code] - no longer used\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n */\nexport function generateExposePeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const exposedRules = getExposedRules(peers, logger, hostRootDir);\n config.addModuleRules(exposedRules);\n return config;\n };\n}\n\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n */\nexport function generateExternalsTransformer(depes: string[]) {\n return (config: WebpackConfigMutator): WebpackConfigMutator => {\n const externals = getExternals(depes);\n config.addExternals(externals);\n return config;\n };\n}\n"],"mappings":";;;;;;;;AAGA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASI,sCAAsCA,CAACC,KAAe,EAAEC,MAAc,EAAE;EACtF,OAAO,CAACC,MAA4B,EAAEC,OAAsC,KAA2B;IACrG,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,EAAED,WAAW,IAAID,OAAO,CAACC,WAAW;IACtE,MAAME,WAAW,GAAGN,KAAK,CAACO,MAAM,CAAC,CAACC,GAAG,EAAEC,QAAQ,KAAK;MAClD;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,MAAMC,QAAQ,GAAG,IAAAC,qCAAsB,EAACF,QAAQ,EAAER,MAAM,EAAEG,WAAW,CAAC;MACtE;MACA;MACA;MACA;MACA,IAAIM,QAAQ,EAAE;QACZF,GAAG,CAACC,QAAQ,CAAC,GAAGC,QAAQ;MAC1B;MACA,OAAOF,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;IAENN,MAAM,CAACU,UAAU,CAACN,WAAW,CAAC;IAC9B,OAAOJ,MAAM;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,8BAA8BA,CAACb,KAAe,EAAEC,MAAc,EAAE;EAC9E,OAAO,CAACC,MAA4B,EAAEC,OAAsC,KAA2B;IACrG,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,EAAED,WAAW,IAAID,OAAO,CAACC,WAAW;IACtE,MAAMU,YAAY,GAAG,IAAAC,kCAAe,EAACf,KAAK,EAAEC,MAAM,EAAEG,WAAW,CAAC;IAChEF,MAAM,CAACc,cAAc,CAACF,YAAY,CAAC;IACnC,OAAOZ,MAAM;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASe,4BAA4BA,CAACC,KAAe,EAAE;EAC5D,OAAQhB,MAA4B,IAA2B;IAC7D,MAAMiB,SAAS,GAAG,IAAAC,4BAAY,EAACF,KAAK,CAAC;IACrChB,MAAM,CAACmB,YAAY,CAACF,SAAS,CAAC;IAC9B,OAAOjB,MAAM;EACf,CAAC;AACH"}
1
+ {"version":3,"names":["_getExposedRules","data","require","_resolvePeer","_getExternals","generateAddAliasesFromPeersTransformer","peers","logger","config","context","hostRootDir","target","peerAliases","reduce","acc","peerName","resolved","resolvePeerToDirOrFile","addAliases","generateExposePeersTransformer","exposedRules","getExposedRules","addModuleRules","generateExternalsTransformer","depes","externals","getExternals","addExternals"],"sources":["transformers.ts"],"sourcesContent":["import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport { Logger } from '@teambit/logger';\nimport { getExposedRules } from './get-exposed-rules';\nimport { resolvePeerToDirOrFile } from './resolve-peer';\nimport { WebpackConfigTransformContext } from '../webpack.main.runtime';\nimport { getExternals } from './get-externals';\n\nexport function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const peerAliases = peers.reduce((acc, peerName) => {\n // gets the correct module folder of the package.\n // this allows us to resolve internal files, for example:\n // node_modules/react-dom/test-utils\n //\n // we can't use require.resolve() because it resolves to a specific file.\n // for example, if we used \"react-dom\": require.resolve(\"react-dom\"),\n // it would try to resolve \"react-dom/test-utils\" as:\n // node_modules/react-dom/index.js/test-utils\n const resolved = resolvePeerToDirOrFile(peerName, logger, hostRootDir);\n // Sometime there are packages that only hold icons for example, so there is no main property in their package.json\n // so they can't be resolved.\n // in such cases do not add them to the aliases.\n // We already log that cases in the resolvePeerToDirOrFile function.\n if (resolved) {\n acc[peerName] = resolved;\n }\n return acc;\n }, {});\n\n config.addAliases(peerAliases);\n return config;\n };\n}\n\n// [dead code] - no longer used\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n */\nexport function generateExposePeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const exposedRules = getExposedRules(peers, logger, hostRootDir);\n config.addModuleRules(exposedRules);\n return config;\n };\n}\n\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n */\nexport function generateExternalsTransformer(depes: string[]) {\n return (config: WebpackConfigMutator): WebpackConfigMutator => {\n const externals = getExternals(depes);\n config.addExternals(externals);\n return config;\n };\n}\n"],"mappings":";;;;;;;;AAEA,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASI,sCAAsCA,CAACC,KAAe,EAAEC,MAAc,EAAE;EACtF,OAAO,CAACC,MAA4B,EAAEC,OAAsC,KAA2B;IACrG,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,EAAED,WAAW,IAAID,OAAO,CAACC,WAAW;IACtE,MAAME,WAAW,GAAGN,KAAK,CAACO,MAAM,CAAC,CAACC,GAAG,EAAEC,QAAQ,KAAK;MAClD;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,MAAMC,QAAQ,GAAG,IAAAC,qCAAsB,EAACF,QAAQ,EAAER,MAAM,EAAEG,WAAW,CAAC;MACtE;MACA;MACA;MACA;MACA,IAAIM,QAAQ,EAAE;QACZF,GAAG,CAACC,QAAQ,CAAC,GAAGC,QAAQ;MAC1B;MACA,OAAOF,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;IAENN,MAAM,CAACU,UAAU,CAACN,WAAW,CAAC;IAC9B,OAAOJ,MAAM;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,8BAA8BA,CAACb,KAAe,EAAEC,MAAc,EAAE;EAC9E,OAAO,CAACC,MAA4B,EAAEC,OAAsC,KAA2B;IACrG,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,EAAED,WAAW,IAAID,OAAO,CAACC,WAAW;IACtE,MAAMU,YAAY,GAAG,IAAAC,kCAAe,EAACf,KAAK,EAAEC,MAAM,EAAEG,WAAW,CAAC;IAChEF,MAAM,CAACc,cAAc,CAACF,YAAY,CAAC;IACnC,OAAOZ,MAAM;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASe,4BAA4BA,CAACC,KAAe,EAAE;EAC5D,OAAQhB,MAA4B,IAA2B;IAC7D,MAAMiB,SAAS,GAAG,IAAAC,4BAAY,EAACF,KAAK,CAAC;IACrChB,MAAM,CAACmB,YAAY,CAACF,SAAS,CAAC;IAC9B,OAAOjB,MAAM;EACf,CAAC;AACH"}
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const Logo: () => JSX.Element;
@@ -69,7 +69,7 @@ export declare class WebpackMain {
69
69
  private generateTransformers;
70
70
  private getWebpackInstance;
71
71
  private createDevServerConfig;
72
- static slots: any[];
72
+ static slots: never[];
73
73
  static runtime: import("@teambit/harmony").RuntimeDefinition;
74
74
  static dependencies: import("@teambit/harmony").Aspect[];
75
75
  static provider([pubsub, workspace, bundler, logger]: [PubsubMain, Workspace, BundlerMain, LoggerMain]): Promise<WebpackMain>;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/webpack",
3
- "version": "1.0.142",
3
+ "version": "1.0.143",
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.142"
9
+ "version": "1.0.143"
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.142",
50
- "@teambit/logger": "0.0.941",
51
- "@teambit/cli": "0.0.848",
52
- "@teambit/pubsub": "1.0.142",
53
- "@teambit/workspace": "1.0.142",
49
+ "@teambit/bundler": "1.0.143",
50
+ "@teambit/logger": "0.0.942",
51
+ "@teambit/cli": "0.0.849",
52
+ "@teambit/pubsub": "1.0.143",
53
+ "@teambit/workspace": "1.0.143",
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"
@@ -60,14 +60,14 @@
60
60
  "@types/lodash": "4.14.165",
61
61
  "@types/find-root": "1.1.2",
62
62
  "@types/react-dev-utils": "9.0.10",
63
- "@types/jest": "^29.2.2",
64
- "@types/testing-library__jest-dom": "^5.9.5",
65
- "@teambit/harmony.envs.core-aspect-env": "0.0.19"
63
+ "@types/mocha": "10.0.1",
64
+ "chai": "4.3.0",
65
+ "@teambit/harmony.envs.core-aspect-env": "0.0.24"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@teambit/legacy": "1.0.638",
69
69
  "react": "^17.0.0 || ^18.0.0",
70
- "@types/react": "17.0.8"
70
+ "@types/react": "^17.0.73"
71
71
  },
72
72
  "license": "Apache-2.0",
73
73
  "optionalDependencies": {},
@@ -81,7 +81,8 @@
81
81
  "default": "./dist/index.js"
82
82
  },
83
83
  "./dist/*": "./dist/*",
84
- "./artifacts/*": "./artifacts/*"
84
+ "./artifacts/*": "./artifacts/*",
85
+ "./*": "./*.ts"
85
86
  },
86
87
  "private": false,
87
88
  "engines": {
@@ -1,5 +1,5 @@
1
1
  import InjectBodyPlugin from 'inject-body-webpack-plugin';
2
- import type { WebpackConfigTransformer } from '@teambit/webpack';
2
+ import type { WebpackConfigTransformer } from '../webpack.main.runtime';
3
3
 
4
4
  export type BodyInjectionOptions = {
5
5
  content: string;
@@ -1,5 +1,5 @@
1
1
  import { InjectHeadPlugin } from '@teambit/webpack.plugins.inject-head-webpack-plugin';
2
- import type { WebpackConfigTransformer } from '@teambit/webpack';
2
+ import type { WebpackConfigTransformer } from '../webpack.main.runtime';
3
3
 
4
4
  export type HeadInjectionOptions = {
5
5
  content: string;
@@ -1,8 +1,8 @@
1
- import { WebpackConfigTransformContext } from '@teambit/webpack';
2
1
  import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
3
2
  import { Logger } from '@teambit/logger';
4
3
  import { getExposedRules } from './get-exposed-rules';
5
4
  import { resolvePeerToDirOrFile } from './resolve-peer';
5
+ import { WebpackConfigTransformContext } from '../webpack.main.runtime';
6
6
  import { getExternals } from './get-externals';
7
7
 
8
8
  export function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger) {
package/tsconfig.json CHANGED
@@ -17,7 +17,10 @@
17
17
  "resolveJsonModule": true,
18
18
  "allowJs": true,
19
19
  "outDir": "dist",
20
- "emitDeclarationOnly": true
20
+ "emitDeclarationOnly": true,
21
+ "strict": true,
22
+ "strictPropertyInitialization": false,
23
+ "noImplicitAny": false
21
24
  },
22
25
  "exclude": [
23
26
  "artifacts",