@qse/edu-scripts 1.13.7 → 1.13.8

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,53 +1,55 @@
1
- "use strict";
2
-
3
- const getOverride = require('../utils/getOverride');
4
-
5
- /**
6
- * @typedef {Object} Opts
7
- * @property {string} [modules]
8
- *
9
- * @param {Opts} [opts]
10
- * @return {*}
11
- */
1
+ // src/config/babel.dependencies.js
2
+ var getOverride = require("../utils/getOverride");
12
3
  module.exports = function getBabelConfig(opts = {}) {
13
- const isDev = process.env.NODE_ENV === 'development';
4
+ const isDev = process.env.NODE_ENV === "development";
14
5
  let config = {
15
6
  cacheDirectory: true,
16
7
  cacheCompression: false,
17
8
  babelrc: false,
18
9
  configFile: false,
19
- sourceType: 'unambiguous',
10
+ sourceType: "unambiguous",
20
11
  compact: false,
21
12
  sourceMaps: isDev,
22
13
  inputSourceMap: isDev,
23
- presets: [['@babel/preset-env', {
24
- modules: opts.modules,
25
- useBuiltIns: 'entry',
26
- corejs: 3,
27
- // Exclude transforms that make all code slower
28
- exclude: ['transform-typeof-symbol']
29
- }]].filter(Boolean),
30
- plugins: [['@babel/plugin-transform-runtime', {
31
- corejs: false,
32
- helpers: true,
33
- // By default, babel assumes babel/runtime version 7.0.0-beta.0,
34
- // explicitly resolving to match the provided helper functions.
35
- // https://github.com/babel/babel/issues/10261
36
- version: require('@babel/runtime/package.json').version,
37
- regenerator: true
38
- // // https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
39
- // // We should turn this on once the lowest version of Node LTS
40
- // // supports ES Modules.
41
- // useESModules: true,
42
- }], ['import', {
43
- libraryName: 'lodash',
44
- libraryDirectory: '',
45
- camel2DashComponentName: false
46
- }, 'lodash']].filter(Boolean)
14
+ presets: [
15
+ [
16
+ "@babel/preset-env",
17
+ {
18
+ modules: opts.modules,
19
+ useBuiltIns: "entry",
20
+ corejs: 3,
21
+ // Exclude transforms that make all code slower
22
+ exclude: ["transform-typeof-symbol"]
23
+ }
24
+ ]
25
+ ].filter(Boolean),
26
+ plugins: [
27
+ [
28
+ "@babel/plugin-transform-runtime",
29
+ {
30
+ corejs: false,
31
+ helpers: true,
32
+ // By default, babel assumes babel/runtime version 7.0.0-beta.0,
33
+ // explicitly resolving to match the provided helper functions.
34
+ // https://github.com/babel/babel/issues/10261
35
+ version: require("@babel/runtime/package.json").version,
36
+ regenerator: true
37
+ // // https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
38
+ // // We should turn this on once the lowest version of Node LTS
39
+ // // supports ES Modules.
40
+ // useESModules: true,
41
+ }
42
+ ],
43
+ [
44
+ "import",
45
+ { libraryName: "lodash", libraryDirectory: "", camel2DashComponentName: false },
46
+ "lodash"
47
+ ]
48
+ ].filter(Boolean)
47
49
  };
48
50
  const override = getOverride();
49
51
  if (override.babel) {
50
- config = override.babel(config, 'node_modules') || config;
52
+ config = override.babel(config, "node_modules") || config;
51
53
  }
52
54
  return config;
53
- };
55
+ };
@@ -1,74 +1,101 @@
1
- "use strict";
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from))
10
+ if (!__hasOwnProp.call(to, key) && key !== except)
11
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ }
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
2
23
 
