@shijiu/jsview 1.9.747 → 1.9.760

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,8 +1,15 @@
1
1
  import "./browser-root-style.css"
2
2
 
3
- // Release entry
4
- export * from "./bin/jsview-browser-debug-dom.min"
3
+ import JsvCodeDebug from "./jsv-code-debug"
5
4
 
6
- // Debug entry
7
- // TODO: 进行编译(yarn build)时,需要关闭掉此require
8
- // export * from "./code/src/dom-browser-hook"
5
+ let domBrowser;
6
+
7
+ if (!JsvCodeDebug.enableDebug) {
8
+ // Release entry
9
+ domBrowser = await import("./bin/jsview-browser-debug-dom.min");
10
+ } else {
11
+ // Debug entry
12
+ domBrowser = await import(JsvCodeDebug.domBrowserPath);
13
+ }
14
+
15
+ export default domBrowser;
@@ -0,0 +1,14 @@
1
+
2
+ const JsvCodeDebug = {
3
+ // true: Debug entry
4
+ // false: Release entry
5
+ // TODO: 进行编译(yarn build)时,需要设置为fasle。
6
+ enableDebug: false,
7
+
8
+ domBrowserPath: "./code/src/dom-browser-hook",
9
+ domNativePath: "./code/src/dom-wrapper",
10
+ engineBrowserPath: "./code/src/engine-js/browser",
11
+ forgeDefinePath: "./code/src/engine-js",
12
+ };
13
+
14
+ export default JsvCodeDebug;
package/dom/jsv-dom.js CHANGED
@@ -1,6 +1,13 @@
1
- // Release entry
2
- export * from "./bin/jsview-dom.min"
1
+ import JsvCodeDebug from "./jsv-code-debug"
3
2
 
4
- // Debug entry
5
- // TODO: 进行编译(yarn build)时,需要关闭掉此require
6
- // export * from "./code/src/dom-wrapper"
3
+ let domNative;
4
+
5
+ if (!JsvCodeDebug.enableDebug) {
6
+ // Release entry
7
+ domNative = await import("./bin/jsview-dom.min");
8
+ } else {
9
+ // Debug entry
10
+ domNative = await import(JsvCodeDebug.domNativePath);
11
+ }
12
+
13
+ export default domNative;
@@ -1,6 +1,13 @@
1
- // Release entry
2
- export * from "./bin/jsview-engine-js-browser.min"
1
+ import JsvCodeDebug from "./jsv-code-debug"
3
2
 
4
- // Debug entry
5
- // TODO: 进行编译(yarn build)时,需要关闭掉此require
6
- // export * from "./code/src/engine-js/browser"
3
+ let engineBrowser;
4
+
5
+ if (!JsvCodeDebug.enableDebug) {
6
+ // Release entry
7
+ engineBrowser = await import("./bin/jsview-engine-js-browser.min");
8
+ } else {
9
+ // Debug entry
10
+ engineBrowser = await import(JsvCodeDebug.engineBrowserPath);
11
+ }
12
+
13
+ export default engineBrowser;
@@ -1,6 +1,18 @@
1
- // Release entry
2
- export * from "./bin/jsview-forge-define.min"
1
+ import JsvCodeDebug from "./jsv-code-debug"
3
2
 
