@moneko/core 3.0.0-beta.32 → 3.0.0-beta.34

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/lib/common.js CHANGED
@@ -98,6 +98,25 @@ const defaultConfig = {
98
98
  jsxImportSource: jsxImportSource,
99
99
  remarkPlugins: [],
100
100
  rehypePlugins: []
101
+ },
102
+ jsxDomExpressions: {
103
+ moduleName: 'solid-js/web',
104
+ builtIns: [
105
+ 'For',
106
+ 'Show',
107
+ 'Switch',
108
+ 'Match',
109
+ 'Suspense',
110
+ 'SuspenseList',
111
+ 'Portal',
112
+ 'Index',
113
+ 'Dynamic',
114
+ 'ErrorBoundary'
115
+ ],
116
+ contextToCustomElements: true,
117
+ wrapConditionals: true,
118
+ generate: 'dom',
119
+ hydratable: false
101
120
  }
102
121
  };
103
122
  export const log = (msg)=>{
package/lib/routes.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const frameworkCacheDir: "~/node_modules/@moneko/react/.cache/" | "~/node_modules/@moneko/solid-js/.cache/";
1
+ export declare const frameworkCacheDir: ".git/";
package/lib/routes.js CHANGED
@@ -1,9 +1,9 @@
1
- import { readdirSync, statSync, writeFile, readFileSync, existsSync, mkdirSync } from 'fs';
1
+ import { readdirSync, statSync, writeFile, readFileSync, existsSync, mkdirSync, unlinkSync } from 'fs';
2
2
  import { join, relative } from 'path';
3
3
  import { watch } from 'chokidar';
4
4
  import { load } from 'js-yaml';
5
5
  import { PROGRAMPATH, APPTYPE, FRAMEWORK, DEV } from './process-env.js';
6
- import { resolveNodeModulesPath } from './utils.js';
6
+ import { resolveProgramPath } from './utils.js';
7
7
  const frontmatterRegex = /^---\n([\s\S]+?)\n---\n/;
8
8
  function extractFrontmatter(md) {
9
9
  const matches = md.match(frontmatterRegex);
@@ -85,7 +85,7 @@ function getTree(directory, option) {
85
85
  }, []);
86
86
  }
87
87
  const compPath = join(PROGRAMPATH, './components');
88
- export const frameworkCacheDir = resolveNodeModulesPath(`@moneko/${FRAMEWORK}/.cache/`);
88
+ export const frameworkCacheDir = resolveProgramPath(`.git/`);
89
89
  let genLibRouteTimer;
90
90
  function fallback(err) {
91
91
  if (err) {
@@ -113,7 +113,7 @@ function generatorLibraryRouter() {
113
113
  if (!existsSync(frameworkCacheDir)) {
114
114
  mkdirSync(frameworkCacheDir);
115
115
  }
116
- writeFile(join(frameworkCacheDir, 'router.js'), `${prefixStr}export default ${tree}`, 'utf-8', fallback);
116
+ writeFile(join(frameworkCacheDir, 'route.js'), `${prefixStr}export default ${tree}`, 'utf-8', fallback);
117
117
  }, 100);
118
118
  }
119
119
  let genLibDemoTimer;
@@ -136,7 +136,7 @@ function generatorLibraryDemo() {
136
136
  if (!existsSync(frameworkCacheDir)) {
137
137
  mkdirSync(frameworkCacheDir);
138
138
  }
139
- writeFile(join(frameworkCacheDir, 'examples.js'), `export default ${JSON.stringify(tree)}`, 'utf-8', fallback);
139
+ writeFile(join(frameworkCacheDir, 'example.js'), `export default ${JSON.stringify(tree)}`, 'utf-8', fallback);
140
140
  }, 100);
141
141
  }
142
142
  function watchFiles(root, ignored, call) {
@@ -169,3 +169,12 @@ if (APPTYPE === 'library') {
169
169
  generatorLibraryDemo();
170
170
  }
171
171
  }
