@mirta/rollup 0.2.1 → 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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -4
  2. package/package.json +3 -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,
@@ -193,7 +206,7 @@ function defineConfig(options = {}) {
193
206
  output: {
194
207
  format: 'cjs',
195
208
  strict: false,
196
- dir: 'dist/es5',
209
+ dir: outputDir.es5,
197
210
  preserveModules: true,
198
211
  entryFileNames(chunkInfo) {
199
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.1",
4
+ "version": "0.2.2",
5
5
  "license": "Unlicense",
6
6
  "keywords": [
7
7
  "mirta",
@@ -40,9 +40,10 @@
40
40
  "babel-plugin-array-includes": "^2.0.3",
41
41
  "del": "^8.0.0",
42
42
  "magic-string": "^0.30.17",
43
+ "rollup-plugin-copy": "^3.5.0",
43
44
  "rollup-plugin-typescript2": "^0.36.0",
44
45
  "typescript": "^5.8.3",
45
- "@mirta/polyfills": "0.2.1"
46
+ "@mirta/polyfills": "0.2.2"
46
47
  },
47
48
  "devDependencies": {
48
49
  "rollup": "^4.45.1"