4
- // Debug entry
5
- // TODO: 进行编译(yarn build)时,需要关闭掉此require
6
- // export * from "./code/src/engine-js"
3
+ let forgeDefine;
4
+
5
+ if (!JsvCodeDebug.enableDebug) {
6
+ // Release entry
7
+ forgeDefine = await import("./bin/jsview-forge-define.min");
8
+ } else {
9
+ // Debug entry
10
+ forgeDefine = await import(JsvCodeDebug.forgeDefinePath);
11
+ }
12
+
13
+ const Forge = forgeDefine.Forge;
14
+ const ForgeExtension = forgeDefine.ForgeExtension;
15
+ export {
16
+ Forge,
17
+ ForgeExtension
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "1.9.747",
3
+ "version": "1.9.760",
4
4
  "bin": {
5
5
  "jsview-post-build": "./tools/jsview-post-build.js",
6
6
  "jsview-post-install": "./tools/jsview-post-install.js"
@@ -0,0 +1,161 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ const path = require('path');
12
+ const fs = require('fs');
13
+ const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
14
+
15
+ // Make sure any symlinks in the project folder are resolved:
16
+ // https://github.com/facebook/create-react-app/issues/637
17
+ const appDirectory = fs.realpathSync(process.cwd());
18
+ const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
19
+
20
+ // We use `PUBLIC_URL` environment variable or "homepage" field to infer
21
+ // "public path" at which the app is served.
22
+ // webpack needs to know it to put the right <script> hrefs into HTML even in
23
+ // single-page apps that may serve index.html for nested URLs like /todos/42.
24
+ // We can't use a relative path in HTML because we don't want to load something
25
+ // like /todos/42/static/js/bundle.7289d.js. We have to know the root.
26
+ const publicUrlOrPath = getPublicUrlOrPath(
27
+ process.env.NODE_ENV === 'development',
28
+ require(resolveApp('package.json')).homepage,
29
+ process.env.PUBLIC_URL
30
+ );
31
+
32
+ const buildPath = process.env.BUILD_PATH || 'build';
33
+
34
+ const moduleFileExtensions = [
35
+ 'web.mjs',
36
+ 'mjs',
37
+ 'web.js',
38
+ 'js',
39
+ 'web.ts',
40
+ 'ts',
41
+ 'web.tsx',
42
+ 'tsx',
43
+ 'json',
44
+ 'web.jsx',
45
+ 'jsx',
46
+ ];
47
+
48
+ // Resolve file paths in the same order as webpack
49
+ const resolveModule = (resolveFn, filePath) => {
50
+ const extension = moduleFileExtensions.find(extension =>
51
+ fs.existsSync(resolveFn(`${filePath}.${extension}`))
52
+ );
53
+
54
+ if (extension) {
55
+ return resolveFn(`${filePath}.${extension}`);
56
+ }
57
+
58
+ return resolveFn(`${filePath}.js`);
59
+ };
60
+
61
+ // config after eject: we're in ./config/
62
+ module.exports = {
63
+ dotenv: resolveApp('.env'),
64
+ appPath: resolveApp('.'),
65
+ appBuild: resolveApp(buildPath),
66
+ appPublic: resolveApp('public'),
67
+ appHtml: resolveApp('public/index.html'),
68
+ // JsView Modified >>>
69
+ // appIndexJs: resolveModule(resolveApp, 'src/index'),
70
+ appIndexJs: resolveModule(resolveApp, 'node_modules/@shijiu/jsview/loader/jsview-main'),
71
+ // JsView Modified <<<
72
+ appPackageJson: resolveApp('package.json'),
73
+ appSrc: resolveApp('src'),
74
+ appTsConfig: resolveApp('tsconfig.json'),
75
+ appJsConfig: resolveApp('jsconfig.json'),
76
+ yarnLockFile: resolveApp('yarn.lock'),
77
+ testsSetup: resolveModule(resolveApp, 'src/setupTests'),
78
+ proxySetup: resolveApp('src/setupProxy.js'),
79
+ appNodeModules: resolveApp('node_modules'),
80
+ appWebpackCache: resolveApp('node_modules/.cache'),
81
+ appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
82
+ swSrc: resolveModule(resolveApp, 'src/service-worker'),
83
+ publicUrlOrPath,
84
+ };
85
+
86
+ // @remove-on-eject-begin
87
+ const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
88
+
89
+ // config before eject: we're in ./node_modules/react-scripts/config/
90
+ module.exports = {
91
+ dotenv: resolveApp('.env'),
92
+ appPath: resolveApp('.'),
93
+ appBuild: resolveApp(buildPath),
94
+ appPublic: resolveApp('public'),
95
+ appHtml: resolveApp('public/index.html'),
96
+ // JsView Modified >>>
97
+ // appIndexJs: resolveModule(resolveApp, 'src/index'),
98
+ appIndexJs: resolveModule(resolveApp, 'node_modules/@shijiu/jsview/loader/jsview-main'),
99
+ jsviewPath: resolveApp('node_modules/@shijiu'),
100
+ jsviewDebugPath: resolveApp('../../@shijiu'),
101
+ // JsView Modified <<<
102
+ appPackageJson: resolveApp('package.json'),
103
+ appSrc: resolveApp('src'),
104
+ appTsConfig: resolveApp('tsconfig.json'),
105
+ appJsConfig: resolveApp('jsconfig.json'),
106
+ yarnLockFile: resolveApp('yarn.lock'),
107
+ testsSetup: resolveModule(resolveApp, 'src/setupTests'),
108
+ proxySetup: resolveApp('src/setupProxy.js'),
109
+ appNodeModules: resolveApp('node_modules'),
110
+ appWebpackCache: resolveApp('node_modules/.cache'),
111
+ appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
112
+ swSrc: resolveModule(resolveApp, 'src/service-worker'),
113
+ publicUrlOrPath,
114
+ // These properties only exist before ejecting:
115
+ ownPath: resolveOwn('.'),
116
+ ownNodeModules: resolveOwn('node_modules'), // This is empty on npm 3
117
+ appTypeDeclarations: resolveApp('src/react-app-env.d.ts'),
118
+ ownTypeDeclarations: resolveOwn('lib/react-app.d.ts'),
119
+ };
120
+
121
+ const ownPackageJson = require('../package.json');
122
+ const reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
123
+ const reactScriptsLinked =
124
+ fs.existsSync(reactScriptsPath) &&
125
+ fs.lstatSync(reactScriptsPath).isSymbolicLink();
126
+
127
+ // config before publish: we're in ./packages/react-scripts/config/
128
+ if (
129
+ !reactScriptsLinked &&
130
+ __dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1
131
+ ) {
132
+ const templatePath = '../cra-template/template';
133
+ module.exports = {
134
+ dotenv: resolveOwn(`${templatePath}/.env`),
135
+ appPath: resolveApp('.'),
136
+ appBuild: resolveOwn(path.join('../..', buildPath)),
137
+ appPublic: resolveOwn(`${templatePath}/public`),
138
+ appHtml: resolveOwn(`${templatePath}/public/index.html`),
139
+ appIndexJs: resolveModule(resolveOwn, `${templatePath}/src/index`),
140
+ appPackageJson: resolveOwn('package.json'),
141
+ appSrc: resolveOwn(`${templatePath}/src`),
142
+ appTsConfig: resolveOwn(`${templatePath}/tsconfig.json`),
143
+ appJsConfig: resolveOwn(`${templatePath}/jsconfig.json`),
144
+ yarnLockFile: resolveOwn(`${templatePath}/yarn.lock`),
145
+ testsSetup: resolveModule(resolveOwn, `${templatePath}/src/setupTests`),
146
+ proxySetup: resolveOwn(`${templatePath}/src/setupProxy.js`),
147
+ appNodeModules: resolveOwn('node_modules'),
148
+ appWebpackCache: resolveOwn('node_modules/.cache'),
149
+ appTsBuildInfoFile: resolveOwn('node_modules/.cache/tsconfig.tsbuildinfo'),
150
+ swSrc: resolveModule(resolveOwn, `${templatePath}/src/service-worker`),
151
+ publicUrlOrPath,
152
+ // These properties only exist before ejecting:
153
+ ownPath: resolveOwn('.'),
154
+ ownNodeModules: resolveOwn('node_modules'),
155
+ appTypeDeclarations: resolveOwn(`${templatePath}/src/react-app-env.d.ts`),
156
+ ownTypeDeclarations: resolveOwn('lib/react-app.d.ts'),
157
+ };
158
+ }
159
+ // @remove-on-eject-end
160
+
161
+ module.exports.moduleFileExtensions = moduleFileExtensions;
@@ -0,0 +1,825 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const webpack = require('webpack');
14
+ const resolve = require('resolve');
15
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
16
+ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
17
+ const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
18
+ const TerserPlugin = require('terser-webpack-plugin');
19
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
20
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
21
+ const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
22
+ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
23
+ const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
24
+ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
25
+ const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
26
+ const ESLintPlugin = require('eslint-webpack-plugin');
27
+ const paths = require('./paths');
28
+ const modules = require('./modules');
29
+ const getClientEnvironment = require('./env');
30
+ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
31
+ const ForkTsCheckerWebpackPlugin =
32
+ process.env.TSC_COMPILE_ON_ERROR === 'true'
33
+ ? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
34
+ : require('react-dev-utils/ForkTsCheckerWebpackPlugin');
35
+ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
36
+ // @remove-on-eject-begin
37
+ const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
38
+ // @remove-on-eject-end
39
+ const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
40
+
41
+ // Source maps are resource heavy and can cause out of memory issue for large source files.
42
+ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
43
+
44
+ const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
45
+ const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
46
+ '@pmmmwh/react-refresh-webpack-plugin'
47
+ );
48
+ const babelRuntimeEntry = require.resolve('babel-preset-react-app');
49
+ const babelRuntimeEntryHelpers = require.resolve(
50
+ '@babel/runtime/helpers/esm/assertThisInitialized',
51
+ { paths: [babelRuntimeEntry] }
52
+ );
53
+ const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
54
+ paths: [babelRuntimeEntry],
55
+ });
56
+
57
+ // Some apps do not need the benefits of saving a web request, so not inlining the chunk
58
+ // makes for a smoother build process.
59
+ const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
60
+
61
+ const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
62
+ const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
63
+
64
+ const imageInlineSizeLimit = parseInt(
65
+ process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
66
+ );
67
+
68
+ // Check if TypeScript is setup
69
+ const useTypeScript = fs.existsSync(paths.appTsConfig);
70
+
71
+ // Check if Tailwind config exists
72
+ const useTailwind = fs.existsSync(
73
+ path.join(paths.appPath, 'tailwind.config.js')
74
+ );
75
+
76
+ // Get the path to the uncompiled service worker (if it exists).
77
+ const swSrc = paths.swSrc;
78
+
79
+ // style files regexes
80
+ const cssRegex = /\.css$/;
81
+ const cssModuleRegex = /\.module\.css$/;
82
+ const sassRegex = /\.(scss|sass)$/;
83
+ const sassModuleRegex = /\.module\.(scss|sass)$/;
84
+
85
+ const hasJsxRuntime = (() => {
86
+ if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
87
+ return false;
88
+ }
89
+
90
+ try {
91
+ require.resolve('react/jsx-runtime');
92
+ return true;
93
+ } catch (e) {
94
+ return false;
95
+ }
96
+ })();
97
+
98
+ // This is the production and development configuration.
99
+ // It is focused on developer experience, fast rebuilds, and a minimal bundle.
100
+ module.exports = function (webpackEnv) {
101
+ const isEnvDevelopment = webpackEnv === 'development';
102
+ const isEnvProduction = webpackEnv === 'production';
103
+
104
+ // Variable used for enabling profiling in Production
105
+ // passed into alias object. Uses a flag if passed into the build command
106
+ const isEnvProductionProfile =
107
+ isEnvProduction && process.argv.includes('--profile');
108
+
109
+ // We will provide `paths.publicUrlOrPath` to our app
110
+ // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
111
+ // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
112
+ // Get environment variables to inject into our app.
113
+ const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
114
+
115
+ const shouldUseReactRefresh = env.raw.FAST_REFRESH;
116
+
117
+ // common function to get style loaders
118
+ const getStyleLoaders = (cssOptions, preProcessor) => {
119
+ const loaders = [
120
+ isEnvDevelopment && require.resolve('style-loader'),
121
+ isEnvProduction && {
122
+ loader: MiniCssExtractPlugin.loader,
123
+ // css is located in `static/css`, use '../../' to locate index.html folder
124
+ // in production `paths.publicUrlOrPath` can be a relative path
125
+ options: paths.publicUrlOrPath.startsWith('.')
126
+ ? { publicPath: '../../' }
127
+ : {},
128
+ },
129
+ {
130
+ loader: require.resolve('css-loader'),
131
+ options: cssOptions,
132
+ },
133
+ {
134
+ // Options for PostCSS as we reference these options twice
135
+ // Adds vendor prefixing based on your specified browser support in
136
+ // package.json
137
+ loader: require.resolve('postcss-loader'),
138
+ options: {
139
+ postcssOptions: {
140
+ // Necessary for external CSS imports to work
141
+ // https://github.com/facebook/create-react-app/issues/2677
142
+ ident: 'postcss',
143
+ config: false,
144
+ plugins: !useTailwind
145
+ ? [
146
+ 'postcss-flexbugs-fixes',
147
+ [
148
+ 'postcss-preset-env',
149
+ {
150
+ autoprefixer: {
151
+ flexbox: 'no-2009',
152
+ },
153
+ stage: 3,
154
+ },
155
+ ],
156
+ // Adds PostCSS Normalize as the reset css with default options,
157
+ // so that it honors browserslist config in package.json
158
+ // which in turn let's users customize the target behavior as per their needs.
159
+ 'postcss-normalize',
160
+ ]
161
+ : [
162
+ 'tailwindcss',
163
+ 'postcss-flexbugs-fixes',
164
+ [
165
+ 'postcss-preset-env',
166
+ {
167
+ autoprefixer: {
168
+ flexbox: 'no-2009',
169
+ },
170
+ stage: 3,
171
+ },
172
+ ],
173
+ ],
174
+ },
175
+ sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
176
+ },
177
+ },
178
+ ].filter(Boolean);
179
+ if (preProcessor) {
180
+ loaders.push(
181
+ {
182
+ loader: require.resolve('resolve-url-loader'),
183
+ options: {
184
+ sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
185
+ root: paths.appSrc,
186
+ },
187
+ },
188
+ {
189
+ loader: require.resolve(preProcessor),
190
+ options: {
191
+ sourceMap: true,
192
+ },
193
+ }
194
+ );
195
+ }
196
+ return loaders;
197
+ };
198
+
199
+ return {
200
+ target: ['browserslist'],
201
+ // Webpack noise constrained to errors and warnings
202
+ stats: 'errors-warnings',
203
+ mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
204
+ // Stop compilation early in production
205
+ bail: isEnvProduction,
206
+ devtool: isEnvProduction
207
+ ? shouldUseSourceMap
208
+ ? 'source-map'
209
+ : false
210
+ : isEnvDevelopment && 'cheap-module-source-map',
211
+ // These are the "entry points" to our application.
212
+ // This means they will be the "root" imports that are included in JS bundle.
213
+ entry: paths.appIndexJs,
214
+ output: {
215
+ // The build folder.
216
+ path: paths.appBuild,
217
+ // Add /* filename */ comments to generated require()s in the output.
218
+ pathinfo: isEnvDevelopment,
219
+ // There will be one main bundle, and one file per asynchronous chunk.
220
+ // In development, it does not produce real files.
221
+ filename: isEnvProduction
222
+ // JsView Modified >>>
223
+ // ? 'static/js/[name].[contenthash:8].js'
224
+ // : isEnvDevelopment && 'static/js/bundle.js',
225
+ ? 'js/[name].[contenthash:8].js'
226
+ : isEnvDevelopment && 'js/bundle.js',
227
+ // JsView Modified <<<
228
+ // There are also additional JS chunk files if you use code splitting.
229
+ chunkFilename: isEnvProduction
230
+ // JsView Modified >>>
231
+ // ? 'static/js/[name].[contenthash:8].chunk.js'
232
+ // : isEnvDevelopment && 'static/js/[name].chunk.js',
233
+ // assetModuleFilename: 'static/media/[name].[hash][ext]',
234
+ ? 'js/[name].[contenthash:8].chunk.js'
235
+ : isEnvDevelopment && 'js/[name].chunk.js',
236
+ assetModuleFilename: 'media/[name].[hash][ext]',
237
+ // JsView Modified <<<
238
+ // webpack uses `publicPath` to determine where the app is being served from.
239
+ // It requires a trailing slash, or the file assets will get an incorrect path.
240
+ // We inferred the "public path" (such as / or /my-project) from homepage.
241
+ publicPath: paths.publicUrlOrPath,
242
+ // Point sourcemap entries to original disk location (format as URL on Windows)
243
+ devtoolModuleFilenameTemplate: isEnvProduction
244
+ ? info =>
245
+ path
246
+ .relative(paths.appSrc, info.absoluteResourcePath)
247
+ .replace(/\\/g, '/')
248
+ : isEnvDevelopment &&
249
+ (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
250
+ },
251
+ cache: {
252
+ type: 'filesystem',
253
+ version: createEnvironmentHash(env.raw),
254
+ cacheDirectory: paths.appWebpackCache,
255
+ store: 'pack',
256
+ buildDependencies: {
257
+ defaultWebpack: ['webpack/lib/'],
258
+ config: [__filename],
259
+ tsconfig: [paths.appTsConfig, paths.appJsConfig].filter(f =>
260
+ fs.existsSync(f)
261
+ ),
262
+ },
263
+ },
264
+ infrastructureLogging: {
265
+ level: 'none',
266
+ },
267
+ optimization: {
268
+ minimize: isEnvProduction,
269
+ minimizer: [
270
+ // This is only used in production mode
271
+ new TerserPlugin({
272
+ terserOptions: {
273
+ parse: {
274
+ // We want terser to parse ecma 8 code. However, we don't want it
275
+ // to apply any minification steps that turns valid ecma 5 code
276
+ // into invalid ecma 5 code. This is why the 'compress' and 'output'
277
+ // sections only apply transformations that are ecma 5 safe
278
+ // https://github.com/facebook/create-react-app/pull/4234
279
+ ecma: 8,
280
+ },
281
+ compress: {
282
+ ecma: 5,
283
+ warnings: false,
284
+ // Disabled because of an issue with Uglify breaking seemingly valid code:
285
+ // https://github.com/facebook/create-react-app/issues/2376
286
+ // Pending further investigation:
287
+ // https://github.com/mishoo/UglifyJS2/issues/2011
288
+ comparisons: false,
289
+ // Disabled because of an issue with Terser breaking valid code:
290
+ // https://github.com/facebook/create-react-app/issues/5250
291
+ // Pending further investigation:
292
+ // https://github.com/terser-js/terser/issues/120
293
+ inline: 2,
294
+ },
295
+ mangle: {
296
+ safari10: true,
297
+ },
298
+ // Added for profiling in devtools
299
+ keep_classnames: isEnvProductionProfile,
300
+ keep_fnames: isEnvProductionProfile,
301
+ output: {
302
+ ecma: 5,
303
+ comments: false,
304
+ // Turned on because emoji and regex is not minified properly using default
305
+ // https://github.com/facebook/create-react-app/issues/2488
306
+ ascii_only: true,
307
+ },
308
+ },
309
+ }),
310
+ // This is only used in production mode
311
+ new CssMinimizerPlugin(),
312
+ ],
313
+ },
314
+ resolve: {
315
+ // This allows you to set a fallback for where webpack should look for modules.
316
+ // We placed these paths second because we want `node_modules` to "win"
317
+ // if there are any conflicts. This matches Node resolution mechanism.
318
+ // https://github.com/facebook/create-react-app/issues/253
319
+ modules: ['node_modules', paths.appNodeModules].concat(
320
+ modules.additionalModulePaths || []
321
+ ),
322
+ // These are the reasonable defaults supported by the Node ecosystem.
323
+ // We also include JSX as a common component filename extension to support
324
+ // some tools, although we do not recommend using it, see:
325
+ // https://github.com/facebook/create-react-app/issues/290
326
+ // `web` extension prefixes have been added for better support
327
+ // for React Native Web.
328
+ extensions: paths.moduleFileExtensions
329
+ .map(ext => `.${ext}`)
330
+ .filter(ext => useTypeScript || !ext.includes('ts')),
331
+ alias: {
332
+ // Support React Native Web
333
+ // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
334
+ 'react-native': 'react-native-web',
335
+ // Allows for better profiling with ReactDevTools
336
+ ...(isEnvProductionProfile && {
337
+ 'react-dom$': 'react-dom/profiling',
338
+ 'scheduler/tracing': 'scheduler/tracing-profiling',
339
+ }),
340
+ ...(modules.webpackAliases || {}),
341
+
342
+ // JsView Added >>>
343
+ 'jsview': '@shijiu/jsview-react'
344
+ // JsView Added <<<
345
+ },
346
+ plugins: [
347
+ // Prevents users from importing files from outside of src/ (or node_modules/).
348
+ // This often causes confusion because we only process files within src/ with babel.
349
+ // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
350
+ // please link the files into your node_modules/ and let module-resolution kick in.
351
+ // Make sure your source files are compiled, as they will not be processed in any way.
352
+ new ModuleScopePlugin(paths.appSrc, [
353
+ paths.appPackageJson,
354
+ reactRefreshRuntimeEntry,
355
+ reactRefreshWebpackPluginRuntimeEntry,
356
+ babelRuntimeEntry,
357
+ babelRuntimeEntryHelpers,
358
+ babelRuntimeRegenerator,
359
+ ]),
360
+ ],
361
+ },
362
+ module: {
363
+ strictExportPresence: true,
364
+ rules: [
365
+ // Handle node_modules packages that contain sourcemaps
366
+ shouldUseSourceMap && {
367
+ enforce: 'pre',
368
+ exclude: /@babel(?:\/|\\{1,2})runtime/,
369
+ test: /\.(js|mjs|jsx|ts|tsx|css)$/,
370
+ loader: require.resolve('source-map-loader'),
371
+ },
372
+ {
373
+ // "oneOf" will traverse all following loaders until one will
374
+ // match the requirements. When no loader matches it will fall
375
+ // back to the "file" loader at the end of the loader list.
376
+ oneOf: [
377
+ // TODO: Merge this config once `image/avif` is in the mime-db
378
+ // https://github.com/jshttp/mime-db
379
+ {
380
+ test: [/\.avif$/],
381
+ type: 'asset',
382
+ mimetype: 'image/avif',
383
+ parser: {
384
+ dataUrlCondition: {
385
+ maxSize: imageInlineSizeLimit,
386
+ },
387
+ },
388
+ },
389
+ // "url" loader works like "file" loader except that it embeds assets
390
+ // smaller than specified limit in bytes as data URLs to avoid requests.
391
+ // A missing `test` is equivalent to a match.
392
+ {
393
+ test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
394
+ type: 'asset',
395
+ parser: {
396
+ dataUrlCondition: {
397
+ maxSize: imageInlineSizeLimit,
398
+ },
399
+ },
400
+ },
401
+ {
402
+ test: /\.svg$/,
403
+ use: [
404
+ {
405
+ loader: require.resolve('@svgr/webpack'),
406
+ options: {
407
+ prettier: false,
408
+ svgo: false,
409
+ svgoConfig: {
410
+ plugins: [{ removeViewBox: false }],
411
+ },
412
+ titleProp: true,
413
+ ref: true,
414
+ },
415
+ },
416
+ {
417
+ loader: require.resolve('file-loader'),
418
+ options: {
419
+ // JsView Modified >>>
420
+ // name: 'static/media/[name].[hash].[ext]',
421
+ name: 'media/[name].[hash].[ext]',
422
+ // JsView Modified <<<
423
+ },
424
+ },
425
+ ],
426
+ issuer: {
427
+ and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
428
+ },
429
+ },
430
+ // Process application JS with Babel.
431
+ // The preset includes JSX, Flow, TypeScript, and some ESnext features.
432
+ {
433
+ test: /\.(js|mjs|jsx|ts|tsx)$/,
434
+ // JsView Modified >>>
435
+ // include: paths.appSrc,
436
+ include: [paths.appSrc, paths.jsviewPath, paths.jsviewDebugPath ],
437
+ // JsView Modified <<<
438
+ loader: require.resolve('babel-loader'),
439
+ options: {
440
+ customize: require.resolve(
441
+ 'babel-preset-react-app/webpack-overrides'
442
+ ),
443
+ presets: [
444
+ [
445
+ require.resolve('babel-preset-react-app'),
446
+ {
447
+ runtime: hasJsxRuntime ? 'automatic' : 'classic',
448
+ },
449
+ ],
450
+ ],
451
+ // @remove-on-eject-begin
452
+ babelrc: false,
453
+ configFile: false,
454
+ // Make sure we have a unique cache identifier, erring on the
455
+ // side of caution.
456
+ // We remove this when the user ejects because the default
457
+ // is sane and uses Babel options. Instead of options, we use
458
+ // the react-scripts and babel-preset-react-app versions.
459
+ cacheIdentifier: getCacheIdentifier(
460
+ isEnvProduction
461
+ ? 'production'
462
+ : isEnvDevelopment && 'development',
463
+ [
464
+ 'babel-plugin-named-asset-import',
465
+ 'babel-preset-react-app',
466
+ 'react-dev-utils',
467
+ 'react-scripts',
468
+ ]
469
+ ),
470
+ // @remove-on-eject-end
471
+ plugins: [
472
+ isEnvDevelopment &&
473
+ shouldUseReactRefresh &&
474
+ require.resolve('react-refresh/babel'),
475
+ ].filter(Boolean),
476
+ // This is a feature of `babel-loader` for webpack (not Babel itself).
477
+ // It enables caching results in ./node_modules/.cache/babel-loader/
478
+ // directory for faster rebuilds.
479
+ cacheDirectory: true,
480
+ // See #6846 for context on why cacheCompression is disabled
481
+ cacheCompression: false,
482
+ compact: isEnvProduction,
483
+ },
484
+ },
485
+ // Process any JS outside of the app with Babel.
486
+ // Unlike the application JS, we only compile the standard ES features.
487
+ {
488
+ test: /\.(js|mjs)$/,
489
+ exclude: /@babel(?:\/|\\{1,2})runtime/,
490
+ loader: require.resolve('babel-loader'),
491
+ options: {
492
+ babelrc: false,
493
+ configFile: false,
494
+ compact: false,
495
+ presets: [
496
+ [
497
+ require.resolve('babel-preset-react-app/dependencies'),
498
+ { helpers: true },
499
+ ],
500
+ ],
501
+ cacheDirectory: true,
502
+ // See #6846 for context on why cacheCompression is disabled
503
+ cacheCompression: false,
504
+ // @remove-on-eject-begin
505
+ cacheIdentifier: getCacheIdentifier(
506
+ isEnvProduction
507
+ ? 'production'
508
+ : isEnvDevelopment && 'development',
509
+ [
510
+ 'babel-plugin-named-asset-import',
511
+ 'babel-preset-react-app',
512
+ 'react-dev-utils',
513
+ 'react-scripts',
514
+ ]
515
+ ),
516
+ // @remove-on-eject-end
517
+ // Babel sourcemaps are needed for debugging into node_modules
518
+ // code. Without the options below, debuggers like VSCode
519
+ // show incorrect code and set breakpoints on the wrong lines.
520
+ sourceMaps: shouldUseSourceMap,
521
+ inputSourceMap: shouldUseSourceMap,
522
+ },
523
+ },
524
+ // "postcss" loader applies autoprefixer to our CSS.
525
+ // "css" loader resolves paths in CSS and adds assets as dependencies.
526
+ // "style" loader turns CSS into JS modules that inject <style> tags.
527
+ // In production, we use MiniCSSExtractPlugin to extract that CSS
528
+ // to a file, but in development "style" loader enables hot editing
529
+ // of CSS.
530
+ // By default we support CSS Modules with the extension .module.css
531
+ {
532
+ test: cssRegex,
533
+ exclude: cssModuleRegex,
534
+ use: getStyleLoaders({
535
+ importLoaders: 1,
536
+ sourceMap: isEnvProduction
537
+ ? shouldUseSourceMap
538
+ : isEnvDevelopment,
539
+ modules: {
540
+ mode: 'icss',
541
+ },
542
+ }),
543
+ // Don't consider CSS imports dead code even if the
544
+ // containing package claims to have no side effects.
545
+ // Remove this when webpack adds a warning or an error for this.
546
+ // See https://github.com/webpack/webpack/issues/6571
547
+ sideEffects: true,
548
+ },
549
+ // Adds support for CSS Modules (https://github.com/css-modules/css-modules)
550
+ // using the extension .module.css
551
+ {
552
+ test: cssModuleRegex,
553
+ use: getStyleLoaders({
554
+ importLoaders: 1,
555
+ sourceMap: isEnvProduction
556
+ ? shouldUseSourceMap
557
+ : isEnvDevelopment,
558
+ modules: {
559
+ mode: 'local',
560
+ getLocalIdent: getCSSModuleLocalIdent,
561
+ },
562
+ }),
563
+ },
564
+ // Opt-in support for SASS (using .scss or .sass extensions).
565
+ // By default we support SASS Modules with the
566
+ // extensions .module.scss or .module.sass
567
+ {
568
+ test: sassRegex,
569
+ exclude: sassModuleRegex,
570
+ use: getStyleLoaders(
571
+ {
572
+ importLoaders: 3,
573
+ sourceMap: isEnvProduction
574
+ ? shouldUseSourceMap
575
+ : isEnvDevelopment,
576
+ modules: {
577
+ mode: 'icss',
578
+ },
579
+ },
580
+ 'sass-loader'
581
+ ),
582
+ // Don't consider CSS imports dead code even if the
583
+ // containing package claims to have no side effects.
584
+ // Remove this when webpack adds a warning or an error for this.
585
+ // See https://github.com/webpack/webpack/issues/6571
586
+ sideEffects: true,
587
+ },
588
+ // Adds support for CSS Modules, but using SASS
589
+ // using the extension .module.scss or .module.sass
590
+ {
591
+ test: sassModuleRegex,
592
+ use: getStyleLoaders(
593
+ {
594
+ importLoaders: 3,
595
+ sourceMap: isEnvProduction
596
+ ? shouldUseSourceMap
597
+ : isEnvDevelopment,
598
+ modules: {
599
+ mode: 'local',
600
+ getLocalIdent: getCSSModuleLocalIdent,
601
+ },
602
+ },
603
+ 'sass-loader'
604
+ ),
605
+ },
606
+ // "file" loader makes sure those assets get served by WebpackDevServer.
607
+ // When you `import` an asset, you get its (virtual) filename.
608
+ // In production, they would get copied to the `build` folder.
609
+ // This loader doesn't use a "test" so it will catch all modules
610
+ // that fall through the other loaders.
611
+ {
612
+ // Exclude `js` files to keep "css" loader working as it injects
613
+ // its runtime that would otherwise be processed through "file" loader.
614
+ // Also exclude `html` and `json` extensions so they get processed
615
+ // by webpacks internal loaders.
616
+ exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
617
+ type: 'asset/resource',
618
+ },
619
+ // ** STOP ** Are you adding a new loader?
620
+ // Make sure to add the new loader(s) before the "file" loader.
621
+ ],
622
+ },
623
+ ].filter(Boolean),
624
+ },
625
+ plugins: [
626
+ // Generates an `index.html` file with the <script> injected.
627
+ new HtmlWebpackPlugin(
628
+ Object.assign(
629
+ {},
630
+ {
631
+ inject: true,
632
+ template: paths.appHtml,
633
+ },
634
+ isEnvProduction
635
+ ? {
636
+ minify: {
637
+ removeComments: true,
638
+ collapseWhitespace: true,
639
+ removeRedundantAttributes: true,
640
+ useShortDoctype: true,
641
+ removeEmptyAttributes: true,
642
+ removeStyleLinkTypeAttributes: true,
643
+ keepClosingSlash: true,
644
+ minifyJS: true,
645
+ minifyCSS: true,
646
+ minifyURLs: true,
647
+ },
648
+ }
649
+ : undefined
650
+ )
651
+ ),
652
+ // Inlines the webpack runtime script. This script is too small to warrant
653
+ // a network request.
654
+ // https://github.com/facebook/create-react-app/issues/5358
655
+ isEnvProduction &&
656
+ shouldInlineRuntimeChunk &&
657
+ new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
658
+ // Makes some environment variables available in index.html.
659
+ // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
660
+ // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
661
+ // It will be an empty string unless you specify "homepage"
662
+ // in `package.json`, in which case it will be the pathname of that URL.
663
+ new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),
664
+ // This gives some necessary context to module not found errors, such as
665
+ // the requesting resource.
666
+ new ModuleNotFoundPlugin(paths.appPath),
667
+ // Makes some environment variables available to the JS code, for example:
668
+ // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
669
+ // It is absolutely essential that NODE_ENV is set to production
670
+ // during a production build.
671
+ // Otherwise React will be compiled in the very slow development mode.
672
+ new webpack.DefinePlugin(env.stringified),
673
+ // Experimental hot reloading for React .
674
+ // https://github.com/facebook/react/tree/main/packages/react-refresh
675
+ isEnvDevelopment &&
676
+ shouldUseReactRefresh &&
677
+ new ReactRefreshWebpackPlugin({
678
+ overlay: false,
679
+ }),
680
+ // Watcher doesn't work well if you mistype casing in a path so we use
681
+ // a plugin that prints an error when you attempt to do this.
682
+ // See https://github.com/facebook/create-react-app/issues/240
683
+ isEnvDevelopment && new CaseSensitivePathsPlugin(),
684
+ isEnvProduction &&
685
+ new MiniCssExtractPlugin({
686
+ // Options similar to the same options in webpackOptions.output
687
+ // both options are optional
688
+ // JsView Modified >>>
689
+ // filename: 'static/css/[name].[contenthash:8].css',
690
+ // chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
691
+ filename: 'css/[name].[contenthash:8].css',
692
+ chunkFilename: 'css/[name].[contenthash:8].chunk.css',
693
+ // JsView Modified <<<
694
+ }),
695
+ // Generate an asset manifest file with the following content:
696
+ // - "files" key: Mapping of all asset filenames to their corresponding
697
+ // output file so that tools can pick it up without having to parse
698
+ // `index.html`
699
+ // - "entrypoints" key: Array of files which are included in `index.html`,
700
+ // can be used to reconstruct the HTML if necessary
701
+ new WebpackManifestPlugin({
702
+ fileName: 'asset-manifest.json',
703
+ publicPath: paths.publicUrlOrPath,
704
+ generate: (seed, files, entrypoints) => {
705
+ const manifestFiles = files.reduce((manifest, file) => {
706
+ manifest[file.name] = file.path;
707
+ return manifest;
708
+ }, seed);
709
+ const entrypointFiles = entrypoints.main.filter(
710
+ fileName => !fileName.endsWith('.map')
711
+ );
712
+
713
+ return {
714
+ files: manifestFiles,
715
+ entrypoints: entrypointFiles,
716
+ };
717
+ },
718
+ }),
719
+ // Moment.js is an extremely popular library that bundles large locale files
720
+ // by default due to how webpack interprets its code. This is a practical
721
+ // solution that requires the user to opt into importing specific locales.
722
+ // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
723
+ // You can remove this if you don't use Moment.js:
724
+ new webpack.IgnorePlugin({
725
+ resourceRegExp: /^\.\/locale$/,
726
+ contextRegExp: /moment$/,
727
+ }),
728
+ // Generate a service worker script that will precache, and keep up to date,
729
+ // the HTML & assets that are part of the webpack build.
730
+ isEnvProduction &&
731
+ fs.existsSync(swSrc) &&
732
+ new WorkboxWebpackPlugin.InjectManifest({
733
+ swSrc,
734
+ dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./,
735
+ exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/],
736
+ // Bump up the default maximum size (2mb) that's precached,
737
+ // to make lazy-loading failure scenarios less likely.
738
+ // See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
739
+ maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
740
+ }),
741
+ // TypeScript type checking
742
+ useTypeScript &&
743
+ new ForkTsCheckerWebpackPlugin({
744
+ async: isEnvDevelopment,
745
+ typescript: {
746
+ typescriptPath: resolve.sync('typescript', {
747
+ basedir: paths.appNodeModules,
748
+ }),
749
+ configOverwrite: {
750
+ compilerOptions: {
751
+ sourceMap: isEnvProduction
752
+ ? shouldUseSourceMap
753
+ : isEnvDevelopment,
754
+ skipLibCheck: true,
755
+ inlineSourceMap: false,
756
+ declarationMap: false,
757
+ noEmit: true,
758
+ incremental: true,
759
+ tsBuildInfoFile: paths.appTsBuildInfoFile,
760
+ },
761
+ },
762
+ context: paths.appPath,
763
+ diagnosticOptions: {
764
+ syntactic: true,
765
+ },
766
+ mode: 'write-references',
767
+ // profile: true,
768
+ },
769
+ issue: {
770
+ // This one is specifically to match during CI tests,
771
+ // as micromatch doesn't match
772
+ // '../cra-template-typescript/template/src/App.tsx'
773
+ // otherwise.
774
+ include: [
775
+ { file: '../**/src/**/*.{ts,tsx}' },
776
+ { file: '**/src/**/*.{ts,tsx}' },
777
+ ],
778
+ exclude: [
779
+ { file: '**/src/**/__tests__/**' },
780
+ { file: '**/src/**/?(*.){spec|test}.*' },
781
+ { file: '**/src/setupProxy.*' },
782
+ { file: '**/src/setupTests.*' },
783
+ ],
784
+ },
785
+ logger: {
786
+ infrastructure: 'silent',
787
+ },
788
+ }),
789
+ !disableESLintPlugin &&
790
+ new ESLintPlugin({
791
+ // Plugin options
792
+ extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
793
+ formatter: require.resolve('react-dev-utils/eslintFormatter'),
794
+ eslintPath: require.resolve('eslint'),
795
+ failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
796
+ context: paths.appSrc,
797
+ cache: true,
798
+ cacheLocation: path.resolve(
799
+ paths.appNodeModules,
800
+ '.cache/.eslintcache'
801
+ ),
802
+ // ESLint class options
803
+ cwd: paths.appPath,
804
+ resolvePluginsRelativeTo: __dirname,
805
+ baseConfig: {
806
+ extends: [require.resolve('eslint-config-react-app/base')],
807
+ rules: {
808
+ ...(!hasJsxRuntime && {
809
+ 'react/react-in-jsx-scope': 'error',
810
+ }),
811
+ },
812
+ },
813
+ }),
814
+ ].filter(Boolean),
815
+ // Turn off performance processing because we utilize
816
+ // our own hints via the FileSizeReporter
817
+ performance: false,
818
+
819
+ // JsView Added >>>
820
+ experiments: {
821
+ topLevelAwait: true
822
+ },
823
+ // JsView Added <<<
824
+ };
825
+ };
@@ -0,0 +1,108 @@
1
+ {
2
+ "name": "react-scripts",
3
+ "version": "5.0.1",
4
+ "description": "Configuration and scripts for Create React App.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/facebook/create-react-app.git",
8
+ "directory": "packages/react-scripts"
9
+ },
10
+ "license": "MIT",
11
+ "engines": {
12
+ "node": ">=14.0.0"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/facebook/create-react-app/issues"
16
+ },
17
+ "files": [
18
+ "bin",
19
+ "config",
20
+ "lib",
21
+ "scripts",
22
+ "template",
23
+ "template-typescript",
24
+ "utils"
25
+ ],
26
+ "bin": {
27
+ "react-scripts": "./bin/react-scripts.js"
28
+ },
29
+ "types": "./lib/react-app.d.ts",
30
+ "dependencies": {
31
+ "@babel/core": "^7.16.0",
32
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
33
+ "@svgr/webpack": "^5.5.0",
34
+ "babel-jest": "^27.4.2",
35
+ "babel-loader": "^8.2.3",
36
+ "babel-plugin-named-asset-import": "^0.3.8",
37
+ "babel-preset-react-app": "^10.0.1",
38
+ "bfj": "^7.0.2",
39
+ "browserslist": "^4.18.1",
40
+ "camelcase": "^6.2.1",
41
+ "case-sensitive-paths-webpack-plugin": "^2.4.0",
42
+ "css-loader": "^6.5.1",
43
+ "css-minimizer-webpack-plugin": "^3.2.0",
44
+ "dotenv": "^10.0.0",
45
+ "dotenv-expand": "^5.1.0",
46
+ "eslint": "^8.3.0",
47
+ "eslint-config-react-app": "^7.0.1",
48
+ "eslint-webpack-plugin": "^3.1.1",
49
+ "file-loader": "^6.2.0",
50
+ "fs-extra": "^10.0.0",
51
+ "html-webpack-plugin": "^5.5.0",
52
+ "identity-obj-proxy": "^3.0.0",
53
+ "jest": "^27.4.3",
54
+ "jest-resolve": "^27.4.2",
55
+ "jest-watch-typeahead": "^1.0.0",
56
+ "mini-css-extract-plugin": "^2.4.5",
57
+ "postcss": "^8.4.4",
58
+ "postcss-flexbugs-fixes": "^5.0.2",
59
+ "postcss-loader": "^6.2.1",
60
+ "postcss-normalize": "^10.0.1",
61
+ "postcss-preset-env": "^7.0.1",
62
+ "prompts": "^2.4.2",
63
+ "react-app-polyfill": "^3.0.0",
64
+ "react-dev-utils": "^12.0.1",
65
+ "react-refresh": "^0.11.0",
66
+ "resolve": "^1.20.0",
67
+ "resolve-url-loader": "^4.0.0",
68
+ "sass-loader": "^12.3.0",
69
+ "semver": "^7.3.5",
70
+ "source-map-loader": "^3.0.0",
71
+ "style-loader": "^3.3.1",
72
+ "tailwindcss": "^3.0.2",
73
+ "terser-webpack-plugin": "^5.2.5",
74
+ "webpack": "^5.64.4",
75
+ "webpack-dev-server": "^4.6.0",
76
+ "webpack-manifest-plugin": "^4.0.2",
77
+ "workbox-webpack-plugin": "^6.4.1"
78
+ },
79
+ "devDependencies": {
80
+ "react": "^18.0.0",
81
+ "react-dom": "^18.0.0"
82
+ },
83
+ "optionalDependencies": {
84
+ "fsevents": "^2.3.2"
85
+ },
86
+ "peerDependencies": {
87
+ "react": ">= 16",
88
+ "typescript": "^3.2.1 || ^4"
89
+ },
90
+ "peerDependenciesMeta": {
91
+ "typescript": {
92
+ "optional": true
93
+ }
94
+ },
95
+ "browserslist": {
96
+ "production": [
97
+ ">0.2%",
98
+ "not dead",
99
+ "not op_mini all"
100
+ ],
101
+ "development": [
102
+ "last 1 chrome version",
103
+ "last 1 firefox version",
104
+ "last 1 safari version"
105
+ ]
106
+ },
107
+ "gitHead": "19fa58d527ae74f2b6baa0867463eea1d290f9a5"
108
+ }
@@ -22,7 +22,7 @@ export default defineConfig({
22
22
  },
23
23
  },
