securemark 0.244.0 → 0.245.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.
@@ -0,0 +1,129 @@
1
+ const path = require('path');
2
+ const glob = require('glob');
3
+ const shell = cmd => require('child_process').execSync(cmd, { stdio: [0, 1, 2] });
4
+ const webpack = require('webpack');
5
+ const { mergeWithRules } = require('webpack-merge');
6
+ const ESLintPlugin = require('eslint-webpack-plugin');
7
+ const pkg = require('./package.json');
8
+
9
+ shell('rm -rf dist coverage');
10
+
11
+ module.exports = env => {
12
+ const merge = mergeWithRules({
13
+ entry: 'replace',
14
+ module: {
15
+ rules: {
16
+ test: 'match',
17
+ use: {
18
+ loader: 'match',
19
+ options: 'replace',
20
+ plugins: 'replace',
21
+ },
22
+ },
23
+ },
24
+ plugins: 'append',
25
+ });
26
+ const config = {
27
+ mode: 'production',
28
+ externals: {
29
+ benchmark: 'Benchmark',
30
+ prismjs: 'Prism',
31
+ dompurify: 'DOMPurify',
32
+ },
33
+ resolve: {
34
+ extensions: ['.ts', '.js'],
35
+ },
36
+ entry: glob.sync('./{src,test}/**/*.ts'),
37
+ output: {
38
+ filename: 'index.js',
39
+ path: path.resolve(__dirname, 'dist'),
40
+ library: pkg.name,
41
+ libraryTarget: 'umd',
42
+ globalObject: 'globalThis',
43
+ clean: true,
44
+ },
45
+ module: {
46
+ rules: [
47
+ {
48
+ test: /\.ts$/,
49
+ //exclude: /node_modules/,
50
+ use: [
51
+ {
52
+ loader: 'babel-loader',
53
+ options: {},
54
+ },
55
+ {
56
+ loader: 'ts-loader',
57
+ options: {
58
+ onlyCompileBundledFiles: true,
59
+ },
60
+ },
61
+ ],
62
+ },
63
+ ],
64
+ },
65
+ plugins: [
66
+ new webpack.BannerPlugin({
67
+ banner: `${pkg.name} v${pkg.version} ${pkg.repository.url} | (c) 2017, ${pkg.author} | ${pkg.license} License`,
68
+ }),
69
+ ],
70
+ performance: {
71
+ maxEntrypointSize: Infinity,
72
+ maxAssetSize: Infinity,
73
+ },
74
+ optimization: {
75
+ minimize: false,
76
+ },
77
+ };
78
+ switch (env.mode) {
79
+ case 'test':
80
+ return merge(config);
81
+ case 'lint':
82
+ return merge(config, {
83
+ entry: glob.sync('./!(node_modules)**/*.ts'),
84
+ plugins: [
85
+ new ESLintPlugin({
86
+ extensions: ['ts'],
87
+ }),
88
+ ],
89
+ });
90
+ case 'bench':
91
+ return merge(config, {
92
+ entry: glob.sync('./benchmark/**/*.ts'),
93
+ module: {
94
+ rules: [
95
+ {
96
+ test: /\.ts$/,
97
+ use: [
98
+ {
99
+ loader: 'babel-loader',
100
+ options: {
101
+ plugins: ['babel-plugin-unassert'],
102
+ },
103
+ },
104
+ ],
105
+ },
106
+ ],
107
+ },
108
+ });
109
+ case 'dist':
110
+ return merge(config, {
111
+ entry: glob.sync('./index.ts'),
112
+ module: {
113
+ rules: [
114
+ {
115
+ test: /\.ts$/,
116
+ use: [
117
+ {
118
+ loader: 'babel-loader',
119
+ options: {
120
+ plugins: ['babel-plugin-unassert'],
121
+ },
122
+ },
123
+ ],
124
+ },
125
+ ],
126
+ },
127
+ });
128
+ }
129
+ };