@ttsc/banner 0.8.1 → 0.9.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.
package/README.md CHANGED
@@ -9,17 +9,41 @@
9
9
  [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://github.com/samchon/ttsc/tree/master/docs)
10
10
  [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
11
11
 
12
- `@ttsc/banner` adds a fixed `@packageDocumentation` JSDoc banner by inserting a source preamble before TypeScript-Go parses the project.
12
+ `@ttsc/banner` adds a fixed `@packageDocumentation` JSDoc banner to the output.
13
13
 
14
14
  ## Setup
15
15
 
16
- Install `ttsc`, TypeScript-Go, and the banner plugin:
16
+ Install `ttsc` and TypeScript-Go, then the banner plugin:
17
17
 
18
18
  ```bash
19
- npm install -D ttsc @typescript/native-preview @ttsc/banner
19
+ npm install -D ttsc @typescript/native-preview
20
+ npm install -D @ttsc/banner
20
21
  ```
21
22
 
22
- Open your project's `tsconfig.json`, then add this entry under `compilerOptions.plugins`. If the file already has `compilerOptions`, merge this into the existing object:
23
+ Add `banner.config.ts` next to your project config:
24
+
25
+ ```ts
26
+ // banner.config.ts
27
+ import type { TtscBannerConfig } from "@ttsc/banner";
28
+
29
+ export default {
30
+ text: "License MIT (c) 2026 Acme",
31
+ } satisfies TtscBannerConfig;
32
+ ```
33
+
34
+ Run your normal `ttsc` command:
35
+
36
+ ```bash
37
+ npx ttsc
38
+ ```
39
+
40
+ If `@ttsc/banner` is installed and no banner config file can be found, the compile fails.
41
+
42
+ ## Configuration
43
+
44
+ Use `banner.config.ts` for ordinary projects.
45
+
46
+ Use `compilerOptions.plugins` only when the project needs a different config file path or inline text:
23
47
 
24
48
  ```jsonc
25
49
  {
@@ -27,37 +51,28 @@ Open your project's `tsconfig.json`, then add this entry under `compilerOptions.
27
51
  "plugins": [
28
52
  {
29
53
  "transform": "@ttsc/banner",
30
- "banner": "License MIT (c) 2026 Acme",
54
+ "config": "./config/banner.config.ts",
31
55
  },
32
56
  ],
33
57
  },
34
58
  }
35
59
  ```
36
60
 
37
- Run your normal `ttsc` command:
61
+ The explicit `config` path resolves from the selected `tsconfig.json` directory.
38
62
 
39
- ```bash
40
- npx ttsc
41
- ```
42
-
43
- The plugin formats every banner line inside a JSDoc block and adds `@packageDocumentation`. The banner follows TypeScript's normal comment emit policy, so `removeComments: true` removes it.
44
-
45
- ## Notes
46
-
47
- `@ttsc/banner` can be used with other `ttsc` plugins:
63
+ Existing inline text config remains supported:
48
64
 
49
65
  ```jsonc
50
66
  {
51
67
  "compilerOptions": {
52
68
  "plugins": [
53
- // Keep lint first.
54
- { "transform": "@ttsc/lint", "config": { "no-var": "error" } },
55
-
56
- // First-party utilities use their documented transform order.
57
- { "transform": "@ttsc/banner", "banner": "License MIT" },
58
- { "transform": "@ttsc/paths" },
59
- { "transform": "@ttsc/strip", "calls": ["console.log"] },
69
+ {
70
+ "transform": "@ttsc/banner",
71
+ "text": "License MIT (c) 2026 Acme",
72
+ },
60
73
  ],
61
74
  },
62
75
  }
