@enhanced-dom/webpack 0.0.3 → 0.0.6

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.
@@ -0,0 +1,19 @@
1
+ import IgnoreEmitWebpackPlugin from 'ignore-emit-webpack-plugin';
2
+ export declare const typedStylesConfigFactory: ({ raw, filesPaths }: {
3
+ raw?: boolean;
4
+ filesPaths: string[];
5
+ }) => {
6
+ mode: string;
7
+ entry: {
8
+ bundle: string[];
9
+ };
10
+ devtool: boolean;
11
+ watch: boolean;
12
+ module: {
13
+ rules: {
14
+ test: RegExp;
15
+ use: any[];
16
+ }[];
17
+ };
18
+ plugins: IgnoreEmitWebpackPlugin[];
19
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.typedStylesConfigFactory = void 0;
7
+ const ignore_emit_webpack_plugin_1 = __importDefault(require("ignore-emit-webpack-plugin"));
8
+ const loaders_1 = require("../loaders");
9
+ const typedStylesConfigFactory = ({ raw, filesPaths }) => {
10
+ return {
11
+ mode: 'production',
12
+ entry: { bundle: filesPaths },
13
+ devtool: false,
14
+ watch: true,
15
+ module: {
16
+ rules: [
17
+ {
18
+ test: /\.(pcss|css)$/,
19
+ use: (0, loaders_1.styleConfigFactory)({ raw, typedStyles: true, parser: 'postcss', modules: true }),
20
+ },
21
+ {
22
+ test: /\.(scss|sass)$/,
23
+ use: (0, loaders_1.styleConfigFactory)({ raw, typedStyles: true, parser: 'postcss-scss', modules: true }),
24
+ },
25
+ ],
26
+ },
27
+ plugins: [new ignore_emit_webpack_plugin_1.default(/.+/)],
28
+ };
29
+ };
30
+ exports.typedStylesConfigFactory = typedStylesConfigFactory;
@@ -1,7 +1,9 @@
1
1
  import * as loaders from './loaders';
2
2
  import * as plugins from './plugins';
3
+ import * as configs from './configs';
3
4
  declare const _default: {
4
5
  loaders: typeof loaders;
5
6
  plugins: typeof plugins;
7
+ configs: typeof configs;
6
8
  };
7
9
  export = _default;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -20,7 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
24
  };
21
25
  const loaders = __importStar(require("./loaders"));
22
26
  const plugins = __importStar(require("./plugins"));
27
+ const configs = __importStar(require("./configs"));
23
28
  module.exports = {
24
29
  loaders,
25
30
  plugins,
31
+ configs,
26
32
  };
@@ -1,14 +1,25 @@
1
1
  "use strict";
2
- const loader_utils_1 = require("loader-utils");
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const style_loader_1 = __importDefault(require("style-loader"));
6
+ const lodash_1 = require("lodash");
7
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3
8
  const loader = function () { };