3
- const fs = require('fs');
4
- const paths = require('./paths');
5
- const appConfig = require('../utils/appConfig');
6
- const getOverride = require('../utils/getOverride');
7
- const hasJsxRuntime = (() => {
24
+ // src/config/babel.js
25
+ var fs = require("fs");
26
+ var paths = require("./paths");
27
+ var appConfig = require("../utils/appConfig");
28
+ var getOverride = require("../utils/getOverride");
29
+ var hasJsxRuntime = (() => {
8
30
  try {
9
- require.resolve('react/jsx-runtime');
10
- return true && appConfig.single;
31
+ require.resolve("react/jsx-runtime");
32
+ return appConfig.single;
11
33
  } catch (error) {
12
34
  return false;
13
35
  }
14
36
  })();
15
-
16
- /**
17
- * @typedef {Object} Opts
18
- * @property {string} [modules]
19
- *
20
- * @param {Opts} [opts]
21
- * @return {*}
22
- */
23
37
  module.exports = function getBabelConfig(opts = {}) {
24
38
  const isTypeScriptEnabled = fs.existsSync(paths.tsconfig);
25
- const isDev = process.env.NODE_ENV === 'development';
39
+ const isDev = process.env.NODE_ENV === "development";
26
40
  let config = {
27
41
  cacheDirectory: true,
28
42
  cacheCompression: false,
29
43
  compact: !isDev,
30
44
  babelrc: false,
31
45
  configFile: false,
32
- presets: [['@babel/preset-env', {
33
- modules: opts.modules,
34
- useBuiltIns: 'entry',
35
- corejs: 3,
36
- // Exclude transforms that make all code slower
37
- exclude: ['transform-typeof-symbol']
38
- }], ['@babel/preset-react', {
39
- development: isDev,
40
- runtime: hasJsxRuntime ? 'automatic' : 'classic',
41
- useBuiltIns: !hasJsxRuntime
42
- }], isTypeScriptEnabled && '@babel/preset-typescript'].filter(Boolean),
43
- plugins: [['@babel/plugin-transform-runtime', {
44
- corejs: false,
45
- helpers: true,
46
- // By default, babel assumes babel/runtime version 7.0.0-beta.0,
47
- // explicitly resolving to match the provided helper functions.
48
- // https://github.com/babel/babel/issues/10261
49
- version: require('@babel/runtime/package.json').version,
50
- regenerator: true
51
- // // https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
52
- // // We should turn this on once the lowest version of Node LTS
53
- // // supports ES Modules.
54
- // useESModules: true,
55
- }], ['@babel/plugin-proposal-decorators', {
56
- legacy: true
57
- }], ['@babel/plugin-proposal-class-properties', {
58
- loose: true
59
- }], ['@babel/plugin-proposal-private-methods', {
60
- loose: true
61
- }], ['@babel/plugin-proposal-private-property-in-object', {
62
- loose: true
63
- }], ['import', {
64
- libraryName: 'lodash',
65
- libraryDirectory: '',
66
- camel2DashComponentName: false
67
- }, 'lodash'], isDev && 'react-refresh/babel'].filter(Boolean)
46
+ presets: [
47
+ [
48
+ "@babel/preset-env",
49
+ {
50
+ modules: opts.modules,
51
+ useBuiltIns: "entry",
52
+ corejs: 3,
53
+ // Exclude transforms that make all code slower
54
+ exclude: ["transform-typeof-symbol"]
55
+ }
56
+ ],
57
+ [
58
+ "@babel/preset-react",
59
+ {
60
+ development: isDev,
61
+ runtime: hasJsxRuntime ? "automatic" : "classic",
62
+ useBuiltIns: !hasJsxRuntime
63
+ }
64
+ ],
65
+ isTypeScriptEnabled && "@babel/preset-typescript"
66
+ ].filter(Boolean),
67
+ plugins: [
68
+ [
69
+ "@babel/plugin-transform-runtime",
70
+ {
71
+ corejs: false,
72
+ helpers: true,
73
+ // By default, babel assumes babel/runtime version 7.0.0-beta.0,
74
+ // explicitly resolving to match the provided helper functions.
75
+ // https://github.com/babel/babel/issues/10261
76
+ version: require("@babel/runtime/package.json").version,
77
+ regenerator: true
78
+ // // https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
79
+ // // We should turn this on once the lowest version of Node LTS
80
+ // // supports ES Modules.
81
+ // useESModules: true,
82
+ }
83
+ ],
84
+ ["@babel/plugin-proposal-decorators", { legacy: true }],
85
+ ["@babel/plugin-proposal-class-properties", { loose: true }],
86
+ ["@babel/plugin-proposal-private-methods", { loose: true }],
87
+ ["@babel/plugin-proposal-private-property-in-object", { loose: true }],
88
+ [
89
+ "import",
90
+ { libraryName: "lodash", libraryDirectory: "", camel2DashComponentName: false },
91
+ "lodash"
92
+ ],
93
+ isDev && "react-refresh/babel"
94
+ ].filter(Boolean)
68
95
  };
69
96
  const override = getOverride();
70
97
  if (override.babel) {
71
- config = override.babel(config, 'src') || config;
98
+ config = override.babel(config, "src") || config;
72
99
  }
73
100
  return config;
74
- };
101
+ };
@@ -1,38 +1,35 @@
1
- "use strict";
2
-
3
- const path = require('path');
4
- const fs = require('fs');
5
- const glob = require('globby');
1
+ // src/config/paths.js
2
+ var path = require("path");
3
+ var fs = require("fs");
4
+ var glob = require("globby");
6
5
  function resolveApp(...filePath) {
7
6
  return path.resolve(process.cwd(), ...filePath);
8
7
  }
9
- function getExistPath(...paths) {
10
- for (const path of paths) {
11
- if (fs.existsSync(path)) {
12
- return path;
8
+ function getExistPath(...paths2) {
9
+ for (const path2 of paths2) {
10
+ if (fs.existsSync(path2)) {
11
+ return path2;
13
12
  }
14
13
  }
15
- return paths[0];
14
+ return paths2[0];
16
15
  }
17
- const paths = {
16
+ var paths = {
18
17
  resolveApp,
19
- eduAppEnv: resolveApp('src', 'edu-app-env.d.ts'),
20
- dist: resolveApp('dist'),
21
- sshSftp: resolveApp('.sftprc.json'),
22
- nodeModules: resolveApp('node_modules'),
23
- tsconfig: resolveApp('tsconfig.json'),
24
- jsconfig: resolveApp('jsconfig.json'),
25
- package: resolveApp('package.json'),
26
- tailwind: resolveApp('tailwind.config.js'),
27
- indexJS: resolveApp('src', 'index.js'),
28
- pages: resolveApp('src', 'pages'),
29
- override: resolveApp('edu-scripts.override.js'),
30
- indexHTML: glob.sync('./public/*.html', {
31
- absolute: true
32
- }),
33
- src: resolveApp('src'),
34
- public: resolveApp('public'),
35
- static: resolveApp('public', 'static'),
36
- theme: getExistPath(resolveApp('theme.json'), resolveApp('theme.js'))
18
+ eduAppEnv: resolveApp("src", "edu-app-env.d.ts"),
19
+ dist: resolveApp("dist"),
20
+ sshSftp: resolveApp(".sftprc.json"),
21
+ nodeModules: resolveApp("node_modules"),
22
+ tsconfig: resolveApp("tsconfig.json"),
23
+ jsconfig: resolveApp("jsconfig.json"),
24
+ package: resolveApp("package.json"),
25
+ tailwind: resolveApp("tailwind.config.js"),
26
+ indexJS: resolveApp("src", "index.js"),
27
+ pages: resolveApp("src", "pages"),
28
+ override: resolveApp("edu-scripts.override.js"),
29
+ indexHTML: glob.sync("./public/*.html", { absolute: true }),
30
+ src: resolveApp("src"),
31
+ public: resolveApp("public"),
32
+ static: resolveApp("public", "static"),
33
+ theme: getExistPath(resolveApp("theme.json"), resolveApp("theme.js"))
37
34
  };
38
- module.exports = paths;
35
+ module.exports = paths;
@@ -1,19 +1,19 @@
1
- "use strict";
2
-
3
- const vars = ['safe-area-inset-top', 'safe-area-inset-bottom', 'safe-area-inset-left', 'safe-area-inset-right'];
4
- const expr = new RegExp(`env\\(\\s*(${vars.join('|')})\\s*,?\\s*([^)]+)?\\s*\\)`, 'g');
5
-
6
- /** @type {import('postcss').PluginCreator} */
1
+ // src/config/plugins/postcss-safe-area.js
2
+ var vars = [
3
+ "safe-area-inset-top",
4
+ "safe-area-inset-bottom",
5
+ "safe-area-inset-left",
6
+ "safe-area-inset-right"
7
+ ];
8
+ var expr = new RegExp(`env\\(\\s*(${vars.join("|")})\\s*,?\\s*([^)]+)?\\s*\\)`, "g");
7
9
  module.exports = () => {
8
10
  return {
9
- postcssPlugin: 'postcss-safe-area',
11
+ postcssPlugin: "postcss-safe-area",
10
12
  Declaration(decl) {
11
- const fallback = decl.value.replace(expr, (match, param, defaultValue) => defaultValue || '0');
13
+ const fallback = decl.value.replace(expr, (match, param, defaultValue) => defaultValue || "0");
12
14
  if (fallback !== decl.value) {
13
- decl.cloneBefore({
14
- value: fallback
15
- });
15
+ decl.cloneBefore({ value: fallback });
16
16
  }
17
17
  }
18
18
  };
19
- };
19
+ };