@modern-js/plugin-module-banner 2.21.1 → 2.22.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @modern-js/plugin-module-banner
2
2
 
3
+ ## 2.22.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/module-tools@2.22.1
8
+
9
+ ## 2.22.0
10
+
11
+ ### Patch Changes
12
+
13
+ - ad49140: chore: adjust output and package.json fields
14
+ chore: 调整包的产物格式以及 packgae.json 里的字段
15
+ - 4b7488c: chore(deps): bump libuild v0.12.4 and swc-plugins v0.3.5
16
+
17
+ chore(deps): 升级 libuild v0.12.4 和 swc-plugins v0.3.5
18
+
19
+ - e2913dd: chore: update module plugin docs and readme
20
+ chore: 更新模块插件的文档和 readme
21
+ - Updated dependencies [d19dc11]
22
+ - Updated dependencies [c890980]
23
+ - Updated dependencies [4b7488c]
24
+ - @modern-js/module-tools@2.22.0
25
+
3
26
  ## 2.21.1
4
27
 
5
28
  ### Patch Changes
package/README.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  The banner plugin of Modern.js Module Tools.
4
4
 
5
+ ## Usage
6
+
7
+ ```ts modern.config.ts
8
+ import moduleTools, { defineConfig } from '@modern-js/module-tools';
9
+ import { modulePluginBanner } from '@modern-js/plugin-module-banner';
10
+
11
+ export default defineConfig({
12
+ plugins: [
13
+ moduleTools(),
14
+ modulePluginBanner({
15
+ banner: {
16
+ js: '//comment',
17
+ css: '/*comment*/',
18
+ },
19
+ }),
20
+ ],
21
+ });
22
+ ```
23
+
5
24
  ## Documentation
6
25
 
7
26
  - [English Documentation](https://modernjs.dev/module-tools/en)
@@ -0,0 +1,14 @@
1
+ import { CliPlugin, ModuleTools } from '@modern-js/module-tools';
2
+
3
+ declare const modulePluginBanner: (options: {
4
+ banner: {
5
+ js?: string;
6
+ css?: string;
7
+ };
8
+ footer?: {
9
+ js?: string;
10
+ css?: string;
11
+ };
12
+ }) => CliPlugin<ModuleTools>;
13
+
14
+ export { modulePluginBanner as default, modulePluginBanner };
package/dist/index.js ADDED
@@ -0,0 +1,68 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ var __export = (target, all) => {
23
+ for (var name in all)
24
+ __defProp(target, name, { get: all[name], enumerable: true });
25
+ };
26
+ var __copyProps = (to, from, except, desc) => {
27
+ if (from && typeof from === "object" || typeof from === "function") {
28
+ for (let key of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key) && key !== except)
30
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
+ }
32
+ return to;
33
+ };
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+
36
+ // src/index.ts
37
+ var src_exports = {};
38
+ __export(src_exports, {
39
+ default: () => src_default,
40
+ modulePluginBanner: () => modulePluginBanner
41
+ });
42
+ module.exports = __toCommonJS(src_exports);
43
+ var modulePluginBanner = (options) => ({
44
+ name: "@modern-js/plugin-module-banner",
45
+ setup: () => ({
46
+ modifyLibuild(config, next) {
47
+ const lastEsbuildOptions = config.esbuildOptions;
48
+ config.esbuildOptions = (c) => {
49
+ let lastEsbuildConfig = {};
50
+ if (lastEsbuildOptions) {
51
+ lastEsbuildConfig = lastEsbuildOptions(c);
52
+ }
53
+ return __spreadProps(__spreadValues({}, lastEsbuildConfig), {
54
+ footer: options.footer,
55
+ banner: options.banner
56
+ });
57
+ };
58
+ return next(config);
59
+ }
60
+ })
61
+ });
62
+ var src_default = modulePluginBanner;
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ modulePluginBanner
66
+ });
67
+
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,qBAAqB,CAAC,aAGJ;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO,OAAO;AAAA,IACZ,cAAc,QAAQ,MAAM;AAC1B,YAAM,qBAAqB,OAAO;AAClC,aAAO,iBAAiB,OAAK;AAC3B,YAAI,oBAAoB,CAAC;AACzB,YAAI,oBAAoB;AACtB,8BAAoB,mBAAmB,CAAC;AAAA,QAC1C;AAEA,eAAO,iCACF,oBADE;AAAA,UAEL,QAAQ,QAAQ;AAAA,UAChB,QAAQ,QAAQ;AAAA,QAClB;AAAA,MACF;AACA,aAAO,KAAK,MAAM;AAAA,IACpB;AAAA,EACF;AACF;AAGA,IAAO,cAAQ;","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';\n\nexport const modulePluginBanner = (options: {\n banner: { js?: string; css?: string };\n footer?: { js?: string; css?: string };\n}): CliPlugin<ModuleTools> => ({\n name: '@modern-js/plugin-module-banner',\n setup: () => ({\n modifyLibuild(config, next) {\n const lastEsbuildOptions = config.esbuildOptions;\n config.esbuildOptions = c => {\n let lastEsbuildConfig = {};\n if (lastEsbuildOptions) {\n lastEsbuildConfig = lastEsbuildOptions(c);\n }\n\n return {\n ...lastEsbuildConfig,\n footer: options.footer,\n banner: options.banner,\n };\n };\n return next(config);\n },\n }),\n});\n\n// deprecated default export\nexport default modulePluginBanner;\n"]}
package/package.json CHANGED
@@ -15,17 +15,15 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.21.1",
19
- "types": "./dist/types/index.d.ts",
20
- "main": "./dist/cjs/index.js",
18
+ "version": "2.22.1",
19
+ "types": "./dist/index.d.ts",
20
+ "main": "./dist/index.js",
21
21
  "exports": {
22
22
  ".": {
23
23
  "node": {
24
24
  "jsnext:source": "./src/index.ts",
25
- "import": "./dist/esm/index.js",
26
- "require": "./dist/cjs/index.js"
27
- },
28
- "default": "./dist/esm/index.js"
25
+ "require": "./dist/index.js"
26
+ }
29
27
  }