4
9
  loader.pitch = function pitch(remainingRequest) {
5
10
  if (this.cacheable) {
6
11
  this.cacheable();
7
12
  }
8
- return `
9
- var content = require(${loader_utils_1.stringifyRequest(this, `!!${remainingRequest}`)});
10
- module.exports = content.locals || {};
11
- module.exports._source = content.toString();
13
+ const result = style_loader_1.default.pitch.call(this, remainingRequest);
14
+ const index = result.indexOf('var update = API(content, options)');
15
+ if (index <= -1)
16
+ return result;
17
+ const insertIndex = index - 1;
18
+ const stylesheetName = (0, lodash_1.uniqueId)('stylesheet-');
19
+ const insertAttr = `
20
+ options.attributes = options.attributes || {}
21
+ options.attributes.title = "${stylesheetName}";
12
22
  `;
23
+ return result.slice(0, insertIndex) + insertAttr + result.slice(insertIndex) + `export const _stylesheetName = "${stylesheetName}";`;
13
24
  };
14
25
  module.exports = loader;
@@ -4,12 +4,15 @@ export declare const styleConfigFactory: ({ raw, extract, sourceMap, typedStyles
4
4
  sourceMap?: boolean;
5
5
  typedStyles?: boolean;
6
6
  modules?: {
7
- localIdentName: string;
8
- mappings: {
7
+ localIdentName?: string;
8
+ mappings?: {
9
9
  filter: string;
10
10
  transform: (p: string) => string;
11
11
  }[];
12
- };
12
+ } | (boolean & {
13
+ localIdentName?: never;
14
+ mappings?: never;
15
+ });
13
16
  parser?: "postcss" | "postcss-scss";
14
17
  aliases?: Record<string, string>;
15
18
  }) => any[];
@@ -23,15 +26,13 @@ export declare const nullConfigFactory: ({ rules }?: {
23
26
  export declare const fontExtensions: string[];
24
27
  export declare const imageExtensions: string[];
25
28
  export declare const assetExtensions: (extensions?: string[]) => RegExp;
26
- export declare const babelConfigFactory: ({ babel, cache }?: {
29
+ export declare const babelConfigFactory: ({ babel }: {
27
30
  babel?: any;
28
- cache?: boolean | Record<string, any>;
29
31
  }) => {
30
32
  loader: string;
31
33
  options: any;
32
34
  }[];
33
- export declare const markdownConfigFactory: ({ babel, cache, remark, }?: {
35
+ export declare const markdownConfigFactory: ({ babel, remark }?: {
34
36
  babel?: any;
35
- cache?: boolean | Record<string, any>;
36
37
  remark?: any[];
37
38
  }) => any[];
package/loaders/index.js CHANGED
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.markdownConfigFactory = exports.babelConfigFactory = exports.assetExtensions = exports.imageExtensions = exports.fontExtensions = exports.nullConfigFactory = exports.styleConfigFactory = void 0;
7
7
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
8
8
  const postcss_import_webpack_resolver_1 = __importDefault(require("postcss-import-webpack-resolver"));
9
+ // eslint-disable-next-line @typescript-eslint/naming-convention
9
10
  const ExposeCssSourceLoader = require.resolve('./ExposeCssSourceLoader');
10
- // @ts-ignore
11
11
  const remark_code_import_1 = __importDefault(require("remark-code-import"));
12
- // @ts-ignore
13
12
  const remark_unwrap_images_1 = __importDefault(require("remark-unwrap-images"));
14
- // @ts-ignore
15
13
  const remark_embed_images_1 = __importDefault(require("remark-embed-images"));
16
14
  const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, typedStyles = false, modules = undefined, parser = undefined, aliases = {}, } = {}) => {
17
15
  var _a;
@@ -19,23 +17,28 @@ const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, t
19
17
  if (raw) {
20
18
  loaders.push({
21
19
  loader: ExposeCssSourceLoader,
20
+ options: {
21
+ attributes: {},
22
+ },
22
23
  });
23
24
  }
24
- const finalStyleLoader = extract
25
- ? {
25
+ else if (extract) {
26
+ loaders.push({
26
27
  loader: mini_css_extract_plugin_1.default.loader,
27
28
  options: {
28
29
  publicPath: './',
29
30
  },
30
- }
31
- : { loader: 'style-loader' };
32
- loaders.push(finalStyleLoader);
31
+ });
32
+ }
33
+ else {
34
+ loaders.push({ loader: 'style-loader' });
35
+ }
33
36
  if (typedStyles) {
34
37
  loaders.push({
35
38
  loader: 'dts-css-modules-loader',
36
39
  options: {
37
40
  namedExport: true,
38
- banner: raw ? 'export const _source: string;' : undefined,
41
+ banner: raw ? 'export const _stylesheetName: string;' : undefined,
39
42
  },
40
43
  });
41
44
  }
@@ -49,8 +52,9 @@ const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, t
49
52
  modules: {
50
53
  localIdentName: (_a = modules === null || modules === void 0 ? void 0 : modules.localIdentName) !== null && _a !== void 0 ? _a : '[local]_[hash:base64:5]',
51
54
  getLocalIdent: (loaderContext, _, localName) => {
55
+ var _a;
52
56
  const { resourcePath } = loaderContext;
53
- const { mappings = [] } = modules !== null && modules !== void 0 ? modules : {};
57
+ const mappings = (_a = modules === null || modules === void 0 ? void 0 : modules.mappings) !== null && _a !== void 0 ? _a : [];
54
58
  const mapping = mappings.find(({ filter }) => resourcePath.includes(filter));
55
59
  if (!mapping) {
56
60
  return undefined; // this will trigger the default css-loader getLocalIdent function
@@ -80,7 +84,7 @@ const styleConfigFactory = ({ raw = false, extract = false, sourceMap = false, t
80
84
  [
81
85
  'postcss-import',
82
86
  {
83
- resolve: postcss_import_webpack_resolver_1.default({
87
+ resolve: (0, postcss_import_webpack_resolver_1.default)({
84
88
  alias: aliases,
85
89
  }),
86
90
  modules: ['./node_modules', 'node_modules'],
@@ -112,18 +116,15 @@ exports.fontExtensions = ['ttf', 'eot', 'woff', 'woff2'];
112
116
  exports.imageExtensions = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'ico'];
113
117
  const assetExtensions = (extensions = [...exports.imageExtensions, ...exports.fontExtensions]) => new RegExp(`\\.(${extensions.join('|')})(\\?.*$|$)?$`);
114
118
  exports.assetExtensions = assetExtensions;
115
- const babelConfigFactory = ({ babel = undefined, cache = false } = {}) => {
119
+ const babelConfigFactory = ({ babel = undefined }) => {
116
120
  const loaders = [{ loader: 'babel-loader', options: babel }];
117
- if (cache) {
118
- loaders.unshift({ loader: 'cache-loader', options: { cacheDirectory: '.babelcache', ...cache } });
119
- }
120
121
  return loaders;
121
122
  };
122
123
  exports.babelConfigFactory = babelConfigFactory;
123
- const markdownConfigFactory = ({ babel, cache, remark = [], } = {}) => {
124
+ const markdownConfigFactory = ({ babel, remark = [] } = {}) => {
124
125
  const loaders = [];
125
126
  if (babel) {
126
- loaders.push(...exports.babelConfigFactory({ babel, cache }));
127
+ loaders.push(...(0, exports.babelConfigFactory)({ babel }));
127
128
  loaders.push({
128
129
  loader: '@mdx-js/loader',
129
130
  options: {
@@ -132,9 +133,6 @@ const markdownConfigFactory = ({ babel, cache, remark = [], } = {}) => {
132
133
  });
133
134
  }
134
135
  else {
135
- if (cache) {
136
- loaders.push({ loader: 'cache-loader', options: { cacheDirectory: '.markdowncache', ...cache } });
137
- }
138
136
  loaders.push({
139
137
  loader: 'html-loader',
140
138
  }, {
package/package.json CHANGED
@@ -1,80 +1,78 @@
1
- {
2
- "name": "@enhanced-dom/webpack",
3
- "version": "0.0.3",
4
- "description": "Helpers for webpack configuration",
5
- "keywords": [],
6
- "repository": "https://github.com/enhanced-dom/webpack.git",
7
- "license": "MIT",
8
- "author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
9
- "main": "config.js",
10
- "scripts": {
11
- "prebuild": "rimraf dist/*",
12
- "build": "tsc -p ./tsconfig.json",
13
- "postbuild": "copyfiles package.json LICENSE.md README.md dist",
14
- "package": "cd dist && npm pack",
15
- "lint": "eslint src/** --fix --config eslint.config.js"
16
- },
17
- "dependencies": {
18
- "@mdx-js/loader": "^1.6.22",
19
- "autoprefixer": "^10.3.5",
20
- "babel-loader": "^8.2.2",
21
- "cache-loader": "^4.1.0",
22
- "copyfiles": "^2.4.1",
23
- "css-loader": "^6.2.0",
24
- "cssnano-preset-advanced": "^5.1.3",
25
- "dts-css-modules-loader": "^1.2.3",
26
- "html-inline-css-webpack-plugin": "^1.11.1",
27
- "html-inline-script-webpack-plugin": "^2.0.3",
28
- "html-loader": "^2.1.2",
29
- "html-webpack-inline-source-plugin": "^0.0.10",
30
- "html-webpack-plugin": "^5.3.1",
31
- "markdown-loader": "^6.0.0",
32
- "mini-css-extract-plugin": "^2.3.0",
33
- "null-loader": "^4.0.1",
34
- "css-minimizer-webpack-plugin": "^3.0.2",
35
- "postcss": "^8.2.15",
36
- "postcss-import": "^14.0.2",
37
- "postcss-import-webpack-resolver": "^1.0.1",
38
- "postcss-loader": "^6.1.1",
39
- "postcss-nested": "^5.0.6",
40
- "postcss-preset-env": "^6.7.0",
41
- "postcss-advanced-variables": "^3.0.1",
42
- "postcss-scss": "^4.0.0",
43
- "module-from-string": "^3.0.0",
44
- "remark-code-import": "^0.3.0",
45
- "remark-embed-images": "^2.0.0",
46
- "remark-images": "^2.0.0",
47
- "remark-unwrap-images": "^2.0.0",
48
- "resolve-url-loader": "^4.0.0",
49
- "rimraf": "^3.0.2",
50
- "source-map-loader": "^3.0.0",
51
- "style-loader": "^3.2.1",
52
- "terser-webpack-plugin": "^5.1.2",
53
- "webpack": "^5.53.0",
54
- "webpack-bundle-analyzer": "^4.4.2",
55
- "webpack-cli": "^4.8.0",
56
- "webpack-dev-server": "^4.2.1",
57
- "serve": "^12.0.0"
58
- },
59
- "devDependencies": {
60
- "@enhanced-dom/lint": "^0.0.3",
61
- "@types/html-webpack-plugin": "^3.2.5",
62
- "@types/loader-utils": "^2.0.2",
63
- "@types/mini-css-extract-plugin": "^1.4.3",
64
- "@types/optimize-css-assets-webpack-plugin": "^5.0.3",
65
- "@types/terser-webpack-plugin": "^5.0.3",
66
- "@types/webpack": "^5.28.0",
67
- "@types/webpack-bundle-analyzer": "^2.9.2",
68
- "typescript": "^4.2.2"
69
-
70
- },
71
- "overrides": {
72
- "postcss": "^8.2.15",
73
- "postcss-scss": "^4.0.0",
74
- "autoprefixer": "^10.3.5"
75
- },
76
- "engines": {
77
- "node": ">=14.17.0",
78
- "npm": ">=8.0.0"
79
- }
80
- }
1
+ {
2
+ "name": "@enhanced-dom/webpack",
3
+ "version": "0.0.6",
4
+ "description": "Helpers for webpack configuration",
5
+ "keywords": [],
6
+ "repository": "https://github.com/enhanced-dom/webpack.git",
7
+ "license": "MIT",
8
+ "author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
9
+ "main": "index.js",
10
+ "bin": {
11
+ "@enhanced-dom-copy-packagejson": "./scripts/copyPackageJson.js"
12
+ },
13
+ "dependencies": {
14
+ "@mdx-js/loader": "^1.6.22",
15
+ "autoprefixer": "^10.3.5",
16
+ "babel-loader": "^8.2.2",
17
+ "copyfiles": "^2.4.1",
18
+ "css-loader": "^6.2.0",
19
+ "cssnano-preset-advanced": "^5.1.3",
20
+ "dts-css-modules-loader": "^1.2.3",
21
+ "html-inline-css-webpack-plugin": "^1.11.1",
22
+ "html-inline-script-webpack-plugin": "^2.0.3",
23
+ "html-loader": "^2.1.2",
24
+ "html-webpack-inline-source-plugin": "^0.0.10",
25
+ "html-webpack-plugin": "^5.3.1",
26
+ "ignore-emit-webpack-plugin": "^2.0.6",
27
+ "markdown-loader": "^6.0.0",
28
+ "mini-css-extract-plugin": "^2.3.0",
29
+ "null-loader": "^4.0.1",
30
+ "css-minimizer-webpack-plugin": "^3.0.2",
31
+ "postcss": "^8.2.15",
32
+ "postcss-import": "^14.0.2",
33
+ "postcss-import-webpack-resolver": "^1.0.1",
34
+ "postcss-loader": "^6.1.1",
35
+ "postcss-nested": "^5.0.6",
36
+ "postcss-preset-env": "^6.7.0",
37
+ "postcss-advanced-variables": "^3.0.1",
38
+ "postcss-scss": "^4.0.0",
39
+ "module-from-string": "^3.0.0",
40
+ "raw-loader": "^4.0.2",
41
+ "remark-code-import": "^0.3.0",
42
+ "remark-embed-images": "^2.0.0",
43
+ "remark-images": "^2.0.0",
44
+ "remark-unwrap-images": "^2.0.0",
45
+ "resolve-url-loader": "^4.0.0",
46
+ "rimraf": "^3.0.2",
47
+ "source-map-loader": "^3.0.0",
48
+ "style-loader": "^3.2.1",
49
+ "terser-webpack-plugin": "^5.1.2",
50
+ "webpack": "^5.70.0",
51
+ "webpack-bundle-analyzer": "^4.5.0",
52
+ "webpack-cli": "^4.9.2",
53
+ "webpack-dev-server": "^4.7.4",
54
+ "serve": "^12.0.0",
55
+ "yargs": "^17.4.1"
56
+ },
57
+ "devDependencies": {
58
+ "@enhanced-dom/lint": "^0.0.6",
59
+ "@types/html-webpack-plugin": "^3.2.5",
60
+ "@types/loader-utils": "^2.0.2",
61
+ "@types/mini-css-extract-plugin": "^1.4.3",
62
+ "@types/optimize-css-assets-webpack-plugin": "^5.0.3",
63
+ "@types/terser-webpack-plugin": "^5.2.0",
64
+ "@types/webpack": "^5.28.0",
65
+ "@types/webpack-bundle-analyzer": "^2.9.2",
66
+ "typescript": "^4.2.2"
67
+ },
68
+ "overrides": {
69
+ "postcss": "^8.2.15",
70
+ "postcss-scss": "^4.0.0",
71
+ "autoprefixer": "^10.3.5",
72
+ "terser": "^5.12.1"
73
+ },
74
+ "engines": {
75
+ "node": ">=14.17.0",
76
+ "npm": ">=8.0.0"
77
+ }
78
+ }
@@ -2,8 +2,8 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
+ /* eslint-disable @typescript-eslint/no-this-alias */
5
6
  const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
6
- // @ts-ignore
7
7
  const html_webpack_inline_source_plugin_1 = __importDefault(require("html-webpack-inline-source-plugin"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -31,7 +31,7 @@ html_webpack_inline_source_plugin_1.default.prototype.apply = function (compiler
31
31
  if (!favicon || !fs_1.default.existsSync(favicon)) {
32
32
  return callback(null, result);
33
33
  }
34
- const faviconTag = result.headTags.find(tag => tag.tagName === 'link' && tag.attributes.rel === 'icon');
34
+ const faviconTag = result.headTags.find((tag) => tag.tagName === 'link' && tag.attributes.rel === 'icon');
35
35
  if (faviconTag) {
36
36
  self.faviconPath = faviconTag.attributes.href;
37
37
  faviconTag.attributes.href = `data:image/x-icon;base64, ${fs_1.default.readFileSync(favicon, 'base64')}`;
@@ -1,4 +1,6 @@
1
1
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
2
+ import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
3
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2
4
  import TerserPlugin from 'terser-webpack-plugin';
3
5
  import { MinifyOptions } from 'terser';
4
6
  import HtmlWebpackPlugin from 'html-webpack-plugin';
@@ -6,15 +8,13 @@ import { WebpackPluginInstance } from 'webpack';
6
8
  export declare const cssConfigFactory: ({ filename, cssnanoOptions, }?: {
7
9
  filename?: string;
8
10
  cssnanoOptions?: any;
9
- }) => any[];
11
+ }) => (MiniCssExtractPlugin | CssMinimizerPlugin<CssMinimizerPlugin.CssNanoOptionsExtended>)[];
10
12
  export declare const bundleAnalyzerConfigFactory: (extraConfig?: BundleAnalyzerPlugin.Options) => BundleAnalyzerPlugin[];
11
- export declare const htmlConfigFactory: ({ html, embed, outputPath }?: {
13
+ export declare const htmlConfigFactory: ({ html, embed }?: {
12
14
  embed?: boolean;
13
15
  html?: Partial<HtmlWebpackPlugin.Options>;
14
- outputPath?: string;
15
16
  }) => WebpackPluginInstance[];
16
- export declare const terserConfigFactory: ({ enableSourcemaps, cachePath, terserOptions, }?: {
17
+ export declare const terserConfigFactory: ({ enableSourcemaps, terserOptions }?: {
17
18
  enableSourcemaps?: boolean;
18
- cachePath?: string;
19
19
  terserOptions?: MinifyOptions;
20
- }) => TerserPlugin[];
20
+ }) => TerserPlugin<MinifyOptions>[];
package/plugins/index.js CHANGED
@@ -39,7 +39,7 @@ const bundleAnalyzerConfigFactory = (extraConfig = {}) => {
39
39
  ];
40
40
  };
41
41
  exports.bundleAnalyzerConfigFactory = bundleAnalyzerConfigFactory;
42
- const htmlConfigFactory = ({ html = {}, embed, outputPath = './dist' } = {}) => {
42
+ const htmlConfigFactory = ({ html = {}, embed } = {}) => {
43
43
  var _a;
44
44
  const template = (_a = html.template) !== null && _a !== void 0 ? _a : path_1.default.join(process.cwd(), 'template.html');
45
45
  const templateExists = fs_1.default.existsSync(template);
@@ -59,7 +59,7 @@ const htmlConfigFactory = ({ html = {}, embed, outputPath = './dist' } = {}) =>
59
59
  lang: 'en-US',
60
60
  ...(templateExists ? { template } : { templateContent }),
61
61
  ...html,
62
- favicon
62
+ favicon,
63
63
  }),
64
64
  ];
65
65
  if (embed) {
@@ -68,13 +68,13 @@ const htmlConfigFactory = ({ html = {}, embed, outputPath = './dist' } = {}) =>
68
68
  return plugins;
69
69
  };
70
70
  exports.htmlConfigFactory = htmlConfigFactory;
71
- const terserConfigFactory = ({ enableSourcemaps = true, cachePath = './.tersercache', terserOptions = {}, } = {}) => [
71
+ const terserConfigFactory = ({ enableSourcemaps = true, terserOptions = {} } = {}) => [
72
+ /* eslint-disable @typescript-eslint/naming-convention */
72
73
  new terser_webpack_plugin_1.default({
73
74
  parallel: true,
74
- cache: cachePath,
75
- sourceMap: enableSourcemaps,
76
75
  terserOptions: {
77
76
  ie8: false,
77
+ sourceMap: enableSourcemaps,
78
78
  compress: {
79
79
  evaluate: false,
80
80
  },
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path')
4
+ const fs = require('fs')
5
+ const yargs = require('yargs')
6
+ const args = yargs(process.argv).usage("$0 <folder>").positional('folder', { describe: 'destination folder for package.json copy', type: 'string' }).default('folder', 'dist').argv
7
+ const packageJSONContents = require(path.join(process.cwd(), 'package.json'))
8
+ delete packageJSONContents.scripts
9
+ fs.writeFileSync(path.join(process.cwd(), args.folder, 'package.json'), JSON.stringify(packageJSONContents, null, 2))