@moneko/core 3.0.0-beta.12 → 3.0.0-beta.14

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 e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as o,PUBLICPATH as t}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import l from"./modifyVars.js";import{APPTYPE as a,DEV as i,pkgName as c}from"./process-env.js";import n from"./swcrc.js";import p from"./tsloader.config.js";import{resolveNodeModulesPath as m,resolveProgramPath as d}from"./utils.js";let u="single-spa"===a?t:"../",f={loader:e.loader,options:{publicPath:"/"!==u?u:"../"}},y=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:await import("@moneko/postcss")}};i&&(f="style-loader");let x=[...o.cssModules,c,"neko-ui"].map(m),g=[m(`${c}/lib/styles/eval/*.less`),...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(d)],j=["components","example","mock","site","src"].map(d),$=[f,{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=x.length;s<o;s++)if(e&&e?.includes(x[s]))return/(.*(?<!\.global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},y,"css-unicode-loader",{loader:"less-loader",options:{sourceMap:!!o.sourceMap,lessOptions:{modifyVars:l,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:g}}].filter(Boolean),b={loader:"tsc"===o.compiler?"ts-loader":"swc-loader",options:"tsc"===o.compiler?p:n(i)},h={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:$,include:j.concat(o.rulesInclude?.less?.map(m)||[])},{test:/\.css$/,use:[f,"css-loader",y,"css-unicode-loader"].filter(Boolean),include:j.concat(o.rulesInclude?.css?.map(m)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:j.concat(o.rulesInclude?.media?.map(m)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:j.concat(o.rulesInclude?.fonts?.map(m)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.txt$/,type:"asset/source"},{test:/\.(cj|mj|t|j)s(|x)$/,use:[...o.prefixJsLoader,b].filter(Boolean),include:j.concat(o.rulesInclude?.js?.map(m)||[])},{test:/\.mdx?$/,use:[...o.prefixJsLoader,b,{loader:"@mdx-js/loader",options:{jsxImportSource:"solid-js/h",rehypePlugins:[[await import("@mapbox/rehype-prism"),{ignore:!0}],(await import("rehype-accessible-emojis")).rehypeAccessibleEmojis,await import("rehype-figure")],remarkPlugins:[]}}].filter(Boolean),include:j,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...o.moduleRules]};export default h;
1
+ import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import o from"remark-frontmatter";import t from"remark-gfm";import r from"remark-mdx-frontmatter";import{CONFIG as a,PUBLICPATH as l}from"./common.js";import{hasPkg as i}from"./has-pkg.js";import m from"./modifyVars.js";import{APPTYPE as n,DEV as c,pkgName as p}from"./process-env.js";import d from"./swcrc.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";let x="single-spa"===n?l:"../",g={loader:e.loader,options:{publicPath:"/"!==x?x:"../"}},j=i("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:await import("@moneko/postcss")}};c&&(g="style-loader");let $=[...a.cssModules,p,"neko-ui"].map(f),b=[f(`${p}/lib/styles/eval/*.less`),...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(y)],h=["components","example","mock","site","src"].map(y),w=[g,{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=$.length;s<o;s++)if(e&&e?.includes($[s]))return/(.*(?<!\.global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},j,"css-unicode-loader",{loader:"less-loader",options:{sourceMap:!!a.sourceMap,lessOptions:{modifyVars:m,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:b}}].filter(Boolean),k={loader:"tsc"===a.compiler?"ts-loader":"swc-loader",options:"tsc"===a.compiler?u:d(c)},v={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:w,include:h.concat(a.rulesInclude?.less?.map(f)||[])},{test:/\.css$/,use:[g,"css-loader",j,"css-unicode-loader"].filter(Boolean),include:h.concat(a.rulesInclude?.css?.map(f)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:h.concat(a.rulesInclude?.media?.map(f)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:h.concat(a.rulesInclude?.fonts?.map(f)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.txt$/,type:"asset/source"},{test:/\.(cj|mj|t|j)s(|x)$/,use:[...a.prefixJsLoader,k].filter(Boolean),include:h.concat(a.rulesInclude?.js?.map(f)||[])},{test:/\.mdx?$/,use:[...a.prefixJsLoader,k,{loader:"@mdx-js/loader",options:{jsxImportSource:"solid-js/h",rehypePlugins:[[(await import("@mapbox/rehype-prism")).default,{ignore:!0}],(await import("rehype-accessible-emojis")).rehypeAccessibleEmojis,(await import("rehype-figure")).default],remarkPlugins:[o,[r,{name:"matter"}],t]}}].filter(Boolean),include:h,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...a.moduleRules]};export default v;
@@ -0,0 +1,254 @@
1
+ /* @import url('tailwindcss/utilities'); */
2
+
3
+ html,
4
+ body {
5
+ margin: 0;
6
+ padding: 0;
7
+ inline-size: 100vi;
8
+ font-size: var(--font-size, 14px);
9
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
10
+ Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
11
+ 'Noto Color Emoji', Helvetica, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans';
12
+ color: var(--text-color, rgb(0 0 0 / 65%));
13
+ line-height: 1.8;
14
+ transition-duration: var(--transition-duration, 0.3s);
15
+ transition-property: background-color, color;
16
+ transition-timing-function: var(--transition-timing-function, cubic-bezier(0.94, -0.1, 0.1, 1.2));
17
+ }
18
+
19
+ #root {
20
+ display: flex;
21
+ -webkit-overflow-scrolling: touch;
22
+ }
23
+
24
+ #root > main {
25
+ animation: route-in var(--transition-duration, 0.3s);
26
+ }
27
+
28
+ input,
29
+ textarea {
30
+ caret-color: inherit;
31
+ }
32
+
33
+ h1 {
34
+ margin: 0.67em 0;
35
+ font-size: 2em;
36
+ }
37
+
38
+ hr {
39
+ overflow: visible;
40
+ block-size: 0;
41
+ box-sizing: content-box;
42
+ }
43
+
44
+ pre {
45
+ font-size: 1em;
46
+ font-family: monospace;
47
+ }
48
+
49
+ a {
50
+ text-decoration: none;
51
+ background-color: transparent;
52
+ cursor: pointer;
53
+ }
54
+
55
+ abbr[title] {
56
+ border-block-end: none;
57
+ text-decoration: underline;
58
+ text-decoration: underline dotted;
59
+ }
60
+
61
+ b,
62
+ strong {
63
+ font-weight: bolder;
64
+ }
65
+
66
+ code,
67
+ kbd,
68
+ samp {
69
+ font-size: 1em;
70
+ font-family: monospace;
71
+ }
72
+
73
+ small {
74
+ font-size: 80%;
75
+ }
76
+
77
+ sub,
78
+ sup {
79
+ position: relative;
80
+ font-size: 75%;
81
+ line-height: 0;
82
+ vertical-align: baseline;
83
+ }
84
+
85
+ sub {
86
+ inset-block-end: -0.25em;
87
+ }
88
+
89
+ sup {
90
+ inset-block-start: -0.5em;
91
+ }
92
+
93
+ img {
94
+ border-style: none;
95
+ }
96
+
97
+ img,
98
+ button {
99
+ outline: 1px solid transparent;
100
+ }
101
+
102
+ button,
103
+ input,
104
+ optgroup,
105
+ select,
106
+ textarea {
107
+ margin: 0;
108
+ font-size: 100%;
109
+ font-family: inherit;
110
+ line-height: 1.15;
111
+ }
112
+
113
+ button,
114
+ input {
115
+ overflow: visible;
116
+ }
117
+
118
+ button,
119
+ select {
120
+ text-transform: none;
121
+ }
122
+
123
+ button,
124
+ [type='button'],
125
+ [type='reset'],
126
+ [type='submit'] {
127
+ appearance: button;
128
+ }
129
+
130
+ button::-moz-focus-inner,
131
+ [type='button']::-moz-focus-inner,
132
+ [type='reset']::-moz-focus-inner,
133
+ [type='submit']::-moz-focus-inner {
134
+ border-style: none;
135
+ padding: 0;
136
+ }
137
+
138
+ button:-moz-focusring,
139
+ [type='button']:-moz-focusring,
140
+ [type='reset']:-moz-focusring,
141
+ [type='submit']:-moz-focusring {
142
+ outline: 1px dotted var(--primary-outline);
143
+ }
144
+
145
+ fieldset {
146
+ padding: 0.35em 0.75em 0.625em;
147
+ }
148
+
149
+ legend {
150
+ display: table;
151
+ padding: 0;
152
+ max-inline-size: 100%;
153
+ white-space: normal;
154
+ color: inherit;
155
+ box-sizing: border-box;
156
+ }
157
+
158
+ progress {
159
+ vertical-align: baseline;
160
+ }
161
+
162
+ textarea {
163
+ overflow: auto;
164
+ }
165
+
166
+ details {
167
+ display: block;
168
+ }
169
+
170
+ summary {
171
+ display: list-item;
172
+ }
173
+
174
+ template,
175
+ [hidden] {
176
+ display: none;
177
+ }
178
+
179
+ [type='checkbox'],
180
+ [type='radio'] {
181
+ box-sizing: border-box;
182
+ padding: 0;
183
+ }
184
+
185
+ [type='number']::-webkit-inner-spin-button,
186
+ [type='number']::-webkit-outer-spin-button {
187
+ block-size: auto;
188
+ }
189
+
190
+ [type='search'] {
191
+ appearance: textfield;
192
+ outline-offset: -2px;
193
+ }
194
+
195
+ [type='search']::-webkit-search-decoration {
196
+ appearance: none;
197
+ }
198
+
199
+ ::-webkit-file-upload-button {
200
+ appearance: button;
201
+ font: inherit;
202
+ }
203
+
204
+ ::-webkit-scrollbar {
205
+ inline-size: 4px;
206
+ block-size: 4px;
207
+ }
208
+
209
+ ::-webkit-scrollbar-track,
210
+ ::-webkit-scrollbar-thumb {
211
+ border-radius: 5px;
212
+ background-color: transparent;
213
+ }
214
+
215
+ :hover::-webkit-scrollbar-thumb {
216
+ background-color: var(--primary-selection);
217
+ }
218
+
219
+ ::-webkit-scrollbar-thumb:hover {
220
+ background-color: var(--primary-hover);
221
+ }
222
+
223
+ ::-webkit-scrollbar-thumb:active {
224
+ background-color: var(--primary-active);
225
+ }
226
+
227
+ ::-webkit-scrollbar-button {
228
+ display: none;
229
+ }
230
+
231
+ @keyframes route-in {
232
+ from {
233
+ transform: translate3d(0, 16px, 0);
234
+ opacity: 0;
235
+ }
236
+
237
+ to {
238
+ transform: translate3d(0, 0, 0);
239
+ opacity: 1;
240
+ }
241
+ }
242
+
243
+ @keyframes route-out {
244
+ from {
245
+ transform: translate3d(0, 0, 0);
246
+ opacity: 1;
247
+ }
248
+
249
+ to {
250
+ z-index: -1;
251
+ transform: translate3d(0, 1rem, 0);
252
+ opacity: 0;
253
+ }
254
+ }
@@ -1,7 +1,6 @@
1
1
  import { Router } from '@solidjs/router';
2
2
  import { render } from 'solid-js/web';
3
3
  import App from '@/index';
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-unused-vars
5
4
  function isFunction(target) {
6
5
  return [
7
6
  '[object Function]',
@@ -13,18 +12,17 @@ function isFunction(target) {
13
12
  const appEntry = APPENTRY ? await import(APPENTRY) : null;
14
13
  const container = document.getElementById('root');
15
14
  if (appEntry && isFunction(appEntry.bootstrap)) {
16
- appEntry.bootstrap?.();
15
+ appEntry.bootstrap();
17
16
  }
18
- const Main = () => (<Router>
19
- <App />
20
- </Router>);
21
17
  window.rootInstance = {
22
18
  unmount: () => null,
23
- render(ele) {
24
- window.rootInstance.unmount = render(ele, container);
19
+ render() {
20
+ window.rootInstance.unmount = render(() => (<Router>
21
+ <App />
22
+ </Router>), container);
25
23
  },
26
24
  };
27
- window.rootInstance.render(Main);
25
+ window.rootInstance.render();
28
26
  if (appEntry && isFunction(appEntry.mount)) {
29
- appEntry.mount?.();
27
+ appEntry.mount();
30
28
  }
@@ -35,10 +35,14 @@ export const mdxComponents = {};
35
35
  // return c;
36
36
  // }
37
37
  if (APPTYPE === 'library') {
38
- const models = require.context('@pkg/', true, /README\.mdx?$/);
38
+ const models = import.meta.webpackContext?.('@pkg/', {
39
+ recursive: true,
40
+ regExp: /README\.mdx?$/,
41
+ mode: 'sync',
42
+ });
39
43
  let overrideComps = {};
40
44
  try {
41
- overrideComps = await import('@/components/components');
45
+ overrideComps = (await import('@/components/components')).default;
42
46
  }
43
47
  catch (error) {
44
48
  /* empty */
@@ -65,7 +69,7 @@ if (APPTYPE === 'library') {
65
69
  // pre: pre,
66
70
  ...overrideComps,
67
71
  });
68
- models.keys()?.forEach(function (item) {
72
+ models?.keys()?.forEach(function (item) {
69
73
  const key = item.substring(2).split('/').slice(0, -1).join('/');
70
74
  const { basic, default: Child } = models(item);
71
75
  myPkgs.push({
@@ -79,8 +83,12 @@ if (APPTYPE === 'library') {
79
83
  },
80
84
  });
81
85
  });
82
- const allDemo = require.context('@pkg/', true, /\/examples\/(.+)\.mdx$/);
83
- allDemo.keys()?.forEach(function (e) {
86
+ const allDemo = import.meta.webpackContext?.('@pkg/', {
87
+ recursive: true,
88
+ regExp: /\/examples\/(.+)\.mdx$/,
89
+ mode: 'sync',
90
+ });
91
+ allDemo?.keys()?.forEach(function (e) {
84
92
  const k = e.substring(2), arr = k.split('/'), name = arr[0];
85
93
  if (!Array.isArray(myDemoKv[name])) {
86
94
  myDemoKv[name] = [];
@@ -105,8 +113,7 @@ if (APPTYPE === 'library') {
105
113
  }
106
114
  let list = [];
107
115
  try {
108
- // eslint-disable-next-line @typescript-eslint/no-var-requires
109
- list = require('@/router').default;
116
+ list = (await import('@/router')).default;
110
117
  }
111
118
  catch (error) {
112
119
  // eslint-disable-next-line no-console
@@ -116,7 +123,11 @@ function prefixKey(path, prev) {
116
123
  // eslint-disable-next-line no-undefined
117
124
  return [prev === '*' && path !== '*' ? undefined : prev, path].filter(Boolean).join('/');
118
125
  }
119
- const models = require.context('@/pages/', true, /\.(t|j)sx$/, 'lazy');
126
+ const models = import.meta.webpackContext?.('@/pages/', {
127
+ recursive: true,
128
+ regExp: /\.(t|j)sx$/,
129
+ mode: 'lazy',
130
+ });
120
131
  function pathToTree(input) {
121
132
  const root = [];
122
133
  for (let i = 0; i < input.length; i++) {
@@ -165,9 +176,9 @@ function pathToTree(input) {
165
176
  }
166
177
  return root;
167
178
  }
168
- const routers = pathToTree(models.keys().map(function (item) {
179
+ const routers = pathToTree(models?.keys().map(function (item) {
169
180
  return item.replace(/\$/g, ':');
170
- }));
181
+ }) || []);
171
182
  function merge(source, child, prev) {
172
183
  const _ = source.find(function (item) {
173
184
  return item.path === child.path;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.0.0-beta.12",
3
+ "version": "3.0.0-beta.14",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "npm run build-conf && npm run build:types",
9
- "build-conf": "swc config -d build -C module.type=nodenext -C jsc.target=esnext -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true --copy-files",
10
- "build-src": "swc src -d lib -C module.type=es6 -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true --copy-files",
9
+ "build-conf": "swc config -d build -C module.type=nodenext -C jsc.target=esnext -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true -D",
10
+ "build-src": "swc src -d lib --extensions=.ts --ignore=src/packages/library/*.tsx -C module.type=es6 -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true -D",
11
11
  "build:types": "tsc && tsc --project cli.json",
12
12
  "postbuild": "node ./copy.js ./prefix ./lib",
13
13
  "prebuild": "rm -rf ./build && rm -rf ./lib"
@@ -40,6 +40,9 @@
40
40
  "portfinder": "1.0.32",
41
41
  "rehype-accessible-emojis": "0.3.2",
42
42
  "rehype-figure": "1.0.1",
43
+ "remark-frontmatter": "^4.0.1",
44
+ "remark-gfm": "^3.0.1",
45
+ "remark-mdx-frontmatter": "^3.0.0",
43
46
  "style-loader": "3.3.2",
44
47
  "style-resources-loader": "1.5.0",
45
48
  "swc-loader": "0.2.3",