@flatjs/evolve 2.3.0 → 2.3.2-next.0

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.
@@ -1 +1 @@
1
- import webpack from"webpack";import{logger,mergeOptions}from"@flatjs/common";import{createTsCheckerCompilerConfig}from"@flatjs/forge-ts-checker";import{isVueEntryItem}from"../helpers/is-vue-entry-item.js";export const createBuildServerGlobalCompiler=async e=>{const{entryMap:r,globalCompilerOptions:o,projectCwd:t,devServer:i}=e;if(isVueEntryItem(r))return;const p=mergeOptions({serveMode:!0,projectCwd:t,runTsChecker:o?.runTsChecker},{watchOptions:{ignored:i?.watchOptions?.ignored,poll:i?.watchOptions?.poll}}),n=createTsCheckerCompilerConfig(p);return n?webpack(n,(e=>{e&&logger.error(e)})):void 0};
1
+ import webpack from"webpack";import{logger}from"@flatjs/common";import{createTsCheckerCompilerConfig}from"@flatjs/forge-ts-checker";import{isVueEntryItem}from"../helpers/is-vue-entry-item.js";export const createBuildServerGlobalCompiler=async e=>{const{entryMap:r,globalCompilerOptions:o,projectCwd:t,devServer:c}=e;if(isVueEntryItem(r))return;const i=createTsCheckerCompilerConfig({serveMode:!0,projectCwd:t,runTsChecker:o?.runTsChecker,watchOptions:c?.watchOptions||{}});return i?webpack(i,(e=>{e&&logger.error(e)})):void 0};
@@ -1 +1 @@
1
- import{mergeOptions}from"@flatjs/common";import{createTsCheckerCompiler}from"@flatjs/forge-ts-checker";import{isVueEntryItem}from"../helpers/is-vue-entry-item.js";export const createGlobalCompiler=async(e,r)=>{const{entryMap:t,globalCompilerOptions:o,projectCwd:s,devServer:i}=r,n=mergeOptions({serveMode:e,projectCwd:s,runTsChecker:o?.runTsChecker},{runTsChecker:!isVueEntryItem(t),watchOptions:{ignored:i?.watchOptions?.ignored,poll:i?.watchOptions?.poll}});return await createTsCheckerCompiler(n)};
1
+ import{createTsCheckerCompiler}from"@flatjs/forge-ts-checker";import{isVueEntryItem}from"../helpers/is-vue-entry-item.js";export const createGlobalCompiler=async(e,r)=>{const{entryMap:t,globalCompilerOptions:o,projectCwd:s,devServer:c}=r;if(isVueEntryItem(t))return!1;const i={serveMode:e,projectCwd:s,runTsChecker:o?.runTsChecker,watchOptions:c?.watchOptions||{}};return await createTsCheckerCompiler(i)};
@@ -1 +1 @@
1
- import{join}from"node:path";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{resolvePublicPath}from"./resolve-public-path.js";export const createOutput=async(e,t,o)=>{const{projectCwd:n,webpack:a}=t,i=o[1],p=resolvePublicPath(t),u="function"==typeof a?.outputDir?await a.outputDir():a?.outputDir||"public";return{devtoolModuleFilenameTemplate:({namespace:e,resourcePath:t})=>`webpack:///${join(e,t)}`,environment:{},pathinfo:!1,path:join(n,u),publicPath:p,filename:`[name]/${getBundleFileName("js",e,a?.enableBundleHashName)}`,chunkFilename:"[id].[contenthash].js",...i.options?.output}};
1
+ import{join}from"node:path";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{resolvePublicPath}from"./resolve-public-path.js";export const createOutput=async(e,o,t)=>{const{projectCwd:n,webpack:a}=o,l=t[1],i=enableBundleHashNameForModule(o,l?.options),u=resolvePublicPath(o),p="function"==typeof a?.outputDir?await a.outputDir():a?.outputDir||"public";return{devtoolModuleFilenameTemplate:({namespace:e,resourcePath:o})=>`webpack:///${join(e,o)}`,environment:{},pathinfo:!1,path:join(n,p),publicPath:u,filename:`[name]/${getBundleFileName("js",e,i)}`,chunkFilename:i?"[id].[contenthash].js":"[id].js",...l.options?.output}};
@@ -1 +1 @@
1
- import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createCircularDependencyPlugin}from"../plugins/circular-dependency/index.js";import{createCleanWebpackPlugin}from"../plugins/clean-webpack/index.js";import{createBuiltinDefineVariables}from"../plugins/define-variable/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";import{createStatsWebpackPlugin}from"../plugins/stats-webpack/index.js";export const createPlugins=async(e,a,n,i)=>{const r=a[0],[l,t]=r,s=enableBundleHashNameForModule(n,t?.options),o=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,n),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,s)}`,chunkFilename:"[id].[contenthash].css"}),...await createBuiltinDefineVariables(e,n),...createCleanWebpackPlugin(e,a,n),...createModuleFederationPlugin(e,a,n),...createHtmlPlugins(e,a,n),...createStatsWebpackPlugin(e,n,i)],c=shouldEnableReactFastRefresh(e,r,n);c&&o.push(new ReactRefreshWebpackPlugin({overlay:!1})),!c&&e&&(n.devServer?.liveReload?logger.warn('The HMR disabled cause of "liveReload" specificed'):logger.warn(`The HMR disabled cause of \`"moduleFederation":"${l}"\``));const u=n.webpack?.plugins||[];return o.concat(u)};
1
+ import CaseSensitivePathsPlugin from"case-sensitive-paths-webpack-plugin";import MiniCssExtractPlugin from"mini-css-extract-plugin";import webpack from"webpack";import{logger}from"@flatjs/common";import ReactRefreshWebpackPlugin from"@pmmmwh/react-refresh-webpack-plugin";import{enableBundleHashNameForModule}from"../helpers/enable-bundle-hashname-for-module.js";import{getBundleFileName}from"../helpers/get-bundle-file-name.js";import{shouldEnableReactFastRefresh}from"../helpers/should-enable-react-fast-refresh.js";import{createCircularDependencyPlugin}from"../plugins/circular-dependency/index.js";import{createCleanWebpackPlugin}from"../plugins/clean-webpack/index.js";import{createBuiltinDefineVariables}from"../plugins/define-variable/index.js";import{createModuleFederationPlugin}from"../plugins/module-federation/index.js";import{createHtmlPlugins}from"../plugins/multi-html/index.js";import{createStatsWebpackPlugin}from"../plugins/stats-webpack/index.js";export const createPlugins=async(e,a,i,n)=>{const r=a[0],[l,t]=r,s=enableBundleHashNameForModule(i,t?.options),c=[new webpack.WatchIgnorePlugin({paths:[/\.d\.[cm]ts$/]}),new CaseSensitivePathsPlugin,...createCircularDependencyPlugin(e,i),new MiniCssExtractPlugin({filename:`[name]/${getBundleFileName("css",e,s)}`,chunkFilename:s?"[id].[contenthash].css":"[id].css"}),...await createBuiltinDefineVariables(e,i),...createCleanWebpackPlugin(e,a,i),...createModuleFederationPlugin(e,a,i),...createHtmlPlugins(e,a,i),...createStatsWebpackPlugin(e,i,n)],o=shouldEnableReactFastRefresh(e,r,i);o&&c.push(new ReactRefreshWebpackPlugin({overlay:!1})),!o&&e&&(i.devServer?.liveReload?logger.warn('The HMR disabled cause of "liveReload" specificed'):logger.warn(`The HMR disabled cause of \`"moduleFederation":"${l}"\``));const u=i.webpack?.plugins||[];return c.concat(u)};
@@ -1 +1 @@
1
- import{normalizePageProxy}from"../helpers/normalize-page-proxy.js";import{createPageMiddleware,createPublicAssetsMiddleware}from"./middlewares/index.js";export const createAppPageRoute=(e,r,a,o,i)=>{const{devServer:s}=i,t=normalizePageProxy(s?.pageProxy||"/pages");r.use(t,...createPageMiddleware(a,s?.mockOptions?.apiContext||"api",o,i)),r.use("*",createPublicAssetsMiddleware(e,t))};
1
+ import{normalizePageProxy}from"../helpers/normalize-page-proxy.js";import{createPageMiddleware,createPublicAssetsMiddleware}from"./middlewares/index.js";export const createAppPageRoute=(e,r,a,o,s)=>{const{devServer:t}=s,i=normalizePageProxy(t?.pageProxy||"/pages");r.use(i,...createPageMiddleware(a,t?.mockOptions?.apiContext||"api",o,s)),r.use("*splat",createPublicAssetsMiddleware(e,i))};
@@ -1 +1 @@
1
- import{cdnFinder}from"./script-injects.js";export const getRuntimeCDNBase=(n,e,i="")=>{const t=[`\n (function () {\n var flatjsMultiCdn = {\n cdnConfig: ${JSON.stringify(n||{})},\n cdnResolver: ${e.toString()},\n cdnFinder: ${cdnFinder.toString()}\n };\n var runtimeCDNBase = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig, flatjsMultiCdn.cdnResolver);\n window.$evolve = window.$evolve || {};\n window.$evolve.runtimeCDNBase=runtimeCDNBase;\n `];return i&&t.push(`${i} = runtimeCDNBase || ${i};`),t.push("})();"),t.join("\n")};
1
+ import{cdnFinder}from"./script-injects.js";export const getRuntimeCDNBase=(n,e,i="")=>{const t=[`\n (function () {\n var flatjsMultiCdn = {\n cdnConfig: ${JSON.stringify(n||{})},\n cdnResolver: ${e.toString()},\n cdnFinder: ${cdnFinder.toString()}\n };\n var runtimeCDNBase = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig, flatjsMultiCdn.cdnResolver);\n window.$evolve = window.$evolve || {};\n if (window.$evolve.runtimeCDNBase) {\n // Use injected runtimeCDNBase as higher priority, e.g we have native webview runtime base URL.\n runtimeCDNBase = window.$evolve.runtimeCDNBase;\n } else {\n window.$evolve.runtimeCDNBase = runtimeCDNBase;\n }\n `];return i&&t.push(`${i} = runtimeCDNBase || ${i};`),t.push("})();"),t.join("\n")};
@@ -1,4 +1,3 @@
1
- import type { BabelFile } from '@babel/core';
2
1
  /**
3
2
  * Buildin plugin `@flatjs/babel-plugin-import` configurations
4
3
  */