172
+ process.on('SIGINT', function() {
173
+ try {
174
+ unlinkSync(join(frameworkCacheDir, 'example.js'));
175
+ } catch (error) {}
176
+ try {
177
+ unlinkSync(join(frameworkCacheDir, 'route.js'));
178
+ } catch (error) {}
179
+ process.exit();
180
+ });
package/lib/swcrc.js CHANGED
@@ -92,6 +92,10 @@ export default ((isDev = false)=>{
92
92
  [
93
93
  'swc-plugin-another-transform-imports',
94
94
  transformConfigs(CONFIG.importOnDemand || {})
95
+ ],
96
+ [
97
+ '@moneko/jsx-dom-expressions',
98
+ CONFIG.jsxDomExpressions || {}
95
99
  ]
96
100
  ]
97
101
  }
package/lib/utils.d.ts CHANGED
@@ -2,7 +2,7 @@ export declare function tfc(filepath: string): string;
2
2
  export declare function readConf(src: string, name: string): Promise<any>;
3
3
  export declare function toUpperCaseString(string: string): string;
4
4
  export declare function getIPAdress(): string | undefined | void;
5
- type ProgramPath<T extends string> = `~/${T extends string ? T : string}`;
5
+ type ProgramPath<T extends string> = `${T extends string ? T : string}`;
6
6
  type NodeModulesPath<T> = ProgramPath<`node_modules/${T extends string ? T : string}`>;
7
7
  /** 位于项目根目录下的位置
8
8
  * @param {string} src 路径
@@ -13,7 +13,7 @@ export declare function resolveProgramPath<T extends string>(src: T): ProgramPat
13
13
  * @param {string} src 路径
14
14
  * @returns {string} 位于项目根目录node_modules下的位置
15
15
  */
