@teambit/preview 1.0.879 → 1.0.880

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 @@
1
+ {"version":3,"names":["_core","data","require","_webpack","_mdxModules","_rspackPlugins","moduleFileExtensions","imageInlineSizeLimit","parseInt","process","env","IMAGE_INLINE_SIZE_LIMIT","cssModuleGenerator","localIdentName","esModule","cssParser","css","namedExports","createRspackConfig","outputDir","entryFile","mode","BIT_DEBUG_PREVIEW_BUNDLE","shouldUseSourceMap","GENERATE_SOURCEMAP","stats","children","errorDetails","devtool","experiments","entry","main","output","path","publicPath","chunkFilename","filename","cssFilename","cssChunkFilename","library","type","externalsType","externals","resolve","extensions","map","ext","alias","react","fallback","module","fallbacks","dgram","dns","fs","stream","http2","net","tls","child_process","optimization","minimize","minimizer","rspack","SwcJsMinimizerRspackPlugin","minimizerOptions","compress","ecma","comparisons","inline","mangle","format","comments","ascii_only","LightningCssMinimizerRspackPlugin","parser","rules","test","fullySpecified","exclude","use","loader","options","jsc","syntax","tsx","transform","runtime","target","enforce","include","descriptionData","componentId","value","extractSourceMap","dataUrlCondition","maxSize","sideEffects","generator","sourceMap","mdxOptions","plugins","RspackManifestPlugin","fileName","ProvidePlugin","fallbacksProvidePluginConfig","IgnorePlugin","resourceRegExp","contextRegExp","performance"],"sources":["rspack.config.ts"],"sourcesContent":["import { rspack, type Configuration } from '@rspack/core';\nimport { fallbacksProvidePluginConfig, fallbacks } from '@teambit/webpack';\nimport { mdxOptions } from '@teambit/mdx.modules.mdx-v3-options';\nimport { RspackManifestPlugin } from '@teambit/rspack.plugins.manifest-plugin';\n\nconst moduleFileExtensions = [\n 'web.mjs',\n 'mjs',\n 'web.js',\n 'js',\n 'web.ts',\n 'ts',\n 'web.tsx',\n 'tsx',\n 'json',\n 'web.jsx',\n 'jsx',\n 'mdx',\n 'md',\n];\n\nconst imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');\nconst cssModuleGenerator = { localIdentName: '[name]__[local]--[hash:base64:5]', esModule: false };\nconst cssParser = {\n css: { namedExports: false },\n 'css/auto': { namedExports: false },\n 'css/module': { namedExports: false },\n} as const;\n\nexport function createRspackConfig(outputDir: string, entryFile: string): Configuration {\n const mode = process.env.BIT_DEBUG_PREVIEW_BUNDLE ? 'development' : 'production';\n const shouldUseSourceMap = mode === 'development' || process.env.GENERATE_SOURCEMAP === 'true';\n\n return {\n stats: {\n children: true,\n errorDetails: true,\n },\n mode,\n\n devtool: shouldUseSourceMap ? 'source-map' : false,\n experiments: {\n css: true,\n },\n\n entry: {\n main: entryFile,\n },\n\n output: {\n path: outputDir,\n publicPath: '/',\n chunkFilename: 'static/js/[name].[contenthash:8].chunk.cjs',\n filename: 'static/js/[name].[contenthash:8].cjs',\n cssFilename: 'static/css/[name].[contenthash:8].css',\n cssChunkFilename: 'static/css/[name].[contenthash:8].chunk.css',\n library: {\n type: 'commonjs-static',\n },\n },\n\n externalsType: 'commonjs',\n externals: ['react', 'react-dom', '@mdx-js/react', '@teambit/mdx.ui.mdx-scope-context'],\n\n resolve: {\n extensions: moduleFileExtensions.map((ext) => `.${ext}`),\n alias: {\n 'react/jsx-runtime': require.resolve('react/jsx-runtime'),\n react: require.resolve('react'),\n 'react-dom': require.resolve('react-dom'),\n },\n fallback: {\n module: false,\n path: fallbacks.path,\n dgram: false,\n dns: false,\n fs: false,\n stream: false,\n http2: false,\n net: false,\n tls: false,\n child_process: false,\n process: fallbacks.process,\n },\n },\n\n optimization: {\n minimize: mode === 'production',\n minimizer: [\n new rspack.SwcJsMinimizerRspackPlugin({\n minimizerOptions: {\n compress: {\n ecma: 5,\n comparisons: false,\n inline: 2,\n },\n // We need to keep class names and disable mangling to prevent issues with consuming the rspack bundle in\n // other bundlers (e.g. webpack) that rely on class names for tree shaking and other optimizations.\n mangle: false,\n format: {\n ecma: 5,\n comments: false,\n ascii_only: true,\n },\n },\n }),\n new rspack.LightningCssMinimizerRspackPlugin({}),\n ],\n },\n\n module: {\n parser: cssParser,\n rules: [\n {\n test: /\\.m?js/,\n resolve: {\n fullySpecified: false,\n },\n },\n {\n test: /\\.(js|mjs|jsx|ts|tsx)$/,\n exclude: /node_modules/,\n use: {\n loader: 'builtin:swc-loader',\n options: {\n jsc: {\n parser: {\n syntax: 'typescript',\n tsx: true,\n },\n transform: {\n react: {\n runtime: 'automatic',\n },\n },\n target: 'es2015',\n },\n },\n },\n type: 'javascript/auto',\n },\n {\n test: /\\.js$/,\n enforce: 'pre' as const,\n include: /node_modules/,\n descriptionData: { componentId: (value: any) => !!value },\n extractSourceMap: shouldUseSourceMap,\n },\n {\n test: [/\\.bmp$/, /\\.gif$/, /\\.jpe?g$/, /\\.png$/],\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: imageInlineSizeLimit,\n },\n },\n },\n {\n test: /\\.svg$/,\n type: 'asset',\n parser: {\n dataUrlCondition: {\n maxSize: imageInlineSizeLimit,\n },\n },\n },\n {\n test: /\\.css$/,\n exclude: /\\.module\\.css$/,\n type: 'css',\n sideEffects: true,\n },\n {\n test: /\\.module\\.css$/,\n type: 'css/module',\n generator: cssModuleGenerator,\n },\n {\n test: /\\.(scss|sass)$/,\n exclude: /\\.module\\.(scss|sass)$/,\n use: [\n {\n loader: require.resolve('resolve-url-loader'),\n options: { sourceMap: shouldUseSourceMap },\n },\n {\n loader: require.resolve('sass-loader'),\n options: { sourceMap: shouldUseSourceMap },\n },\n ],\n type: 'css',\n sideEffects: true,\n },\n {\n test: /\\.module\\.(scss|sass)$/,\n use: [\n {\n loader: require.resolve('resolve-url-loader'),\n options: { sourceMap: shouldUseSourceMap },\n },\n {\n loader: require.resolve('sass-loader'),\n options: { sourceMap: shouldUseSourceMap },\n },\n ],\n type: 'css/module',\n generator: cssModuleGenerator,\n },\n {\n test: /\\.(woff(2)?|ttf|eot)(\\?v=\\d+\\.\\d+\\.\\d+)?$/,\n type: 'asset',\n generator: {\n filename: 'static/fonts/[hash][ext][query]',\n },\n },\n {\n test: /\\.mdx?$/,\n use: [\n {\n loader: 'builtin:swc-loader',\n options: {\n jsc: {\n parser: {\n syntax: 'typescript',\n tsx: true,\n },\n transform: {\n react: {\n runtime: 'automatic',\n },\n },\n target: 'es2015',\n },\n },\n },\n {\n loader: require.resolve('@mdx-js/loader'),\n options: mdxOptions,\n },\n {\n // transforms admonition syntax (:::type content → :::type[content]) for mdx v3\n loader: require.resolve('@teambit/react/dist/webpack/mdx-pre-loader.cjs'),\n },\n ],\n type: 'javascript/auto',\n },\n {\n exclude: [/\\.(cjs|js|mjs|jsx|ts|tsx)$/, /\\.html$/, /\\.json$/, /\\.css$/, /\\.s[ac]ss$/, /\\.less$/, /\\.mdx?$/],\n type: 'asset/resource',\n },\n ],\n },\n\n plugins: [\n new RspackManifestPlugin({ fileName: 'asset-manifest.json' }),\n\n new rspack.ProvidePlugin({ process: fallbacksProvidePluginConfig.process }),\n\n new rspack.IgnorePlugin({\n resourceRegExp: /^\\.\\/locale$/,\n contextRegExp: /moment$/,\n }),\n ],\n\n performance: false,\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,eAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,cAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMK,oBAAoB,GAA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,CAAC,gBAAgB,CAAC;UACzCuC,OAAO,EAAEkB;QACX,CAAC,EACD;UACE;UACAnB,MAAM,EAAE/E,OAAO,CAACyC,OAAO,CAAC,gDAAgD;QAC1E,CAAC,CACF;QACDH,IAAI,EAAE;MACR,CAAC,EACD;QACEuC,OAAO,EAAE,CAAC,4BAA4B,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC;QAC3GvC,IAAI,EAAE;MACR,CAAC;IAEL,CAAC;IAED6D,OAAO,EAAE,CACP,KAAIC,qCAAoB,EAAC;MAAEC,QAAQ,EAAE;IAAsB,CAAC,CAAC,EAE7D,KAAIxC,cAAM,CAACyC,aAAa,EAAC;MAAE/F,OAAO,EAAEgG,uCAA4B,CAAChG;IAAQ,CAAC,CAAC,EAE3E,KAAIsD,cAAM,CAAC2C,YAAY,EAAC;MACtBC,cAAc,EAAE,cAAc;MAC9BC,aAAa,EAAE;IACjB,CAAC,CAAC,CACH;IAEDC,WAAW,EAAE;EACf,CAAC;AACH","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/preview",
3
- "version": "1.0.879",
3
+ "version": "1.0.880",
4
4
  "homepage": "https://bit.cloud/teambit/preview/preview",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.preview",
8
8
  "name": "preview",
9
- "version": "1.0.879"
9
+ "version": "1.0.880"
10
10
  },
11
11
  "dependencies": {
12
12
  "mime": "2.5.2",
@@ -18,13 +18,14 @@
18
18
  "object-hash": "2.1.1",
19
19
  "chalk": "4.1.2",
20
20
  "pad-right": "0.2.2",
21
- "webpack": "5.97.1",
21
+ "@rspack/core": "1.7.5",
22
22
  "graphql-tag": "2.12.1",
23
23
  "filenamify": "4.2.0",
24
24
  "lodash.compact": "3.0.1",
25
25
  "graphql-request": "6.1.0",
26
- "webpack-manifest-plugin": "5.0.0",
27
- "webpack-merge": "5.8.0",
26
+ "@mdx-js/loader": "^3.1.1",
27
+ "resolve-url-loader": "5.0.0",
28
+ "sass-loader": "13.3.2",
28
29
  "@teambit/express": "0.0.1398",
29
30
  "@teambit/logger": "0.0.1392",
30
31
  "@teambit/ui-foundation.ui.pages.static-error": "0.0.110",
@@ -44,23 +45,25 @@
44
45
  "@teambit/harmony.modules.feature-toggle": "0.0.33",
45
46
  "@teambit/preview.cli.dev-server-events-listener": "0.0.1",
46
47
  "@teambit/preview.cli.webpack-events-listener": "0.0.178",
47
- "@teambit/react.webpack.react-webpack": "1.0.50",
48
- "@teambit/builder": "1.0.879",
49
- "@teambit/bundler": "1.0.879",
50
- "@teambit/component": "1.0.879",
51
- "@teambit/aspect-loader": "1.0.879",
52
- "@teambit/dependency-resolver": "1.0.879",
53
- "@teambit/envs": "1.0.879",
54
- "@teambit/ui": "1.0.879",
55
- "@teambit/isolator": "1.0.879",
56
- "@teambit/graphql": "1.0.879",
57
- "@teambit/pkg": "1.0.879",
58
- "@teambit/pubsub": "1.0.879",
59
- "@teambit/scope": "1.0.879",
60
- "@teambit/watcher": "1.0.879",
61
- "@teambit/workspace": "1.0.879",
62
- "@teambit/compiler": "1.0.879",
63
- "@teambit/webpack": "1.0.879"
48
+ "@teambit/mdx.modules.mdx-v3-options": "0.0.2",
49
+ "@teambit/builder": "1.0.880",
50
+ "@teambit/bundler": "1.0.880",
51
+ "@teambit/component": "1.0.880",
52
+ "@teambit/aspect-loader": "1.0.880",
53
+ "@teambit/dependency-resolver": "1.0.880",
54
+ "@teambit/envs": "1.0.880",
55
+ "@teambit/ui": "1.0.880",
56
+ "@teambit/isolator": "1.0.880",
57
+ "@teambit/graphql": "1.0.880",
58
+ "@teambit/pkg": "1.0.880",
59
+ "@teambit/pubsub": "1.0.880",
60
+ "@teambit/scope": "1.0.880",
61
+ "@teambit/watcher": "1.0.880",
62
+ "@teambit/workspace": "1.0.880",
63
+ "@teambit/compiler": "1.0.880",
64
+ "@teambit/react": "1.0.880",
65
+ "@teambit/rspack.plugins.manifest-plugin": "0.0.1",
66
+ "@teambit/webpack": "1.0.880"
64
67
  },
65
68
  "devDependencies": {
66
69
  "@types/mime": "2.0.3",
@@ -68,7 +71,6 @@
68
71
  "@types/lodash": "4.14.165",
69
72
  "@types/normalize-path": "^3.0.0",
70
73
  "@types/object-hash": "1.3.4",
71
- "@types/webpack": "5.28.5",
72
74
  "cross-fetch": "3.1.5",
73
75
  "lru-cache": "10.4.3",
74
76
  "@types/lodash.compact": "3.0.6",
@@ -281,13 +281,12 @@ function getSpinnerId(envId: string) {
281
281
  }
282
282
 
283
283
  function getSpinnerCompilingMessage(server: ComponentServer, verbose = false) {
284
- const prefix = 'COMPILING';
285
284
  const envId = chalk.cyan(server.context.envRuntime.id);
286
285
  let includedEnvs = '';
287
286
  if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {
288
287
  includedEnvs = `on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;
289
288
  }
290
- return `${prefix} ${envId} ${includedEnvs}`;
289
+ return `${chalk.yellow('Compiling')} ${envId} ${includedEnvs}`;
291
290
  }
292
291
 
293
292
  function getSpinnerDoneMessage(
@@ -300,19 +299,21 @@ function getSpinnerDoneMessage(
300
299
  ) {
301
300
  const hasErrors = !!errors.length;
302
301
  const hasWarnings = !!warnings.length;
303
- const prefix = hasErrors ? 'FAILED' : 'RUNNING';
304
302
  const envId = chalk.cyan(server.context.envRuntime.id);
305
303
  let includedEnvs = '';
306
304
  if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {
307
- includedEnvs = ` on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;
305
+ includedEnvs = ` ${chalk.dim('via')} ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;
308
306
  }
309
307
  const errorsTxt = hasErrors ? errors.map((err) => err.message).join('\n') : '';
310
308
  const errorsTxtWithTitle = hasErrors ? chalk.red(`\nErrors:\n${errorsTxt}`) : '';
311
309
  const warningsTxt = hasWarnings ? warnings.map((warning) => warning.message).join('\n') : '';
312
310
  const warningsTxtWithTitle = hasWarnings ? chalk.yellow(`\nWarnings:\n${warningsTxt}`) : '';
313
311
 
312
+ if (hasErrors) {
313
+ return `${chalk.red('Failed')} ${envId}${includedEnvs}${errorsTxtWithTitle}${warningsTxtWithTitle}`;
314
+ }
314
315
  const urlMessage = hasErrors || !showInternalUrls ? '' : `at ${chalk.cyan(url)}`;
315
- return `${prefix} ${envId}${includedEnvs} ${urlMessage} ${errorsTxtWithTitle} ${warningsTxtWithTitle}`;
316
+ return `${chalk.green('Ready')} ${envId}${includedEnvs} ${urlMessage}${warningsTxtWithTitle}`;
316
317
  }
317
318
 
318
319
  function stringifyIncludedEnvs(includedEnvs: string[] = [], verbose = false) {
@@ -0,0 +1,267 @@
1
+ import { rspack, type Configuration } from '@rspack/core';
2
+ import { fallbacksProvidePluginConfig, fallbacks } from '@teambit/webpack';
3
+ import { mdxOptions } from '@teambit/mdx.modules.mdx-v3-options';
4
+ import { RspackManifestPlugin } from '@teambit/rspack.plugins.manifest-plugin';
5
+
6
+ const moduleFileExtensions = [
7
+ 'web.mjs',
8
+ 'mjs',
9
+ 'web.js',
10
+ 'js',
11
+ 'web.ts',
12
+ 'ts',
13
+ 'web.tsx',
14
+ 'tsx',
15
+ 'json',
16
+ 'web.jsx',
17
+ 'jsx',
18
+ 'mdx',
19
+ 'md',
20
+ ];
21
+
22
+ const imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');
23
+ const cssModuleGenerator = { localIdentName: '[name]__[local]--[hash:base64:5]', esModule: false };
24
+ const cssParser = {
25
+ css: { namedExports: false },
26
+ 'css/auto': { namedExports: false },
27
+ 'css/module': { namedExports: false },
28
+ } as const;
29
+
30
+ export function createRspackConfig(outputDir: string, entryFile: string): Configuration {
31
+ const mode = process.env.BIT_DEBUG_PREVIEW_BUNDLE ? 'development' : 'production';
32
+ const shouldUseSourceMap = mode === 'development' || process.env.GENERATE_SOURCEMAP === 'true';
33
+
34
+ return {
35
+ stats: {
36
+ children: true,
37
+ errorDetails: true,
38
+ },
39
+ mode,
40
+
41
+ devtool: shouldUseSourceMap ? 'source-map' : false,
42
+ experiments: {
43
+ css: true,
44
+ },
45
+
46
+ entry: {
47
+ main: entryFile,
48
+ },
49
+
50
+ output: {
51
+ path: outputDir,
52
+ publicPath: '/',
53
+ chunkFilename: 'static/js/[name].[contenthash:8].chunk.cjs',
54
+ filename: 'static/js/[name].[contenthash:8].cjs',
55
+ cssFilename: 'static/css/[name].[contenthash:8].css',
56
+ cssChunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
57
+ library: {
58
+ type: 'commonjs-static',
59
+ },
60
+ },
61
+
62
+ externalsType: 'commonjs',
63
+ externals: ['react', 'react-dom', '@mdx-js/react', '@teambit/mdx.ui.mdx-scope-context'],
64
+
65
+ resolve: {
66
+ extensions: moduleFileExtensions.map((ext) => `.${ext}`),
67
+ alias: {
68
+ 'react/jsx-runtime': require.resolve('react/jsx-runtime'),
69
+ react: require.resolve('react'),
70
+ 'react-dom': require.resolve('react-dom'),
71
+ },
72
+ fallback: {
73
+ module: false,
74
+ path: fallbacks.path,
75
+ dgram: false,
76
+ dns: false,
77
+ fs: false,
78
+ stream: false,
79
+ http2: false,
80
+ net: false,
81
+ tls: false,
82
+ child_process: false,
83
+ process: fallbacks.process,
84
+ },
85
+ },
86
+
87
+ optimization: {
88
+ minimize: mode === 'production',
89
+ minimizer: [
90
+ new rspack.SwcJsMinimizerRspackPlugin({
91
+ minimizerOptions: {
92
+ compress: {
93
+ ecma: 5,
94
+ comparisons: false,
95
+ inline: 2,
96
+ },
97
+ // We need to keep class names and disable mangling to prevent issues with consuming the rspack bundle in
98
+ // other bundlers (e.g. webpack) that rely on class names for tree shaking and other optimizations.
99
+ mangle: false,
100
+ format: {
101
+ ecma: 5,
102
+ comments: false,
103
+ ascii_only: true,
104
+ },
105
+ },
106
+ }),
107
+ new rspack.LightningCssMinimizerRspackPlugin({}),
108
+ ],
109
+ },
110
+
111
+ module: {
112
+ parser: cssParser,
113
+ rules: [
114
+ {
115
+ test: /\.m?js/,
116
+ resolve: {
117
+ fullySpecified: false,
118
+ },
119
+ },
120
+ {
121
+ test: /\.(js|mjs|jsx|ts|tsx)$/,
122
+ exclude: /node_modules/,
123
+ use: {
124
+ loader: 'builtin:swc-loader',
125
+ options: {
126
+ jsc: {
127
+ parser: {
128
+ syntax: 'typescript',
129
+ tsx: true,
130
+ },
131
+ transform: {
132
+ react: {
133
+ runtime: 'automatic',
134
+ },
135
+ },
136
+ target: 'es2015',
137
+ },
138
+ },
139
+ },
140
+ type: 'javascript/auto',
141
+ },
142
+ {
143
+ test: /\.js$/,
144
+ enforce: 'pre' as const,
145
+ include: /node_modules/,
146
+ descriptionData: { componentId: (value: any) => !!value },
147
+ extractSourceMap: shouldUseSourceMap,
148
+ },
149
+ {
150
+ test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
151
+ type: 'asset',
152
+ parser: {
153
+ dataUrlCondition: {
154
+ maxSize: imageInlineSizeLimit,
155
+ },
156
+ },
157
+ },
158
+ {
159
+ test: /\.svg$/,
160
+ type: 'asset',
161
+ parser: {
162
+ dataUrlCondition: {
163
+ maxSize: imageInlineSizeLimit,
164
+ },
165
+ },
166
+ },
167
+ {
168
+ test: /\.css$/,
169
+ exclude: /\.module\.css$/,
170
+ type: 'css',
171
+ sideEffects: true,
172
+ },
173
+ {
174
+ test: /\.module\.css$/,
175
+ type: 'css/module',
176
+ generator: cssModuleGenerator,
177
+ },
178
+ {
179
+ test: /\.(scss|sass)$/,
180
+ exclude: /\.module\.(scss|sass)$/,
181
+ use: [
182
+ {
183
+ loader: require.resolve('resolve-url-loader'),
184
+ options: { sourceMap: shouldUseSourceMap },
185
+ },
186
+ {
187
+ loader: require.resolve('sass-loader'),
188
+ options: { sourceMap: shouldUseSourceMap },
189
+ },
190
+ ],
191
+ type: 'css',
192
+ sideEffects: true,
193
+ },
194
+ {
195
+ test: /\.module\.(scss|sass)$/,
196
+ use: [
197
+ {
198
+ loader: require.resolve('resolve-url-loader'),
199
+ options: { sourceMap: shouldUseSourceMap },
200
+ },
201
+ {
202
+ loader: require.resolve('sass-loader'),
203
+ options: { sourceMap: shouldUseSourceMap },
204
+ },
205
+ ],
206
+ type: 'css/module',
207
+ generator: cssModuleGenerator,
208
+ },
209
+ {
210
+ test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
211
+ type: 'asset',
212
+ generator: {
213
+ filename: 'static/fonts/[hash][ext][query]',
214
+ },
215
+ },
216
+ {
217
+ test: /\.mdx?$/,
218
+ use: [
219
+ {
220
+ loader: 'builtin:swc-loader',
221
+ options: {
222
+ jsc: {
223
+ parser: {
224
+ syntax: 'typescript',
225
+ tsx: true,
226
+ },
227
+ transform: {
228
+ react: {
229
+ runtime: 'automatic',
230
+ },
231
+ },
232
+ target: 'es2015',
233
+ },
234
+ },
235
+ },
236
+ {
237
+ loader: require.resolve('@mdx-js/loader'),
238
+ options: mdxOptions,
239
+ },
240
+ {
241
+ // transforms admonition syntax (:::type content → :::type[content]) for mdx v3
242
+ loader: require.resolve('@teambit/react/dist/webpack/mdx-pre-loader.cjs'),
243
+ },
244
+ ],
245
+ type: 'javascript/auto',
246
+ },
247
+ {
248
+ exclude: [/\.(cjs|js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/, /\.css$/, /\.s[ac]ss$/, /\.less$/, /\.mdx?$/],
249
+ type: 'asset/resource',
250
+ },
251
+ ],
252
+ },
253
+
254
+ plugins: [
255
+ new RspackManifestPlugin({ fileName: 'asset-manifest.json' }),
256
+
257
+ new rspack.ProvidePlugin({ process: fallbacksProvidePluginConfig.process }),
258
+
259
+ new rspack.IgnorePlugin({
260
+ resourceRegExp: /^\.\/locale$/,
261
+ contextRegExp: /moment$/,
262
+ }),
263
+ ],
264
+
265
+ performance: false,
266
+ };
267
+ }
@@ -1,5 +0,0 @@
1
- .frame_overlayBorder__4pB4S{box-sizing:border-box;border:2px solid #eebcc9;border:2px solid var(--bit-highlighter-color, #eebcc9);border-radius:11px;padding:4px;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.frame_hidden__F0shs{display:none}
2
- .label_othersContainer__\+rhM5>*{margin-bottom:8px}.label_othersContainer__\+rhM5>*:last-child{margin-bottom:0;margin-bottom:initial}.label_othersTooltip__FsGq5{-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer}.label_othersTooltip__FsGq5::before{display:inline-block;transition:transform 300ms;content:"▾"}.label_othersTooltip__FsGq5.label_active__E6KIP::before{transform:rotate(-180deg)}.label_hidden__ZtHoV{visibility:hidden;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}
3
- .component-strip_componentStrip__eCupE{display:flex;width:-moz-fit-content;width:fit-content;border-radius:.5em;box-shadow:var(--bit-highlighter-shadow);white-space:nowrap}.component-strip_componentStrip__eCupE>*{padding:0 .5em;line-height:1.5;transition:filter 300ms,background-color 300ms;transform:translateZ(0);background:#eebcc9;background:var(--bit-highlighter-color, #eebcc9);margin-right:.125em}.component-strip_componentStrip__eCupE>*:link,.component-strip_componentStrip__eCupE>*:visited{text-decoration:inherit;color:inherit}.component-strip_componentStrip__eCupE>*:link:hover,.component-strip_componentStrip__eCupE>*:visited:hover{background:#f6dae2;background:var(--bit-highlighter-color-hover, #f6dae2)}.component-strip_componentStrip__eCupE>*:link:active,.component-strip_componentStrip__eCupE>*:visited:active{background:#e79db1;background:var(--bit-highlighter-color-active, #e79db1);color:inherit}.component-strip_componentStrip__eCupE>*:first-child{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.component-strip_componentStrip__eCupE>*:last-child{border-top-right-radius:.5em;border-bottom-right-radius:.5em;margin-right:0;margin-right:initial}.component-strip_nameBlock__URo7m{display:flex}.component-strip_nameBlock__URo7m .component-strip_version__KGQOB{max-width:13ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:max-width 480ms}.component-strip_nameBlock__URo7m .component-strip_version__KGQOB:hover{max-width:61ch}
4
- .element-highlighter_label__UFbc1{padding:8px}.element-highlighter_frame__0eJ5V,.element-highlighter_label__UFbc1{z-index:15500}
5
- .highlighter-provider_highlighter__vY8on{border:solid #ededed;border:solid var(--bit-border-color-lightest, #ededed);border-width:0px;box-sizing:border-box;height:100%;transition:border 300ms}.highlighter-provider_highlighter__vY8on.highlighter-provider_active__xgxqx{border-width:8px;overflow:auto}.highlighter-provider_label__iLN6B{font-family:sans-serif;font-size:12px}