mazey 4.13.2 → 5.0.1

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.
@@ -1,139 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- /* eslint-disable no-undef */
3
- import { babel } from "@rollup/plugin-babel";
4
- import commonjs from "@rollup/plugin-commonjs";
5
- import { nodeResolve } from "@rollup/plugin-node-resolve";
6
- import rollupTypescript from "rollup-plugin-typescript2";
7
- import { DEFAULT_EXTENSIONS } from "@babel/core";
8
- import cleaner from "rollup-plugin-cleaner";
9
- import terser from "@rollup/plugin-terser";
10
- import { dts } from "rollup-plugin-dts";
11
- import path from "path";
12
- import { fileURLToPath } from "url";
13
- import { dirname } from "path";
14
-
15
- const __filename = fileURLToPath(import.meta.url);
16
- const __dirname = dirname(__filename);
17
- const _resolve = (_path) => path.resolve(__dirname, _path);
18
- const pkgVersion = process.env.SCRIPTS_NPM_PACKAGE_VERSION || process.env.VERSION || "unknown";
19
- const debugMode = process.env.SCRIPTS_NPM_PACKAGE_DEBUG;
20
- const banner =
21
- "/*!\n" +
22
- ` * Mazey v${pkgVersion} https://github.com/chengchuu/mazey\n` +
23
- ` * (c) 2018-${new Date().getFullYear()} Cheng\n` +
24
- " * Released under the MIT License.\n" +
25
- " */";
26
- const plugins = [
27
- nodeResolve({
28
- extensions: [ ".mjs", ".js", ".json", ".node", ".ts" ],
29
- }),
30
- rollupTypescript(),
31
- commonjs({
32
- include: /node_modules/,
33
- }),
34
- babel({
35
- babelHelpers: "runtime",
36
- // Just convert the source code, don't run external dependencies.
37
- exclude: "**/node_modules/**",
38
- // Babel does not support TypeScript by default; it needs to be manually added.
39
- extensions: [
40
- ...DEFAULT_EXTENSIONS,
41
- ".ts",
42
- ],
43
- }),
44
- ];
45
- const iifePlugins = [];
46
- const dTsConf = {
47
- input: _resolve("../src/typing.d.ts"),
48
- // https://rollupjs.org/guide/en/#outputformat
49
- output: [
50
- {
51
- file: _resolve("../lib/typing.d.ts"),
52
- format: "es",
53
- },
54
- ],
55
- plugins: [
56
- dts(),
57
- ],
58
- external: [],
59
- };
60
- const indexDtsConf = {
61
- input: _resolve("../src/index.ts"),
62
- output: [
63
- {
64
- file: _resolve("../lib/index.d.ts"),
65
- format: "es",
66
- },
67
- ],
68
- plugins: [
69
- dts(),
70
- ],
71
- external: [],
72
- };
73
- const gTsConf = {
74
- input: _resolve("../types/global.d.ts"),
75
- output: [
76
- {
77
- file: _resolve("../lib/global.d.ts"),
78
- format: "es",
79
- },
80
- ],
81
- plugins: [
82
- dts(),
83
- ],
84
- external: [],
85
- };
86
-
87
- if (debugMode !== "open") {
88
- iifePlugins.push(
89
- // Add Minification
90
- // https://github.com/TrySound/rollup-plugin-terser
91
- terser({ // https://github.com/terser/terser
92
- format: {
93
- // https://github.com/terser/terser#format-options
94
- comments: /^!\n\s\*\sMazey/,
95
- },
96
- }),
97
- );
98
- }
99
-
100
- // https://rollupjs.org/guide/en/
101
- export default [
102
- {
103
- input: _resolve("../src/index.ts"),
104
- // https://rollupjs.org/guide/en/#outputformat
105
- output: [
106
- {
107
- file: _resolve("../lib/index.cjs.js"),
108
- format: "cjs",
109
- banner,
110
- plugins: iifePlugins,
111
- },
112
- {
113
- file: _resolve("../lib/index.esm.js"),
114
- format: "esm",
115
- banner,
116
- plugins: iifePlugins,
117
- },
118
- {
119
- file: _resolve("../lib/mazey.min.js"),
120
- format: "iife",
121
- name: "mazey",
122
- banner,
123
- plugins: iifePlugins,
124
- },
125
- ],
126
- plugins: [
127
- ...plugins,
128
- cleaner({
129
- targets: [
130
- _resolve("../lib/"),
131
- ],
132
- }),
133
- ],
134
- external: [],
135
- },
136
- indexDtsConf,
137
- dTsConf,
138
- gTsConf,
139
- ];