Skip to content

Commit

Permalink
v4.11.19
Browse files Browse the repository at this point in the history
Signed-off-by: Magic <[email protected]>
  • Loading branch information
magicoflolis committed Jan 30, 2023
1 parent fec7a05 commit 56ac5f2
Show file tree
Hide file tree
Showing 6 changed files with 451 additions and 459 deletions.
16 changes: 14 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"root": true,
"globals": {
"MU": "writable",
"GM": "writable",
"err": "readonly",
"browser": "readonly",
Expand Down Expand Up @@ -33,6 +34,17 @@
"modules": true
}
},
"ignorePatterns": ["/src/header.js","/tools/userscript.js", "/dist/*.js"],
"rules": {}
"ignorePatterns": [
"/src/header.js",
"/tools/userscript.js",
"/tests/*.js",
"/dist/*.js"
],
"rules": {
"quotes": [
"error",
"single",
{ "avoidEscape": true, "allowTemplateLiterals": false }
]
}
}
243 changes: 124 additions & 119 deletions tools/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,136 +1,141 @@
/* eslint-env node */
const {merge} = require('webpack-merge'),
const { merge } = require('webpack-merge'),
CopyPlugin = require('copy-webpack-plugin'),
path = require('path'),
TerserPlugin = require('terser-webpack-plugin'),
webpack = require('webpack'),
brws = process.env.NODE_ENV,
file = (dir) => path.resolve(path.resolve(__dirname, '..'),dir),
plugins = [
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
new CopyPlugin({
patterns: [
{
from: file(`src/manifest/${brws}.json`),
to: file(`tests/${brws}/manifest.json`),
transform(content) {
const { version, author, homepage: homepage_url } = require('../package.json')
const manifest = JSON.parse(content)
return JSON.stringify(
Object.assign(manifest, { version, author, homepage_url }),
)
file = (dir) => path.resolve(path.resolve(__dirname, '..'),dir);
module.exports = (env,args) => {
let brws = env.brws,
plugins = [
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
new CopyPlugin({
patterns: [
{
from: file(`src/manifest/${brws}.json`),
to: file(`tests/${brws}/manifest.json`),
transform(content) {
const { version, description, author, homepage: homepage_url } = require('../package.json');
const manifest = JSON.parse(content);
return JSON.stringify(Object.assign(manifest, { version, description, author, homepage_url }),null,' ');
},
},
},
{
from: file('src/locales'),
to: file(`tests/${brws}/_locales`),
},
// {
// from: file('src/html'),
// to: file(`tests/${brws}`),
// },
{
from: file('tests/compiled'),
to: file(`tests/${brws}/css`),
},
{
from: file('src/img'),
to: file(`tests/${brws}/img`),
},
{
from: file('src/web_accessible_resources'),
to: file(`tests/${brws}/web_accessible_resources`),
force: true,
},
// {
// from: file('src/js'),
// to: file(`tests/${brws}/js`),
// },
],
}),
// new webpackEnv(),
],
commonConfig = {
context: file('src'),
entry: {
// start: './js/start.js',
},
output: {
path: file(`tests/${brws}/js`),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'swc-loader',
options: {
sync: true,
jsc: {
parser: {
syntax: 'ecmascript'
{
from: file('src/_locales'),
to: file(`tests/${brws}/_locales`),
},
{
from: file('src/html'),
to: file(`tests/${brws}`),
},
{
from: file('tests/compiled'),
to: file(`tests/${brws}/css`),
force: true,
},
{
from: file('src/img'),
to: file(`tests/${brws}/img`),
},
{
from: file('src/web_accessible_resources'),
to: file(`tests/${brws}/web_accessible_resources`),
// force: true,
},
{
from: file('src/js'),
to: file(`tests/${brws}/js`),
// force: true,
},
{
from: file('src/sass/fonts'),
to: file(`tests/${brws}/css/fonts`),
},
],
}),
],
commonConfig = {
context: file('src'),
entry: {
start: './js/start.js',
},
output: {
path: file(`tests/${brws}/js`),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'swc-loader',
options: {
sync: true,
jsc: {
parser: {
syntax: 'ecmascript'
},
target: 'es2020',
},
module: {
type: 'es6',
},
target: 'es2020',
},
module: {
type: 'es6',
},
},
},
},
],
],
},
resolve: {
extensions: ['.js'],
fallback: {
'path': require.resolve('path-browserify')
}
},
plugins,
experiments: {topLevelAwait: true,},
},
resolve: {
extensions: ['.js'],
fallback: { 'path': require.resolve('path-browserify') }
},
plugins,
},
productionConfig = {
mode: 'production',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
productionConfig = {
mode: 'production',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
},
},
extractComments: false,
parallel: true,
})],
extractComments: false,
parallel: true,
})],
},
},
},
developmentConfig = {
mode: 'development',
devtool: 'source-map',
optimization: {
minimize: false,
minimizer: [
new TerserPlugin({
test: /\.m?js$/,
// minify: TerserPlugin.swcMinify,
terserOptions: {
format: {
comments: true,
developmentConfig = {
mode: 'development',
devtool: 'source-map',
optimization: {
minimize: false,
minimizer: [
new TerserPlugin({
// test: /\.m?js$/,
// minify: TerserPlugin.swcMinify,
terserOptions: {
format: {
comments: true,
},
},
},
extractComments: true,
parallel: true,
})],
},
watch: true,
watchOptions: {
poll: 1500,
aggregateTimeout: 500,
ignored: /node_modules/,
},
};

module.exports = (env,args) => {
extractComments: true,
parallel: true,
})],
},
watch: true,
watchOptions: {
poll: 1000,
aggregateTimeout: 500,
ignored: /node_modules/,
},
};
switch(args.mode) {
case 'development':
return merge(commonConfig, developmentConfig);
Expand Down
Loading

0 comments on commit 56ac5f2

Please sign in to comment.