@@ -24,9 +23,16 @@ export type ModularImportOption = {
24
23
  fileName?: string;
25
24
  /**
26
25
  * We can use customName to customize import file path.
27
- * @example `esm/modal`
26
+ *
27
+ * If you want to use swc-loader, the return value must be a fixed string, dynamic results are not currently supported.
28
+ *
29
+ * @param transformedMethodName - The name of the method to be imported.
30
+ * @param internalModulePath - The path of the module that is being imported.
31
+ * e.g. `@dimjs/utils/dist/debounce/debounce.js`
32
+ *
33
+ * @example `import '@dimjs/lang/dist/is-empty.js';`
28
34
  */
29
- customName?: (transformedMethodName: string, file: BabelFile, absFilePath?: string) => string;
35
+ customName?: (transformedMethodName: string, internalModulePath?: string) => string;
30
36
  /**
31
37
  * @default: true
32
38
  */
@@ -34,6 +40,7 @@ export type ModularImportOption = {
34
40
  /**
35
41
  * @default false
36
42
  * @example (name) => `${name}/style/2x` | `boolean` }
43
+ * @deprecated Recommended to use the css in js solution
37
44
  */
38
45
  style?: true | 'css' | ((name: string, file: Record<string, unknown>) => string | boolean);
39
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "2.3.0",
3
+ "version": "2.3.2-next.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -43,13 +43,13 @@
43
43
  "@babel/core": "^7.26.10",
44
44
  "@clack/prompts": "^0.10.1",
45
45
  "@discoveryjs/json-ext": "0.6.3",
46
- "@flatjs/babel-plugin-import": "2.2.8",
46
+ "@flatjs/babel-plugin-import": "2.2.9-next.0",
47
47
  "@flatjs/common": "2.2.3",
48
48
  "@flatjs/evolve-preset-babel": "2.2.3",
49
49
  "@flatjs/forge-postcss-plugin-pixel": "2.2.3",
50
- "@flatjs/forge-ts-checker": "1.1.0",
51
- "@flatjs/graph": "2.2.8",
52
- "@flatjs/mock": "2.4.0",
50
+ "@flatjs/forge-ts-checker": "1.1.1",
51
+ "@flatjs/graph": "2.2.9-next.0",
52
+ "@flatjs/mock": "2.4.1-next.0",
53
53
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.16",
54
54
  "@types/babel__core": "^7.20.5",
55
55
  "babel-loader": "^10.0.0",