16
- export declare const resolveNodeModulesPath: <T extends string>(src: T) => `~/${`node_modules/${T extends string ? T : string}` extends infer T_1 ? T_1 extends `node_modules/${T extends string ? T : string}` ? T_1 extends string ? T_1 : string : never : never}`;
16
+ export declare const resolveNodeModulesPath: <T extends string>(src: T) => `${`node_modules/${T extends string ? T : string}` extends infer T_1 ? T_1 extends `node_modules/${T extends string ? T : string}` ? T_1 extends string ? T_1 : string : never : never}`;
17
17
  /** 获取模块真实入口位置
18
18
  * @param {string} url 路径
19
19
  * @returns {string} 模块真实入口路径
@@ -1,4 +1,3 @@
1
- import './routes.js';
2
1
  import type { WebpackConfiguration } from 'webpack-dev-server';
3
2
  export declare const outputConfig: WebpackConfiguration['output'];
4
3
  declare const config: WebpackConfiguration;
@@ -11,7 +11,7 @@ import htmlPluginOption from './html-plugin-option.js';
11
11
  import { moduleFederation } from './module-federation.js';
12
12
  import moduleConfig from './module.config.js';
13
13
  import { APPTYPE, DEV, hasEslintConfig, hasStylelintConfig, PACKAGENAME, PROGRAMPATH, FRAMEWORK } from './process-env.js';
14
- import './routes.js';
14
+ import { frameworkCacheDir } from './routes.js';
15
15
  import { seo } from './seo.js';
16
16
  import { resolveNodeModulesPath, resolveProgramPath } from './utils.js';
17
17
  const eslintrc = [
@@ -48,7 +48,8 @@ if (!hasStylelint) {
48
48
  const StylelintPlugin = hasStylelint ? (await import('stylelint-webpack-plugin')).default : null;
49
49
  const ESLintPlugin = hasEslint ? (await import('eslint-webpack-plugin')).default : null;
50
50
  const alias = {
51
- '@': resolveProgramPath('src')
51
+ '@': resolveProgramPath('src'),
52
+ '@framework-cache-dir': frameworkCacheDir
52
53
  };
53
54
  Object.assign(alias, CONFIG.alias);
54
55
  if (APPTYPE === 'library') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.0.0-beta.32",
3
+ "version": "3.0.0-beta.34",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -13,48 +13,49 @@
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
15
  "@mdx-js/loader": "2.3.0",
16
+ "@moneko/jsx-dom-expressions": "0.1.0",
16
17
  "@soda/friendly-errors-webpack-plugin": "1.8.1",
17
- "@swc/core": "1.3.56",
18
+ "@swc/core": "1.3.62",
18
19
  "@swc/css": "0.0.20",
19
20
  "@swc/helpers": "0.5.1",
20
21
  "add-asset-html-webpack-plugin": "6.0.0",
21
- "core-js": "3.30.2",
22
+ "core-js": "3.31.0",
22
23
  "cross-env": "7.0.3",
23
- "css-loader": "6.7.3",
24
- "css-minimizer-webpack-plugin": "5.0.0",
24
+ "css-loader": "6.8.1",
25
+ "css-minimizer-webpack-plugin": "5.0.1",
25
26
  "css-unicode-loader": "1.0.3",
26
27
  "external-remotes-plugin": "1.0.0",
27
- "html-webpack-plugin": "5.5.1",
28
+ "html-webpack-plugin": "5.5.3",
28
29
  "less": "4.1.3",
29
- "less-loader": "11.1.0",
30
- "mini-css-extract-plugin": "2.7.5",
30
+ "less-loader": "11.1.3",
31
+ "mini-css-extract-plugin": "2.7.6",
31
32
  "mini-svg-data-uri": "1.4.4",
32
33
  "path-to-regexp": "6.2.1",
33
34
  "portfinder": "1.0.32",
34
- "style-loader": "3.3.2",
35
+ "style-loader": "3.3.3",
35
36
  "style-resources-loader": "1.5.0",
36
37
  "swc-loader": "0.2.3",
37
- "swc-plugin-another-transform-imports": "0.2.3",
38
+ "swc-plugin-another-transform-imports": "0.2.4",
38
39
  "ts-import-plugin": "3.0.0",
39
- "ts-loader": "9.4.2",
40
- "typescript": "5.0.4",
40
+ "ts-loader": "9.4.3",
41
+ "typescript": "5.1.3",
41
42
  "webpack": "5.76.1",
42
- "webpack-bundle-analyzer": "4.8.0",
43
+ "webpack-bundle-analyzer": "4.9.0",
43
44
  "webpack-cli": "5.1.1",
44
45
  "webpack-dev-server": "4.15.0",
45
- "webpack-merge": "5.8.0",
46
+ "webpack-merge": "5.9.0",
46
47
  "webpackbar": "5.0.2",
47
- "xml2js": "0.5.0"
48
+ "xml2js": "0.6.0"
48
49
  },
49
50
  "devDependencies": {
50
- "@moneko/mock": "^1.0.9",
51
+ "@moneko/mock": "^1.0.10",
51
52
  "@moneko/postcss": "^1.0.30",
52
53
  "@swc/cli": "0.1.62",
53
54
  "@types/js-yaml": "^4.0.5",
54
55
  "@types/mini-css-extract-plugin": "^2.5.1",
55
56
  "@types/shelljs": "^0.8.12",
56
57
  "@types/webpack-bundle-analyzer": "^4.6.0",
57
- "@types/webpack-env": "^1.18.0",
58
+ "@types/webpack-env": "^1.18.1",
58
59
  "eslint-config-neko": "^1.0.23",
59
60
  "shelljs": "^0.8.5",
60
61
  "stylelint-config-moneko": "^1.0.15"
@@ -264,6 +264,14 @@ export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
264
264
  /** 📦 打包完成 */
265
265
  done?: () => void;
266
266
  mdx?: MDXOptions;
267
+ jsxDomExpressions?: {
268
+ moduleName?: string;
269
+ builtIns?: string[];
270
+ contextToCustomElements?: boolean;
271
+ wrapConditionals?: boolean;
272
+ generate?: 'ssr' | 'dom';
273
+ hydratable?: boolean;
274
+ };
267
275
  };
268
276
  export declare interface ModuleFederationOption {
269
277
  /** 模块名称,唯一性,不能重名 */