huan-simple-html 1.0.1 → 1.1.0

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/.eslintrc.cjs CHANGED
@@ -11,6 +11,7 @@ module.exports = {
11
11
  es6: true
12
12
  },
13
13
  parserOptions: {
14
+ ecmaVersion: 11,
14
15
  sourceType: 'module'
15
16
  },
16
17
  extends: ['prettier', 'eslint:recommended', 'plugin:prettier/recommended'],
package/.npmignore CHANGED
@@ -9,8 +9,13 @@ lerna-debug.log*
9
9
 
10
10
  # Node
11
11
  node_modules
12
- huan-simple-html-1.0.0.tgz
13
12
  .npmrc
13
+ pnpm-lock.yaml
14
+ package-lock.json
15
+ yarn.lock
16
+
17
+ # Pack
18
+ huan-*.tgz
14
19
 
15
20
  # Build
16
21
  dist
@@ -0,0 +1,36 @@
1
+ const config = {
2
+ presets: [
3
+ [
4
+ '@babel/preset-env', // 使用 @babel/preset-env 转换语法
5
+ {
6
+ // 目标环境配置,根据需要调整
7
+ targets: {
8
+ browsers: [
9
+ // 你可以指定具体的浏览器版本,例如:
10
+ // "last 2 versions",
11
+ // ">= 1%",
12
+ // "Chrome >= 49",
13
+ // "Firefox >= 45",
14
+ // 或使用 "defaults" 自动选择一组常见的浏览器版本
15
+ 'defaults'
16
+ ]
17
+ },
18
+ // 启用或禁用模块转换
19
+ modules: false, // 或 "auto" / "commonjs"
20
+
21
+ // 可选:按需加载 polyfills
22
+ useBuiltIns: 'usage', // 根据代码实际使用情况自动引入 polyfills
23
+ corejs: 3 // 如果使用按需加载,需要指定 core-js 的版本
24
+
25
+ // 可选:包含或排除特定的 transforms
26
+ // exclude: ['transform-regenerator'], // 例如,排除 regenerator 转换
27
+ // include: ['@babel/plugin-proposal-class-properties'], // 或者包含额外的提案特性
28
+ }
29
+ ]
30
+ ],
31
+
32
+ // 可选:包含全局的 Babel 插件
33
+ plugins: []
34
+ }
35
+
36
+ export default config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huan-simple-html",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "一个简单的HTML项目,通过Webpack进行打包。请尽量使用pnpm处理此包。更多细节请查看\"README.md\"",
5
5
  "keywords": [
6
6
  "html",
@@ -25,7 +25,11 @@
25
25
  "pnpm": ">=8"
26
26
  },
27
27
  "devDependencies": {
28
+ "@babel/core": "^7.26.0",
29
+ "@babel/preset-env": "^7.26.0",
30
+ "babel-loader": "^9.2.1",
28
31
  "copy-webpack-plugin": "^12.0.2",
32
+ "core-js": "3",
29
33
  "css-loader": "^7.1.2",
30
34
  "eslint": "^8.38.0",
31
35
  "eslint-config-prettier": "^8.8.0",
@@ -48,8 +52,8 @@
48
52
  "webpack-cli": "^6.0.1",
49
53
  "webpack-dev-server": "^5.2.0"
50
54
  },
51
- "dependencies": {},
52
55
  "scripts": {
56
+ "init": "npx pnpm install",
53
57
  "lint": "eslint --ext .js,.mjs,.cjs,.ts --fix .",
54
58
  "lint:debug": "eslint --ext .js,.mjs,.cjs,.ts --debug --fix .",
55
59
  "dev": "npx webpack server --config webpack_config_dev.js",
@@ -60,6 +64,9 @@
60
64
  "build:prod:run": "npx pnpm build:prod && npx pnpm prod",
61
65
  "github": "npx webpack server --config webpack_config_github.js",
62
66
  "build:github": "npx webpack --config webpack_config_github.js && node github-page/cname.js",
63
- "build:github:run": "npx pnpm build:github && npx pnpm github"
67
+ "pack": "npx pnpm run init && npx pnpm run lint && npx pnpm pack",
68
+ "build:github:run": "npx pnpm build:github && npx pnpm github",
69
+ "login:npmjs": "npx pnpm login --registry=https://registry.npmjs.org",
70
+ "publish:npmjs": "npx pnpm publish --registry=https://registry.npmjs.org"
64
71
  }
65
72
  }
package/src/common.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // 清理状态
2
2
  import 'normalize.css'
3
- import jQuery from 'jquery';
3
+ import jQuery from 'jquery'
4
4
 
5
5
  import Logo from './assets/image/logo.png'
6
6
  import WangAn from './assets/image/wangan.png'
@@ -20,5 +20,5 @@ window.WangAn = WangAn
20
20
  window.SongZihuan = SongZihuan
21
21
  window.LogoBig = LogoBin
22
22
 
23
- window.jQuery = jQuery;
24
- window.$ = jQuery;
23
+ window.jQuery = jQuery
24
+ window.$ = jQuery
package/src/utils/file.js CHANGED
@@ -1,5 +1,5 @@
1
- import path from "path"
2
- import fs from "fs"
1
+ import path from 'path'
2
+ import fs from 'fs'
3
3
 