30
28
  },
31
29
  "devDependencies": {
@@ -33,13 +31,13 @@
33
31
  "@types/node": "^14",
34
32
  "typescript": "^5",
35
33
  "jest": "^29",
36
- "@modern-js/libuild": "0.12.2",
37
- "@scripts/build": "2.21.1",
38
- "@scripts/jest-config": "2.21.1",
39
- "@modern-js/module-tools": "2.21.1"
34
+ "@modern-js/libuild": "0.12.4",
35
+ "@scripts/build": "2.22.1",
36
+ "@scripts/jest-config": "2.22.1",
37
+ "@modern-js/module-tools": "2.22.1"
40
38
  },
41
39
  "peerDependencies": {
42
- "@modern-js/module-tools": "^2.21.1"
40
+ "@modern-js/module-tools": "^2.22.1"
43
41
  },
44
42
  "peerDependenciesMeta": {
45
43
  "@modern-js/module-tools": {
package/dist/cjs/index.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: () => _default
8
- });
9
- const _default = (options) => ({
10
- name: "@modern-js/plugin-module-banner",
11
- setup: () => ({
12
- modifyLibuild(config, next) {
13
- const lastEsbuildOptions = config.esbuildOptions;
14
- config.esbuildOptions = (c) => {
15
- let lastEsbuildConfig = {};
16
- if (lastEsbuildOptions) {
17
- lastEsbuildConfig = lastEsbuildOptions(c);
18
- }
19
- return {
20
- ...lastEsbuildConfig,
21
- footer: options.footer,
22
- banner: options.banner
23
- };
24
- };
25
- return next(config);
26
- }
27
- })
28
- });
package/dist/esm/index.js DELETED
@@ -1,20 +0,0 @@
1
- export default (options) => ({
2
- name: "@modern-js/plugin-module-banner",
3
- setup: () => ({
4
- modifyLibuild(config, next) {
5
- const lastEsbuildOptions = config.esbuildOptions;
6
- config.esbuildOptions = (c) => {
7
- let lastEsbuildConfig = {};
8
- if (lastEsbuildOptions) {
9
- lastEsbuildConfig = lastEsbuildOptions(c);
10
- }
11
- return {
12
- ...lastEsbuildConfig,
13
- footer: options.footer,
14
- banner: options.banner
15
- };
16
- };
17
- return next(config);
18
- }
19
- })
20
- });
@@ -1,12 +0,0 @@
1
- import type { CliPlugin, ModuleTools } from '@modern-js/module-tools';
2
- declare const _default: (options: {
3
- banner: {
4
- js?: string;
5
- css?: string;
6
- };
7
- footer?: {
8
- js?: string;
9
- css?: string;
10
- };
11
- }) => CliPlugin<ModuleTools>;
12
- export default _default;