63
76
  ```
77
+
78
+ The plugin formats every banner line inside a JSDoc block and adds `@packageDocumentation`. The banner follows TypeScript's normal comment emit policy, so `removeComments: true` removes it.
package/lib/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { ITtscBannerPluginConfig } from "./structures";
2
+ export * from "./structures/index";
3
+ type TtscPluginDescriptor = {
4
+ name: string;
5
+ source: string;
6
+ stage?: "check" | "transform";
7
+ };
8
+ type TtscPluginFactoryContext<TConfig> = {
9
+ binary: string;
10
+ cwd: string;
11
+ plugin: TConfig;
12
+ projectRoot: string;
13
+ tsconfig: string;
14
+ };
15
+ export default function createTtscBanner(_context: TtscPluginFactoryContext<ITtscBannerPluginConfig>): TtscPluginDescriptor;
package/lib/index.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = createTtscBanner;
21
+ const node_path_1 = __importDefault(require("node:path"));
22
+ __exportStar(require("./structures/index"), exports);
23
+ function createTtscBanner(_context) {
24
+ return {
25
+ name: "@ttsc/banner",
26
+ source: node_path_1.default.resolve(__dirname, "..", "plugin"),
27
+ stage: "transform",
28
+ };
29
+ }
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0DAA6B;AAI7B,qDAAmC;AAgBnC,0BACE,QAA2D;IAE3D,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC;QAC/C,KAAK,EAAE,WAAW;KACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /** `compilerOptions.plugins[]` entry shape consumed by `@ttsc/banner`. */
2
+ export interface ITtscBannerPluginConfig {
3
+ /** Set to `false` to keep the entry while disabling this plugin. */
4
+ enabled?: boolean;
5
+ /** Plugin module specifier. */
6
+ transform?: string;
7
+ /** Inline banner text. */
8
+ text?: string;
9
+ /** Path to `banner.config.*`, resolved from the selected tsconfig directory. */
10
+ config?: string;
11
+ /** Extra plugin-owned fields are passed through unchanged. */
12
+ [key: string]: unknown;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ITtscBannerPluginConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscBannerPluginConfig.js","sourceRoot":"","sources":["../../src/structures/ITtscBannerPluginConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /** Standalone `banner.config.*` file shape consumed by `@ttsc/banner`. */
2
+ export type TtscBannerConfig = string | {
3
+ /** Text inserted into the generated `@packageDocumentation` block. */
4
+ text: string;
5
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TtscBannerConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtscBannerConfig.js","sourceRoot":"","sources":["../../src/structures/TtscBannerConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./ITtscBannerPluginConfig";
2
+ export * from "./TtscBannerConfig";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ITtscBannerPluginConfig"), exports);
18
+ __exportStar(require("./TtscBannerConfig"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,qDAAmC"}
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@ttsc/banner",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "First-party ttsc plugin that adds package-documentation JSDoc banners during emit.",
5
- "main": "src/index.cjs",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
6
7
  "exports": {
7
- ".": "./src/index.cjs",
8
+ ".": {
9
+ "types": "./lib/index.d.ts",
10
+ "default": "./lib/index.js"
11
+ },
8
12
  "./package.json": "./package.json"
9
13
  },
10
14
  "keywords": [
@@ -13,12 +17,25 @@
13
17
  "typescript",
14
18
  "tsgo"
15
19
  ],
20
+ "ttsc": {
21
+ "plugin": {
22
+ "transform": "@ttsc/banner"
23
+ }
24
+ },
16
25
  "files": [
17
26
  "README.md",
18
- "src/index.cjs",
27
+ "lib",
28
+ "src",
19
29
  "go.mod",
20
- "plugin"
30
+ "plugin/banner.go",
31
+ "plugin/main.go"
21
32
  ],
33
+ "devDependencies": {
34
+ "@types/node": "^25.3.0",
35
+ "@typescript/native-preview": "7.0.0-dev.20260508.1",
36
+ "rimraf": "^6.1.2",
37
+ "ttsc": "0.9.0"
38
+ },
22
39
  "repository": {
23
40
  "type": "git",
24
41
  "url": "https://github.com/samchon/ttsc"
@@ -28,5 +45,8 @@
28
45
  "bugs": {
29
46
  "url": "https://github.com/samchon/ttsc/issues"
30
47
  },
31
- "homepage": "https://github.com/samchon/ttsc/tree/master/packages/banner#readme"
48
+ "homepage": "https://github.com/samchon/ttsc/tree/master/packages/banner#readme",
49
+ "scripts": {
50
+ "build": "rimraf lib && tsgo"
51
+ }
32
52
  }
package/plugin/main.go CHANGED
@@ -28,7 +28,7 @@ func run(args []string) int {
28
28
  case "transform":
29
29
  return utility.RunTransform(args[1:])
30
30
  case "check":
31
- return 0
31
+ return utility.RunCheck(args[1:])
32
32
  default:
33
33
  fmt.Fprintf(os.Stderr, "@ttsc/banner: unknown command %q\n", args[0])
34
34
  return 2
package/src/index.ts ADDED
@@ -0,0 +1,29 @@
1
+ import path from "node:path";
2
+
3
+ import type { ITtscBannerPluginConfig } from "./structures";
4
+
5
+ export * from "./structures/index";
6
+
7
+ type TtscPluginDescriptor = {
8
+ name: string;
9
+ source: string;
10
+ stage?: "check" | "transform";
11
+ };
12
+
13
+ type TtscPluginFactoryContext<TConfig> = {
14
+ binary: string;
15
+ cwd: string;
16
+ plugin: TConfig;
17
+ projectRoot: string;
18
+ tsconfig: string;
19
+ };
20
+
21
+ export default function createTtscBanner(
22
+ _context: TtscPluginFactoryContext<ITtscBannerPluginConfig>,
23
+ ): TtscPluginDescriptor {
24
+ return {
25
+ name: "@ttsc/banner",
26
+ source: path.resolve(__dirname, "..", "plugin"),
27
+ stage: "transform",
28
+ };
29
+ }
@@ -0,0 +1,17 @@
1
+ /** `compilerOptions.plugins[]` entry shape consumed by `@ttsc/banner`. */
2
+ export interface ITtscBannerPluginConfig {
3
+ /** Set to `false` to keep the entry while disabling this plugin. */
4
+ enabled?: boolean;
5
+
6
+ /** Plugin module specifier. */
7
+ transform?: string;
8
+
9
+ /** Inline banner text. */
10
+ text?: string;
11
+
12
+ /** Path to `banner.config.*`, resolved from the selected tsconfig directory. */
13
+ config?: string;
14
+
15
+ /** Extra plugin-owned fields are passed through unchanged. */
16
+ [key: string]: unknown;
17
+ }
@@ -0,0 +1,7 @@
1
+ /** Standalone `banner.config.*` file shape consumed by `@ttsc/banner`. */
2
+ export type TtscBannerConfig =
3
+ | string
4
+ | {
5
+ /** Text inserted into the generated `@packageDocumentation` block. */
6
+ text: string;
7
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./ITtscBannerPluginConfig";
2
+ export * from "./TtscBannerConfig";
package/src/index.cjs DELETED
@@ -1,12 +0,0 @@
1
- // @ts-check
2
- "use strict";
3
-
4
- const path = require("node:path");
5
-
6
- module.exports = function createTtscBanner() {
7
- return {
8
- name: "@ttsc/banner",
9
- source: path.resolve(__dirname, "..", "plugin"),
10
- stage: "transform",
11
- };
12
- };