4
4
  export default {
5
5
  getAllFilePaths
@@ -1,12 +1,12 @@
1
- import path from "path"
2
- import HtmlWebpackPlugin from "html-webpack-plugin";
3
- import MiniCssExtractPlugin from 'mini-css-extract-plugin';
4
- import CopyWebpackPlugin from "copy-webpack-plugin"
1
+ import path from 'path'
2
+ import HtmlWebpackPlugin from 'html-webpack-plugin'
3
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin'
4
+ import CopyWebpackPlugin from 'copy-webpack-plugin'
5
5
  import filetool from './src/utils/file.js'
6
- import { fileURLToPath } from 'url';
6
+ import { fileURLToPath } from 'url'
7
7
 
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = path.dirname(__filename);
8
+ const __filename = fileURLToPath(import.meta.url)
9
+ const __dirname = path.dirname(__filename)
10
10
 
11
11
  const mode = 'development'
12
12
  const dist_name = 'dist-dev'
@@ -86,7 +86,7 @@ AllHTMLLocalFile5xx.forEach((filePath) => {
86
86
  )
87
87
  })
88
88
 
89
- const config = {
89
+ const config = {
90
90
  mode: mode,
91
91
 
92
92
  context: __dirname,
@@ -126,6 +126,13 @@ const config = {
126
126
 
127
127
  module: {
128
128
  rules: [
129
+ {
130
+ test: /\.(js|mjs|cjs)$/,
131
+ exclude: /(node_modules|bower_components)/,
132
+ use: {
133
+ loader: 'babel-loader'
134
+ }
135
+ },
129
136
  {
130
137
  test: /\.(css|scss|sass)$/,
131
138
  use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader']
@@ -1,13 +1,13 @@
1
- import path from "path"
2
- import HtmlWebpackPlugin from "html-webpack-plugin";
3
- import MiniCssExtractPlugin from 'mini-css-extract-plugin';
4
- import CopyWebpackPlugin from "copy-webpack-plugin"
5
- import TerserPlugin from 'terser-webpack-plugin';
1
+ import path from 'path'
2
+ import HtmlWebpackPlugin from 'html-webpack-plugin'
3
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin'
4
+ import CopyWebpackPlugin from 'copy-webpack-plugin'
5
+ import TerserPlugin from 'terser-webpack-plugin'
6
6
  import filetool from './src/utils/file.js'
7
- import { fileURLToPath } from 'url';
7
+ import { fileURLToPath } from 'url'
8
8
 
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = path.dirname(__filename);
9
+ const __filename = fileURLToPath(import.meta.url)
10
+ const __dirname = path.dirname(__filename)
11
11
 
12
12
  const mode = 'production'
13
13
  const dist_name = 'docs'
@@ -154,6 +154,13 @@ const config = {
154
154
 
155
155
  module: {
156
156
  rules: [
157
+ {
158
+ test: /\.(js|mjs|cjs)$/,
159
+ exclude: /(node_modules|bower_components)/,
160
+ use: {
161
+ loader: 'babel-loader'
162
+ }
163
+ },
157
164
  {
158
165
  test: /\.(css|scss|sass)$/,
159
166
  use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader']
@@ -203,7 +210,7 @@ const config = {
203
210
  {
204
211
  test: /\.html$/i,
205
212
  loader: 'html-loader'
206
- },
213
+ }
207
214
  ]
208
215
  },
209
216
 
@@ -290,4 +297,4 @@ const config = {
290
297
  }
291
298
  }
292
299
 
293
- export default config
300
+ export default config
@@ -1,12 +1,12 @@
1
- import path from "path"
2
- import HtmlWebpackPlugin from "html-webpack-plugin";
3
- import MiniCssExtractPlugin from 'mini-css-extract-plugin';
4
- import CopyWebpackPlugin from "copy-webpack-plugin"
1
+ import path from 'path'
2
+ import HtmlWebpackPlugin from 'html-webpack-plugin'
3
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin'
4
+ import CopyWebpackPlugin from 'copy-webpack-plugin'
5
5
  import filetool from './src/utils/file.js'
6
- import { fileURLToPath } from 'url';
6
+ import { fileURLToPath } from 'url'
7
7
 
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = path.dirname(__filename);
8
+ const __filename = fileURLToPath(import.meta.url)
9
+ const __dirname = path.dirname(__filename)
10
10
 
11
11
  const mode = 'production'
12
12
  const dist_name = 'dist-prod'
@@ -139,6 +139,13 @@ const config = {
139
139
 
140
140
  module: {
141
141
  rules: [
142
+ {
143
+ test: /\.(js|mjs|cjs)$/,
144
+ exclude: /(node_modules|bower_components)/,
145
+ use: {
146
+ loader: 'babel-loader'
147
+ }
148
+ },
142
149
  {
143
150
  test: /\.(css|scss|sass)$/,
144
151
  use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader']
@@ -275,4 +282,4 @@ const config = {
275
282
  }
276
283
  }
277
284
 
278
- export default config
285
+ export default config