@teambit/preview 1.0.883 → 1.0.884
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/ui-bundle/asset-manifest.json +4 -4
- package/artifacts/ui-bundle/static/css/main.03dc01ef.css +5 -0
- package/artifacts/ui-bundle/static/js/main.bd0aab87.cjs +13 -0
- package/artifacts/ui-bundle/static/js/main.bd0aab87.cjs.LICENSE.txt +36 -0
- package/dist/pre-bundle.d.ts +2 -1
- package/dist/pre-bundle.js +24 -24
- package/dist/pre-bundle.js.map +1 -1
- package/dist/{preview-1770912159557.js → preview-1770935587117.js} +2 -2
- package/dist/preview.start-plugin.js +5 -6
- package/dist/preview.start-plugin.js.map +1 -1
- package/dist/webpack/webpack.config.d.ts +2 -0
- package/dist/webpack/webpack.config.js +118 -0
- package/dist/webpack/webpack.config.js.map +1 -0
- package/package.json +23 -26
- package/preview.start-plugin.tsx +5 -6
- package/webpack/webpack.config.ts +88 -0
- package/artifacts/ui-bundle/static/css/main.c333ba81.css +0 -1
- package/artifacts/ui-bundle/static/js/main.a4cb948b.cjs +0 -33
- package/dist/rspack/rspack.config.d.ts +0 -2
- package/dist/rspack/rspack.config.js +0 -271
- package/dist/rspack/rspack.config.js.map +0 -1
- package/rspack/rspack.config.ts +0 -268
package/preview.start-plugin.tsx
CHANGED
|
@@ -281,12 +281,13 @@ function getSpinnerId(envId: string) {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
function getSpinnerCompilingMessage(server: ComponentServer, verbose = false) {
|
|
284
|
+
const prefix = 'COMPILING';
|
|
284
285
|
const envId = chalk.cyan(server.context.envRuntime.id);
|
|
285
286
|
let includedEnvs = '';
|
|
286
287
|
if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {
|
|
287
288
|
includedEnvs = `on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;
|
|
288
289
|
}
|
|
289
|
-
return `${
|
|
290
|
+
return `${prefix} ${envId} ${includedEnvs}`;
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
function getSpinnerDoneMessage(
|
|
@@ -299,21 +300,19 @@ function getSpinnerDoneMessage(
|
|
|
299
300
|
) {
|
|
300
301
|
const hasErrors = !!errors.length;
|
|
301
302
|
const hasWarnings = !!warnings.length;
|
|
303
|
+
const prefix = hasErrors ? 'FAILED' : 'RUNNING';
|
|
302
304
|
const envId = chalk.cyan(server.context.envRuntime.id);
|
|
303
305
|
let includedEnvs = '';
|
|
304
306
|
if (server.context.relatedContexts && server.context.relatedContexts.length > 1) {
|
|
305
|
-
includedEnvs = `
|
|
307
|
+
includedEnvs = ` on behalf of ${chalk.cyan(stringifyIncludedEnvs(server.context.relatedContexts, verbose))}`;
|
|
306
308
|
}
|
|
307
309
|
const errorsTxt = hasErrors ? errors.map((err) => err.message).join('\n') : '';
|
|
308
310
|
const errorsTxtWithTitle = hasErrors ? chalk.red(`\nErrors:\n${errorsTxt}`) : '';
|
|
309
311
|
const warningsTxt = hasWarnings ? warnings.map((warning) => warning.message).join('\n') : '';
|
|
310
312
|
const warningsTxtWithTitle = hasWarnings ? chalk.yellow(`\nWarnings:\n${warningsTxt}`) : '';
|
|
311
313
|
|
|
312
|
-
if (hasErrors) {
|
|
313
|
-
return `${chalk.red('Failed')} ${envId}${includedEnvs}${errorsTxtWithTitle}${warningsTxtWithTitle}`;
|
|
314
|
-
}
|
|
315
314
|
const urlMessage = hasErrors || !showInternalUrls ? '' : `at ${chalk.cyan(url)}`;
|
|
316
|
-
return `${
|
|
315
|
+
return `${prefix} ${envId}${includedEnvs} ${urlMessage} ${errorsTxtWithTitle} ${warningsTxtWithTitle}`;
|
|
317
316
|
}
|
|
318
317
|
|
|
319
318
|
function stringifyIncludedEnvs(includedEnvs: string[] = [], verbose = false) {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { configBaseFactory } from '@teambit/react.webpack.react-webpack';
|
|
2
|
+
|
|
3
|
+
import type { Configuration } from 'webpack';
|
|
4
|
+
import { ProvidePlugin } from 'webpack';
|
|
5
|
+
import { merge } from 'webpack-merge';
|
|
6
|
+
import { fallbacksProvidePluginConfig, fallbacks } from '@teambit/webpack';
|
|
7
|
+
import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
|
|
8
|
+
|
|
9
|
+
export function createWebpackConfig(outputDir: string, entryFile: string): Configuration {
|
|
10
|
+
const baseConfig = configBaseFactory(true);
|
|
11
|
+
const preBundleConfig = createPreBundleConfig(outputDir, entryFile);
|
|
12
|
+
|
|
13
|
+
const combined = merge(baseConfig, preBundleConfig);
|
|
14
|
+
|
|
15
|
+
return combined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function createPreBundleConfig(outputDir: string, entryFile: string) {
|
|
19
|
+
const mode = process.env.BIT_DEBUG_PREVIEW_BUNDLE ? 'development' : 'production';
|
|
20
|
+
const preBundleConfig: Configuration = {
|
|
21
|
+
stats: {
|
|
22
|
+
children: true,
|
|
23
|
+
errorDetails: true,
|
|
24
|
+
},
|
|
25
|
+
mode,
|
|
26
|
+
entry: {
|
|
27
|
+
main: entryFile,
|
|
28
|
+
},
|
|
29
|
+
resolve: {
|
|
30
|
+
alias: {
|
|
31
|
+
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
|
|
32
|
+
react: require.resolve('react'),
|
|
33
|
+
'react-dom': require.resolve('react-dom'),
|
|
34
|
+
},
|
|
35
|
+
fallback: {
|
|
36
|
+
module: false,
|
|
37
|
+
path: fallbacks.path,
|
|
38
|
+
dgram: false,
|
|
39
|
+
dns: false,
|
|
40
|
+
fs: false,
|
|
41
|
+
stream: false,
|
|
42
|
+
http2: false,
|
|
43
|
+
net: false,
|
|
44
|
+
tls: false,
|
|
45
|
+
child_process: false,
|
|
46
|
+
process: fallbacks.process,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
output: {
|
|
50
|
+
path: outputDir,
|
|
51
|
+
publicPath: '/',
|
|
52
|
+
chunkFilename: 'static/js/[name].[contenthash:8].chunk.cjs',
|
|
53
|
+
filename: 'static/js/[name].[contenthash:8].cjs',
|
|
54
|
+
library: {
|
|
55
|
+
type: 'commonjs-static',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
externalsType: 'commonjs',
|
|
59
|
+
externals: ['react', 'react-dom', '@mdx-js/react', '@teambit/mdx.ui.mdx-scope-context'],
|
|
60
|
+
plugins: [
|
|
61
|
+
// Generate an asset manifest file with the following content:
|
|
62
|
+
// - "files" key: Mapping of all asset filenames to their corresponding
|
|
63
|
+
// output file so that tools can pick it up without having to parse
|
|
64
|
+
// `index.html`
|
|
65
|
+
// can be used to reconstruct the HTML if necessary
|
|
66
|
+
new WebpackManifestPlugin({
|
|
67
|
+
fileName: 'asset-manifest.json',
|
|
68
|
+
generate: (seed, files, entrypoints) => {
|
|
69
|
+
const manifestFiles = files.reduce((manifest, file) => {
|
|
70
|
+
manifest[file.name] = file.path;
|
|
71
|
+
return manifest;
|
|
72
|
+
}, seed);
|
|
73
|
+
const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));
|
|
74
|
+
|
|
75
|
+
// @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276
|
|
76
|
+
return {
|
|
77
|
+
files: manifestFiles,
|
|
78
|
+
entrypoints: entrypointFiles,
|
|
79
|
+
} as Record<string, string>;
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
|
|
83
|
+
new ProvidePlugin({ process: fallbacksProvidePluginConfig.process }),
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return preBundleConfig;
|
|
88
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.frame\.module__overlayBorder--ZGRhZ{box-sizing:border-box;border:2px solid var(--bit-highlighter-color,#eebcc9);pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:11px;padding:4px}.frame\.module__hidden--ZGRhZ{display:none}.label\.module__othersContainer--YmMyZ>*{margin-bottom:8px}.label\.module__othersContainer--YmMyZ>:last-child{margin-bottom:unset}.label\.module__othersTooltip--YmMyZ{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.label\.module__othersTooltip--YmMyZ:before{content:"▾";transition:transform .3s;display:inline-block}.label\.module__othersTooltip--YmMyZ.label\.module__active--YmMyZ:before{transform:rotate(-180deg)}.label\.module__hidden--YmMyZ{visibility:hidden;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.component-strip\.module__componentStrip--XzUyN{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;box-shadow:var(--bit-highlighter-shadow);white-space:nowrap;border-radius:.5em;display:flex}.component-strip\.module__componentStrip--XzUyN>*{background:var(--bit-highlighter-color,#eebcc9);margin-right:.125em;padding:0 .5em;line-height:1.5;transition:-webkit-filter .3s,filter .3s,background-color .3s;transform:translateZ(0)}.component-strip\.module__componentStrip--XzUyN>:link,.component-strip\.module__componentStrip--XzUyN>:visited{-webkit-text-decoration:inherit;text-decoration:inherit;color:inherit}.component-strip\.module__componentStrip--XzUyN>:link:hover,.component-strip\.module__componentStrip--XzUyN>:visited:hover{background:var(--bit-highlighter-color-hover,#f6dae2)}.component-strip\.module__componentStrip--XzUyN>:link:active,.component-strip\.module__componentStrip--XzUyN>:visited:active{background:var(--bit-highlighter-color-active,#e79db1);color:inherit}.component-strip\.module__componentStrip--XzUyN>:first-child{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.component-strip\.module__componentStrip--XzUyN>:last-child{margin-right:unset;border-top-right-radius:.5em;border-bottom-right-radius:.5em}.component-strip\.module__nameBlock--XzUyN{display:flex}.component-strip\.module__nameBlock--XzUyN .component-strip\.module__version--XzUyN{text-overflow:ellipsis;white-space:nowrap;max-width:13ch;transition:max-width .48s;overflow:hidden}.component-strip\.module__nameBlock--XzUyN .component-strip\.module__version--XzUyN:hover{max-width:61ch}.element-highlighter\.module__label--XzQ2N{padding:8px}.element-highlighter\.module__frame--XzQ2N,.element-highlighter\.module__label--XzQ2N{z-index:15500}.highlighter-provider\.module__highlighter--XzBjO{border:solid var(--bit-border-color-lightest,#ededed);box-sizing:border-box;border-width:0;height:100%;transition:border .3s}.highlighter-provider\.module__highlighter--XzBjO.highlighter-provider\.module__active--XzBjO{border-width:8px;overflow:auto}.highlighter-provider\.module__label--XzBjO{font-family:sans-serif;font-size:12px}
|