@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 +37 -22
- package/lib/index.d.ts +15 -0
- package/lib/index.js +30 -0
- package/lib/index.js.map +1 -0
- package/lib/structures/ITtscBannerPluginConfig.d.ts +13 -0
- package/lib/structures/ITtscBannerPluginConfig.js +3 -0
- package/lib/structures/ITtscBannerPluginConfig.js.map +1 -0
- package/lib/structures/TtscBannerConfig.d.ts +5 -0
- package/lib/structures/TtscBannerConfig.js +3 -0
- package/lib/structures/TtscBannerConfig.js.map +1 -0
- package/lib/structures/index.d.ts +2 -0
- package/lib/structures/index.js +19 -0
- package/lib/structures/index.js.map +1 -0
- package/package.json +26 -6
- package/plugin/main.go +1 -1
- package/src/index.ts +29 -0
- package/src/structures/ITtscBannerPluginConfig.ts +17 -0
- package/src/structures/TtscBannerConfig.ts +7 -0
- package/src/structures/index.ts +2 -0
- package/src/index.cjs +0 -12
package/README.md
CHANGED
|
@@ -9,17 +9,41 @@
|
|
|
9
9
|
[](https://github.com/samchon/ttsc/tree/master/docs)
|
|
10
10
|
[](https://discord.gg/E94XhzrUCZ)
|
|
11
11
|
|
|
12
|
-
`@ttsc/banner` adds a fixed `@packageDocumentation` JSDoc banner
|
|
12
|
+
`@ttsc/banner` adds a fixed `@packageDocumentation` JSDoc banner to the output.
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
16
|
-
Install `ttsc
|
|
16
|
+
Install `ttsc` and TypeScript-Go, then the banner plugin:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install -D ttsc @typescript/native-preview
|
|
19
|
+
npm install -D ttsc @typescript/native-preview
|
|
20
|
+
npm install -D @ttsc/banner
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
|
|
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
|
-
"
|
|
54
|
+
"config": "./config/banner.config.ts",
|
|
31
55
|
},
|
|
32
56
|
],
|
|
33
57
|
},
|
|
34
58
|
}
|
|
35
59
|
```
|
|
36
60
|
|
|
37
|
-
|
|
61
|
+
The explicit `config` path resolves from the selected `tsconfig.json` directory.
|
|
38
62
|
|
|
39
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
package/lib/index.js.map
ADDED
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"ITtscBannerPluginConfig.js","sourceRoot":"","sources":["../../src/structures/ITtscBannerPluginConfig.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscBannerConfig.js","sourceRoot":"","sources":["../../src/structures/TtscBannerConfig.ts"],"names":[],"mappings":""}
|
|
@@ -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.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "First-party ttsc plugin that adds package-documentation JSDoc banners during emit.",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
6
7
|
"exports": {
|
|
7
|
-
".":
|
|
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
|
-
"
|
|
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
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
|
+
}
|
package/src/index.cjs
DELETED