@moneko/core 3.0.0-beta.106 → 3.0.0-beta.107

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/app.js CHANGED
@@ -1,22 +1 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { CONFIG } from './common.js';
4
- import htmlPluginOption from './html-plugin-option.js';
5
- import { APPTYPE, PACKAGENAME, PROGRAMPATH, programInfo } from './process-env.js';
6
- import { toUpperCaseString } from './utils.js';
7
- const entryName = APPTYPE === 'library' ? 'site' : 'src';
8
- const app = {
9
- ...programInfo,
10
- base: CONFIG.routeBaseName,
11
- routerMode: CONFIG.routerMode,
12
- mode: CONFIG.mode,
13
- locales: fs.existsSync(path.join(PROGRAMPATH, `./${entryName}/locales`)),
14
- favicon: htmlPluginOption.favicon,
15
- prefixCls: CONFIG.prefixCls,
16
- theme: CONFIG.theme,
17
- type: APPTYPE,
18
- persist: fs.existsSync(path.join(PROGRAMPATH, `./${entryName}/persist.ts`)),
19
- projectName: JSON.stringify(toUpperCaseString(PACKAGENAME)),
20
- iconfont: CONFIG.iconfont
21
- };
22
- export default app;
1
+ import o from"fs";import e from"path";import{CONFIG as t}from"./common.js";import r from"./html-plugin-option.js";import{APPTYPE as s,PACKAGENAME as i,PROGRAMPATH as m,programInfo as p}from"./process-env.js";import{toUpperCaseString as f}from"./utils.js";let n="library"===s?"site":"src",c={...p,base:t.routeBaseName,routerMode:t.routerMode,mode:t.mode,locales:o.existsSync(e.join(m,`./${n}/locales`)),favicon:r.favicon,prefixCls:t.prefixCls,theme:t.theme,type:s,persist:o.existsSync(e.join(m,`./${n}/persist.ts`)),projectName:JSON.stringify(f(i)),iconfont:t.iconfont};export default c;
package/lib/cleanup.js CHANGED
@@ -1,19 +1 @@
1
- import { existsSync, readdirSync, rmdirSync, statSync, unlinkSync } from 'fs';
2
- import { join } from 'path';
3
- import { cacheDir } from './process-env.js';
4
- function cleanDir(folderPath) {
5
- if (existsSync(folderPath)) {
6
- readdirSync(folderPath).forEach((file)=>{
7
- const filePath = join(folderPath, file);
8
- if (statSync(filePath).isDirectory()) {
9
- cleanDir(filePath);
10
- } else {
11
- unlinkSync(filePath);
12
- }
13
- });
14
- rmdirSync(folderPath);
15
- }
16
- }
17
- process.on('exit', function() {
18
- cleanDir(cacheDir);
19
- });
1
+ import{existsSync as o,readdirSync as r,rmdirSync as t,statSync as i,unlinkSync as f}from"fs";import{join as s}from"path";import{cacheDir as c}from"./process-env.js";process.on("exit",function(){!function c(e){o(e)&&(r(e).forEach(o=>{let r=s(e,o);i(r).isDirectory()?c(r):f(r)}),t(e))}(c)});
package/lib/common/rem.js CHANGED
@@ -1,14 +1,13 @@
1
- import { CONFIG } from '../common.js';
2
- export default `(function (doc, win) {
1
+ import{CONFIG as e}from"../common.js";export default`(function (doc, win) {
3
2
  function refreshRem() {
4
3
  const docEl = doc.documentElement;
5
4
  const clientWidth = docEl.clientWidth || doc.body.clientWidth;
6
- const _designSize = clientWidth <= 375 ? 375 : ${CONFIG.rem?.designSize};
5
+ const _designSize = clientWidth <= 375 ? 375 : ${e.rem?.designSize};
7
6
  let unitSize = clientWidth;
8
7
 
9
8
  if (clientWidth <= 375) {
10
9
  unitSize = clientWidth;
11
- } else if (clientWidth <= ${CONFIG.rem?.designSize}) {
10
+ } else if (clientWidth <= ${e.rem?.designSize}) {
12
11
  unitSize = _designSize;
13
12
  } else {
14
13
  unitSize = clientWidth;
@@ -26,4 +25,4 @@ export default `(function (doc, win) {
26
25
  win.addEventListener(resizeEvt, refreshRem, false);
27
26
  }
28
27
  })(document, window);
29
- `;
28
+ `;
package/lib/common.js CHANGED
@@ -1,229 +1,4 @@
1
- import { accessSync, constants } from 'fs';
2
- import { join } from 'path';
3
- import readline from 'readline';
4
- import chalk from 'chalk';
5
- import { merge } from 'webpack-merge';
6
- import { APPTYPE, CUSTOMCONFIG, FRAMEWORK, PACKAGENAME, PROGRAMPATH, jsxImportSource, pkgName } from './process-env.js';
7
- import { isFunction, readConf, resolveProgramPath } from './utils.js';
8
- export const ENTRYPATH = {
9
- mobile: 'mobile',
10
- site: 'site',
11
- 'back-stage': 'back-stage',
12
- 'single-spa': 'single-spa',
13
- library: 'library',
14
- 'single-component': 'single-component'
15
- };
16
- const includeModule = [
17
- `@moneko/${FRAMEWORK}`,
18
- 'neko-ui',
19
- 'antd',
20
- '@antv',
21
- 'katex',
22
- 'font-pingfang-sc',
23
- 'font-pingfang-tc',
24
- 'react-photo-view',
25
- 'react-markdown-editor-lite',
26
- 'schema-design',
27
- '@app'
28
- ];
29
- let defaultSplitChunk = {
30
- chunks: 'all',
31
- minSize: 1024,
32
- minChunks: 1,
33
- cacheGroups: {
34
- route: {
35
- test: /[\\/].git[\\/]router/,
36
- priority: -10,
37
- reuseExistingChunk: true,
38
- name: 'route'
39
- },
40
- example: {
41
- test: /[\\/].git[\\/]example/,
42
- priority: -10,
43
- reuseExistingChunk: true,
44
- name: 'example'
45
- }
46
- }
47
- };
48
- if (APPTYPE === 'single-component') {
49
- defaultSplitChunk = false;
50
- }
51
- const defaultAlias = {
52
- library: {
53
- '@': resolveProgramPath('site'),
54
- '@pkg': resolveProgramPath('components'),
55
- [PACKAGENAME]: resolveProgramPath('components')
56
- },
57
- 'single-component': {
58
- [PACKAGENAME]: resolveProgramPath('umd')
59
- },
60
- mobile: {},
61
- site: {},
62
- 'back-stage': {},
63
- 'single-spa': {}
64
- };
65
- const defaultConfig = {
66
- seo: false,
67
- mode: 'csr',
68
- compiler: 'swc',
69
- bundleAnalyzer: {
70
- analyzerMode: 'static',
71
- reportFilename: 'report.html',
72
- openAnalyzer: false
73
- },
74
- entry: {},
75
- minifier: {
76
- js: {},
77
- css: {}
78
- },
79
- sourceMap: {
80
- filename: '[file].map',
81
- publicPath: ''
82
- },
83
- env: {},
84
- routeBaseName: '/',
85
- publicPath: '/',
86
- rem: {
87
- designSize: APPTYPE === 'mobile' ? 375 : 1680
88
- },
89
- fallbackCompPath: null,
90
- modifyVars: {},
91
- prefixCls: 'n',
92
- alias: Object.assign({
93
- '@': resolveProgramPath('src')
94
- }, defaultAlias[APPTYPE]),
95
- layoutSider: {},
96
- moduleRules: [],
97
- prefixJsLoader: [],
98
- cssModules: [],
99
- importOnDemand: {},
100
- proxy: [],
101
- cacheDirectory: `${PROGRAMPATH}/node_modules/.temp_cache`,
102
- devServer: {
103
- allowedHosts: [
104
- '.baidu.com'
105
- ],
106
- host: 'localhost',
107
- port: 3000,
108
- https: false,
109
- compress: false
110
- },
111
- htmlPluginOption: {
112
- template: `./node_modules/${pkgName}/template/index.html`,
113
- favicon: `./node_modules/${pkgName}/template/favicon.ico`,
114
- tags: []
115
- },
116
- assetHtml: [],
117
- routerMode: 'browser',
118
- fixBrowserRouter: false,
119
- plugins: [],
120
- splitChunk: defaultSplitChunk,
121
- runtimeChunk: APPTYPE === 'single-component' ? false : 'single',
122
- moduleFederation: [],
123
- rulesInclude: {
124
- less: includeModule,
125
- css: includeModule,
126
- js: includeModule,
127
- media: includeModule,
128
- fonts: includeModule
129
- },
130
- mdx: {
131
- jsxImportSource: jsxImportSource,
132
- useDynamicImport: true,
133
- remarkPlugins: [],
134
- rehypePlugins: []
135
- },
136
- jsxDomExpressions: {
137
- moduleName: 'solid-js/web',
138
- builtIns: [
139
- 'For',
140
- 'Show',
141
- 'Switch',
142
- 'Match',
143
- 'Suspense',
144
- 'SuspenseList',
145
- 'Portal',
146
- 'Index',
147
- 'Dynamic',
148
- 'ErrorBoundary'
149
- ],
150
- contextToCustomElements: true,
151
- wrapConditionals: true,
152
- generate: 'dom',
153
- hydratable: false
154
- },
155
- bar: {
156
- name: '编译中',
157
- color: '#6f42c1'
158
- },
159
- virtualModule: {},
160
- normalizeCss: true,
161
- externalsPresets: {}
162
- };
163
- export const log = (msg)=>{
164
- readline.cursorTo(process.stdout, 0);
165
- process.stdout.write(msg);
166
- };
167
- let customConf = defaultConfig;
168
- let configPath = null;
169
- let normalConf = {};
170
- let envConf = {};
171
- try {
172
- configPath = join(PROGRAMPATH, './config/index.ts');
173
- accessSync(configPath, constants.R_OK);
174
- } catch (error) {
175
- configPath = null;
176
- }
177
- if (configPath) {
178
- try {
179
- const conf = (await readConf(configPath, 'index')).default;
180
- normalConf = isFunction(conf) ? conf(process) : conf;
181
- } catch (error) {
182
- process.stdout.write(chalk.red(error));
183
- }
184
- }
185
- if (CUSTOMCONFIG) {
186
- let customConfigPath = null;
187
- try {
188
- customConfigPath = join(PROGRAMPATH, `./config/${CUSTOMCONFIG}.ts`);
189
- accessSync(customConfigPath, constants.R_OK);
190
- } catch (error) {
191
- customConfigPath = null;
192
- }
193
- if (customConfigPath !== null) {
194
- try {
195
- const conf = (await readConf(customConfigPath, CUSTOMCONFIG)).default;
196
- envConf = isFunction(conf) ? conf(process) : conf;
197
- } catch (error) {
198
- process.stdout.write(chalk.red(error));
199
- }
200
- }
201
- }
202
- customConf = merge(customConf, normalConf, envConf);
203
- if (customConf.compiler === 'tsc' && customConf.minifier) {
204
- if (!customConf.minifier.js) {
205
- Object.assign(customConf.minifier, {
206
- js: {
207
- type: 'terser'
208
- }
209
- });
210
- }
211
- if (!customConf.minifier.css) {
212
- Object.assign(customConf.minifier, {
213
- css: {
214
- type: 'cssnano'
215
- }
216
- });
217
- }
218
- }
219
- if (customConf.devtool === false) customConf.sourceMap = false;
220
- if (customConf.sourceMap === false) customConf.devtool = false;
221
- if (customConf.fixBrowserRouter && customConf.htmlPluginOption) {
222
- if (!customConf.htmlPluginOption.tags) {
223
- customConf.htmlPluginOption.tags = [];
224
- }
225
- customConf.htmlPluginOption.tags.push({
226
- textContent: `
1
+ import{accessSync as e,constants as t}from"fs";import{join as o}from"path";import s from"readline";import i from"chalk";import{merge as r}from"webpack-merge";import{APPTYPE as n,CUSTOMCONFIG as l,FRAMEWORK as a,PACKAGENAME as c,PROGRAMPATH as m,jsxImportSource as p,pkgName as u}from"./process-env.js";import{isFunction as d,readConf as h,resolveProgramPath as g}from"./utils.js";export const ENTRYPATH={mobile:"mobile",site:"site","back-stage":"back-stage","single-spa":"single-spa",library:"library","single-component":"single-component"};let f=[`@moneko/${a}`,"neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app"],x={chunks:"all",minSize:1024,minChunks:1,cacheGroups:{route:{test:/[\\/].git[\\/]router/,priority:-10,reuseExistingChunk:!0,name:"route"},example:{test:/[\\/].git[\\/]example/,priority:-10,reuseExistingChunk:!0,name:"example"}}};"single-component"===n&&(x=!1);let b={library:{"@":g("site"),"@pkg":g("components"),[c]:g("components")},"single-component":{[c]:g("umd")},mobile:{},site:{},"back-stage":{},"single-spa":{}},y={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:{analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1},entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{},routeBaseName:"/",publicPath:"/",rem:{designSize:"mobile"===n?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":g("src")},b[n]),layoutSider:{},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:`${m}/node_modules/.temp_cache`,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`./node_modules/${u}/template/index.html`,favicon:`./node_modules/${u}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:x,runtimeChunk:"single-component"!==n&&"single",moduleFederation:[],rulesInclude:{less:f,css:f,js:f,media:f,fonts:f},mdx:{jsxImportSource:p,useDynamicImport:!0,remarkPlugins:[],rehypePlugins:[]},jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1},bar:{name:"编译中",color:"#6f42c1"},virtualModule:{},normalizeCss:!0,externalsPresets:{}};export const log=e=>{s.cursorTo(process.stdout,0),process.stdout.write(e)};let w=y,C=null,k={},O={};try{C=o(m,"./config/index.ts"),e(C,t.R_OK)}catch(e){C=null}if(C)try{let e=(await h(C,"index")).default;k=d(e)?e(process):e}catch(e){process.stdout.write(i.red(e))}if(l){let s=null;try{s=o(m,`./config/${l}.ts`),e(s,t.R_OK)}catch(e){s=null}if(null!==s)try{let e=(await h(s,l)).default;O=d(e)?e(process):e}catch(e){process.stdout.write(i.red(e))}}"tsc"===(w=r(w,k,O)).compiler&&w.minifier&&(w.minifier.js||Object.assign(w.minifier,{js:{type:"terser"}}),w.minifier.css||Object.assign(w.minifier,{css:{type:"cssnano"}})),!1===w.devtool&&(w.sourceMap=!1),!1===w.sourceMap&&(w.devtool=!1),w.fixBrowserRouter&&w.htmlPluginOption&&(w.htmlPluginOption.tags||(w.htmlPluginOption.tags=[]),w.htmlPluginOption.tags.push({textContent:`
227
2
  (function(l) {
228
3
  if (l.search[1] === '/' ) {
229
4
  var decoded = l.search.slice(1).split('&').map(function(s) {
@@ -234,19 +9,4 @@ if (customConf.fixBrowserRouter && customConf.htmlPluginOption) {
234
9
  );
235
10
  }
236
11
  }(window.location))
237
- `
238
- });
239
- }
240
- export const CONFIG = customConf;
241
- export const PUBLICPATH = CONFIG.publicPath || '/';
242
- export let hasCustomRouter = false;
243
- try {
244
- accessSync(join(CONFIG.alias['@'], './router/index.ts'), constants.R_OK);
245
- hasCustomRouter = true;
246
- } catch (error) {
247
- hasCustomRouter = false;
248
- }
249
- global.NEKOCLICONFIG = {
250
- CONFIG,
251
- log
252
- };
12
+ `}));export const CONFIG=w;export const PUBLICPATH=CONFIG.publicPath||"/";export let hasCustomRouter=!1;try{e(o(CONFIG.alias["@"],"./router/index.ts"),t.R_OK),hasCustomRouter=!0}catch(e){hasCustomRouter=!1}global.NEKOCLICONFIG={CONFIG,log};
package/lib/coverage.js CHANGED
@@ -1,30 +1 @@
1
- import { accessSync, constants, readFileSync } from 'fs';
2
- import { join } from 'path';
3
- import { Parser } from 'xml2js';
4
- import { PACKAGENAME, PROGRAMPATH } from './process-env.js';
5
- export const coverage = {};
6
- try {
7
- const coveragePath = join(PROGRAMPATH, './coverage/clover.xml');
8
- accessSync(coveragePath, constants.R_OK);
9
- const parser = new Parser({
10
- explicitArray: false,
11
- async: false
12
- });
13
- const cover = readFileSync(coveragePath, {
14
- encoding: 'utf-8'
15
- });
16
- parser.parseString(cover, (error, result)=>{
17
- if (!error) {
18
- const projectMetrics = result.coverage.project.metrics.$;
19
- const components = result.coverage.project.package;
20
- Object.assign(coverage, {
21
- [PACKAGENAME]: projectMetrics
22
- });
23
- components.forEach((pkg)=>{
24
- Object.assign(coverage, {
25
- [pkg.$.name]: pkg.metrics.$
26
- });
27
- });
28
- }
29
- });
30
- } catch (error) {}
1
+ import{accessSync as e,constants as r,readFileSync as c}from"fs";import{join as o}from"path";import{Parser as t}from"xml2js";import{PACKAGENAME as a,PROGRAMPATH as s}from"./process-env.js";export const coverage={};try{let i=o(s,"./coverage/clover.xml");e(i,r.R_OK);let m=new t({explicitArray:!1,async:!1}),p=c(i,{encoding:"utf-8"});m.parseString(p,(e,r)=>{if(!e){let e=r.coverage.project.metrics.$,c=r.coverage.project.package;Object.assign(coverage,{[a]:e}),c.forEach(e=>{Object.assign(coverage,{[e.$.name]:e.metrics.$})})}})}catch(e){}
package/lib/define.js CHANGED
@@ -1,9 +1 @@
1
- import { CONFIG } from './common.js';
2
- import { NODE_ENV } from './process-env.js';
3
- const define = {
4
- 'process.env': JSON.stringify({
5
- NODE_ENV: NODE_ENV,
6
- ...CONFIG.env
7
- })
8
- };
9
- export default define;
1
+ import{CONFIG as o}from"./common.js";import{NODE_ENV as e}from"./process-env.js";let r={"process.env":JSON.stringify({NODE_ENV:e,...o.env})};export default r;
package/lib/docs.js CHANGED
@@ -1,113 +1 @@
1
- import { statSync } from 'fs';
2
- import { dirname, join } from 'path';
3
- import { watch } from 'chokidar';
4
- import { CONFIG } from './common.js';
5
- import generateApi from './generate-api.js';
6
- import objectListener from './object-listener.js';
7
- import { APPTYPE, FRAMEWORK } from './process-env.js';
8
- import { resolveProgramPath } from './utils.js';
9
- const base = '@app/comment';
10
- const apiEntry = '@app/docs';
11
- export const docs = objectListener({});
12
- const cacheEnvApi = {
13
- [base]: {}
14
- };
15
- const createElement = {
16
- react: 'createElement',
17
- 'solid-js': 'createComponent'
18
- }[FRAMEWORK];
19
- let replaceStr = `() => ${createElement}(SuspenseComp, { comp: $1 })`;
20
- let prefixStr = `import { ${createElement} } from "${FRAMEWORK}";import { SuspenseComp } from "@moneko/${FRAMEWORK}";`;
21
- if (![
22
- 'react',
23
- 'solid-js'
24
- ].includes(FRAMEWORK)) {
25
- replaceStr = '$1';
26
- prefixStr = '';
27
- }
28
- if (FRAMEWORK === 'solid-js') {
29
- prefixStr = `import { Dynamic } from "${FRAMEWORK}/web";${prefixStr}`;
30
- }
31
- function handleFileChange(filePath, changeType) {
32
- const fil = filePath.replace(new RegExp(`^${CONFIG.alias['@pkg']}`), '');
33
- const __dir = dirname(fil).replace(/^\//, '');
34
- const apiDir = [
35
- base,
36
- __dir
37
- ].join('/');
38
- const name = fil.split('/').pop()?.replace(/\.tsx?/, '.md');
39
- if (!name) return;
40
- if (!cacheEnvApi[base][__dir]) {
41
- cacheEnvApi[base][__dir] = {};
42
- }
43
- const target = join(apiDir, name);
44
- if (changeType === 'deleted') {
45
- if (cacheEnvApi[base][__dir][name]) {
46
- delete cacheEnvApi[base][__dir][name];
47
- }
48
- } else {
49
- const api = generateApi(filePath);
50
- cacheEnvApi[target] = api;
51
- if (api) {
52
- cacheEnvApi[base][__dir][name] = `rr(() => import(/* webpackChunkName: '${target}' */'${target}?raw').then((res) => ({default: ${createElement}(Dynamic, {text: res.default, component: 'n-md', css: 'table td a {display:inline-flex;align-items:center;gap:2px;}table td a n-img{display:inline-block;overflow:hidden;border-radius:var(--border-radius);inline-size:18px;block-size:18px;}'})})))rr`;
53
- } else if (cacheEnvApi[base][__dir][name]) {
54
- delete cacheEnvApi[base][__dir][name];
55
- }
56
- }
57
- const basestr = {};
58
- for(const k in cacheEnvApi[base]){
59
- if (Object.prototype.hasOwnProperty.call(cacheEnvApi[base], k)) {
60
- basestr[k] = Object.values(cacheEnvApi[base][k]);
61
- }
62
- }
63
- const env = {
64
- ...cacheEnvApi
65
- };
66
- delete env[base];
67
- Object.assign(docs.data, {
68
- ...env,
69
- [apiEntry]: `${prefixStr}export default ${JSON.stringify(basestr).replace(/"rr\((.+?)\)rr"/g, replaceStr)}`
70
- });
71
- }
72
- function watchDirectory() {
73
- const files = [];
74
- const watcher = watch(resolveProgramPath('components'), {
75
- ignored: [
76
- /(^|[\\/\\])\../,
77
- /(^|[\\/\\])__tests__([\\/\\]|$)/
78
- ],
79
- persistent: true,
80
- ignoreInitial: false
81
- });
82
- function isTs(path) {
83
- return /\.tsx?$/.test(path) && statSync(path).isFile();
84
- }
85
- watcher.on('add', (path)=>{
86
- if (isTs(path)) {
87
- handleFileChange(path, 'added');
88
- files.push(path);
89
- }
90
- });
91
- watcher.on('change', (path)=>{
92
- if (isTs(path)) {
93
- handleFileChange(path, 'change');
94
- }
95
- });
96
- watcher.on('unlink', (path)=>{
97
- if (isTs(path)) {
98
- handleFileChange(path, 'deleted');
99
- files.splice(files.indexOf(path), 1);
100
- }
101
- });
102
- watcher.on('ready', ()=>{
103
- files.forEach((f)=>{
104
- handleFileChange(f, 'change');
105
- });
106
- });
107
- process.on('SIGINT', function() {
108
- watcher.close();
109
- });
110
- }
111
- if (APPTYPE === 'library') {
112
- watchDirectory();
113
- }
1
+ import{statSync as e}from"fs";import{dirname as t,join as o}from"path";import{watch as r}from"chokidar";import{CONFIG as i}from"./common.js";import n from"./generate-api.js";import s from"./object-listener.js";import{APPTYPE as l,FRAMEWORK as p}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";let c="@app/comment";export const docs=s({});let m={[c]:{}},d={react:"createElement",solid:"createComponent"}[p],f=`() => ${d}(SuspenseComp, { comp: $1 })`,u=`import { ${d} } from "${p}";import { SuspenseComp } from "@moneko/${p}";`;function $(e,r){let s=e.replace(RegExp(`^${i.alias["@pkg"]}`),""),l=t(s).replace(/^\//,""),p=[c,l].join("/"),a=s.split("/").pop()?.replace(/\.tsx?/,".md");if(!a)return;m[c][l]||(m[c][l]={});let $=o(p,a);if("deleted"===r)m[c][l][a]&&delete m[c][l][a];else{let t=n(e);m[$]=t,t?m[c][l][a]=`rr(() => import(/* webpackChunkName: '${$}' */'${$}?raw').then((res) => ({default: ${d}(Dynamic, {text: res.default, component: 'n-md', css: 'table td a {display:inline-flex;align-items:center;gap:2px;}table td a n-img{display:inline-block;overflow:hidden;border-radius:var(--border-radius);inline-size:18px;block-size:18px;}'})})))rr`:m[c][l][a]&&delete m[c][l][a]}let g={};for(let e in m[c])Object.prototype.hasOwnProperty.call(m[c],e)&&(g[e]=Object.values(m[c][e]));let b={...m};delete b[c],Object.assign(docs.data,{...b,"@app/docs":`${u}export default ${JSON.stringify(g).replace(/"rr\((.+?)\)rr"/g,f)}`})}["react","solid"].includes(p)||(f="$1",u=""),"solid"===p&&(u=`import { Dynamic } from "${p}/web";${u}`),"library"===l&&function(){let t=[],o=r(a("components"),{ignored:[/(^|[\\/\\])\../,/(^|[\\/\\])__tests__([\\/\\]|$)/],persistent:!0,ignoreInitial:!1});function i(t){return/\.tsx?$/.test(t)&&e(t).isFile()}o.on("add",e=>{i(e)&&($(e,"added"),t.push(e))}),o.on("change",e=>{i(e)&&$(e,"change")}),o.on("unlink",e=>{i(e)&&($(e,"deleted"),t.splice(t.indexOf(e),1))}),o.on("ready",()=>{t.forEach(e=>{$(e,"change")})}),process.on("SIGINT",function(){o.close()})}();
package/lib/done.js CHANGED
@@ -1,12 +1 @@
1
- class DoneWebpackPlugin {
2
- options;
3
- constructor(options){
4
- this.options = Object.assign({}, options);
5
- }
6
- apply(compiler) {
7
- compiler.hooks.done.tap('DoneWebpackPlugin', ()=>{
8
- this.options.done?.();
9
- });
10
- }
11
- }
12
- export default DoneWebpackPlugin;
1
+ export default class{constructor(o){this.options=Object.assign({},o)}apply(o){o.hooks.done.tap("DoneWebpackPlugin",()=>{this.options.done?.()})}};
package/lib/esm.js CHANGED
@@ -1,7 +1 @@
1
- export default function esm(templateStrings, ...substitutions) {
2
- let js = templateStrings.raw[0];
3
- for(let i = 0; i < substitutions.length; i++){
4
- js += substitutions[i] + templateStrings.raw[i + 1];
5
- }
6
- return `data:text/javascript;base64,${Buffer.from(js).toString('base64')}`;
7
- }
1
+ export default function t(t,...e){let r=t.raw[0];for(let a=0;a<e.length;a++)r+=e[a]+t.raw[a+1];return`data:text/javascript;base64,${Buffer.from(r).toString("base64")}`}