@mirta/rollup 0.2.0 → 0.2.2
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/dist/index.mjs +21 -5
- package/package.json +4 -2
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import multi from '@rollup/plugin-multi-entry';
|
|
|
2
2
|
import resolve from '@rollup/plugin-node-resolve';
|
|
3
3
|
import ts from 'rollup-plugin-typescript2';
|
|
4
4
|
import dotenv from '@dotenv-run/rollup';
|
|
5
|
+
import copy from 'rollup-plugin-copy';
|
|
5
6
|
import replace from '@rollup/plugin-replace';
|
|
6
7
|
import { getBabelOutputPlugin } from '@rollup/plugin-babel';
|
|
7
8
|
import { deleteAsync } from 'del';
|
|
@@ -33,10 +34,10 @@ function del(options = {}) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
// Абсолютный путь к результирующему каталогу.
|
|
36
|
-
const outputDir = path.join(process.cwd(), 'dist');
|
|
37
|
-
const modulesDir = path.join(outputDir, 'wb-rules-modules');
|
|
37
|
+
const outputDir$1 = path.join(process.cwd(), 'dist');
|
|
38
|
+
const modulesDir = path.join(outputDir$1, 'wb-rules-modules');
|
|
38
39
|
// Расположение обрабатываемого чанка.
|
|
39
|
-
const getChunkDir = (fileName) => path.dirname(path.join(outputDir, fileName));
|
|
40
|
+
const getChunkDir = (fileName) => path.dirname(path.join(outputDir$1, fileName));
|
|
40
41
|
// Шаблон для отлова конструкций require.
|
|
41
42
|
const patternRequire = /require\(['"]([^'"]+)'\)/g;
|
|
42
43
|
/**
|
|
@@ -104,6 +105,9 @@ const isProduction = env === 'production';
|
|
|
104
105
|
const packagesPattern = /node_modules\/@?(.+)\/(.+)/;
|
|
105
106
|
const modulesPattern = /(?:src\/)?wb-rules-modules\/(.*)/;
|
|
106
107
|
const scriptsPattern = /(?:src\/)?(?:wb-rules\/)?(.*)/;
|
|
108
|
+
const outputDir = {
|
|
109
|
+
es5: 'dist/es5',
|
|
110
|
+
};
|
|
107
111
|
function packageEntry(pkg, entry) {
|
|
108
112
|
const key = entry ? `${pkg}/${entry}` : pkg;
|
|
109
113
|
// if ((process.env.NODE_ENV !== 'production'))
|
|
@@ -156,6 +160,15 @@ function defineConfig(options = {}) {
|
|
|
156
160
|
del({
|
|
157
161
|
targets: 'dist/*',
|
|
158
162
|
}),
|
|
163
|
+
// Переносит js-файлы из src в dist без какой-либо обработки
|
|
164
|
+
// в целях обеспечения совместимости с существующими скриптами.
|
|
165
|
+
//
|
|
166
|
+
copy({
|
|
167
|
+
targets: [
|
|
168
|
+
{ src: 'src/wb-rules/**/*.js', dest: `${outputDir.es5}/wb-rules` },
|
|
169
|
+
{ src: 'src/wb-rules-modules/**/*.js', dest: `${outputDir.es5}/wb-rules-modules` },
|
|
170
|
+
],
|
|
171
|
+
}),
|
|
159
172
|
multi({
|
|
160
173
|
exclude: ['src/wb-rules/*.disabled.ts'],
|
|
161
174
|
preserveModules: true,
|
|
@@ -174,7 +187,10 @@ function defineConfig(options = {}) {
|
|
|
174
187
|
}),
|
|
175
188
|
getBabelOutputPlugin({
|
|
176
189
|
presets: ['@babel/preset-env'],
|
|
177
|
-
plugins: [
|
|
190
|
+
plugins: [
|
|
191
|
+
'@babel/plugin-transform-spread',
|
|
192
|
+
'array-includes',
|
|
193
|
+
],
|
|
178
194
|
}),
|
|
179
195
|
del({
|
|
180
196
|
targets: 'dist/*/_virtual',
|
|
@@ -190,7 +206,7 @@ function defineConfig(options = {}) {
|
|
|
190
206
|
output: {
|
|
191
207
|
format: 'cjs',
|
|
192
208
|
strict: false,
|
|
193
|
-
dir:
|
|
209
|
+
dir: outputDir.es5,
|
|
194
210
|
preserveModules: true,
|
|
195
211
|
entryFileNames(chunkInfo) {
|
|
196
212
|
// console.log(process.cwd())
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirta/rollup",
|
|
3
3
|
"description": "Predefined Rollup configuration for wb-rules project builds.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"license": "Unlicense",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mirta",
|
|
@@ -37,11 +37,13 @@
|
|
|
37
37
|
"@rollup/plugin-babel": "^6.0.4",
|
|
38
38
|
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
39
39
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
40
|
+
"babel-plugin-array-includes": "^2.0.3",
|
|
40
41
|
"del": "^8.0.0",
|
|
41
42
|
"magic-string": "^0.30.17",
|
|
43
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
42
44
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
43
45
|
"typescript": "^5.8.3",
|
|
44
|
-
"@mirta/polyfills": "0.2.
|
|
46
|
+
"@mirta/polyfills": "0.2.2"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"rollup": "^4.45.1"
|