24
24
  sourcemap: true,
25
- target: 'es2017', // 不转译async/await
25
+ target: 'es2022', // 不转译async/await
26
26
  },
27
27
  isCustomElement: (tag) => {
28
28
  return tag == 'fdiv' || tag.startsWith('jsv-')
@@ -30,10 +30,12 @@ export default defineConfig({
30
30
  optimizeDeps: {
31
31
  exclude: [
32
32
  '@shijiu/jsview/loader/jsview-main.js', // 解决windows上出现解析异常的问题。
33
- 'node_modules/@shijiu/jsview-vue',
34
- 'node_modules/@shijiu/jsview-vue-samples',
35
- 'node_modules/@shijiu/jsview-react',
36
- 'node_modules/@shijiu/jsview-react-samples',
33
+ 'jsview',
34
+ 'jsview-vue',
35
+ 'jsview-vue-samples',
36
+ 'jsview-react-samples',
37
+ 'jsview-vue-samples',
38
+ 'node_modules/@shijiu',
37
39
  ],
38
40
  },
39
41
  plugins: [
@@ -52,7 +54,7 @@ export default defineConfig({
52
54
  },
53
55
  server: {
54
56
  host: true,
55
- // open: true,
57
+ open: process.platform === "darwin",
56
58
  watch: {
57
59
  ignored: [
58
60
  '!**/node_modules/@shijiu/**',
package/tools/common.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
5
 
6
- function cpSync(workDir, src, dest) {
6
+ function cpSync(workDir, src, dest, ignore=[]) {
7
7
  const exists = fs.existsSync(src);
8
8
  const stats = exists && fs.statSync(src);
9
9
  const isDirectory = exists && stats.isDirectory();
@@ -15,10 +15,15 @@ function cpSync(workDir, src, dest) {
15
15
  cpSync(
16
16
  workDir,
17
17
  path.join(src, childItemName),
18
- path.join(dest, childItemName)
18
+ path.join(dest, childItemName),
19
+ ignore
19
20
  );
20
21
  });
21
22
  } else {
23
+ const filename = path.basename(src);
24
+ if (ignore && ignore.includes(filename)) {
25
+ return;
26
+ }
22
27
  console.info(
23
28
  " " + path.relative(workDir, src) + " -> " + path.relative(workDir, dest)
24
29
  );
@@ -138,7 +138,7 @@ function makeDebugMap(options)
138
138
  const jsmapServeName = "jsview-jsmap-serve.js";
139
139
  const jsmapServePath = path.resolve(options.toolsDir, jsmapServeName);
140
140
  if (!fs.existsSync(jsmapServePath)) {
141
- console.error("Failed to copy jsview-jsmap-serve.js, file not exists.");
141
+ console.error("Failed to copy " + jsmapServePath + ", file not exists.");
142
142
  process.exit(1);
143
143
  }
144
144
 
@@ -151,11 +151,11 @@ function main() {
151
151
  const options = {};
152
152
  options.projectDir = process.cwd();
153
153
  options.modulesDir = path.resolve(options.projectDir, "node_modules");
154
- options.jsviewDir = path.resolve(options.modulesDir, "@shijiu', 'jsview");
154
+ options.jsviewDir = path.resolve(options.modulesDir, "@shijiu", "jsview");
155
155
  options.patchesDir = path.resolve(options.jsviewDir, "patches");
156
156
  options.toolsDir = path.resolve(options.jsviewDir, "tools");
157
157
  options.distDir = path.resolve(options.projectDir, "dist");
158
- options.appConfigDir = path.resolve(options.projectDir, "src', 'appConfig");
158
+ options.appConfigDir = path.resolve(options.projectDir, "src", "appConfig");
159
159
  options.debugDir = path.resolve(options.distDir, "debug");
160
160
  options.mapDir = path.resolve(options.debugDir, "map");
161
161
 
@@ -4,9 +4,7 @@ const { doPostInstall } = require('./jsview-post-install');
4
4
 
5
5
  function main() {
6
6
  const pkgNeedPatch = [
7
- '@vitejs/plugin-react',
8
- 'postcss-js',
9
- 'vite',
7
+ 'react-scripts',
10
8
  ];
11
9
  doPostInstall('react', pkgNeedPatch, argv.skipCheckVersion);
12
10
  }
@@ -56,7 +56,7 @@ function installPatches(options, pkgNeedPatch) {
56
56
  const patchSrc = path.resolve(options.patchesDir, 'node_modules', pkgName);
57
57
  const patchDest = path.resolve(options.modulesDir, pkgName);
58
58
 
59
- cpSync(options.projectDir, patchSrc, patchDest);
59
+ cpSync(options.projectDir, patchSrc, patchDest, ['package.json']);
60
60
  }
61
61
 
62
62
  console.info('\nCleanup node_modules cache... ');