@sapphire/docusaurus-plugin-ts2esm2cjs 0.1.0-next.2e75537.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/LICENSE.md +24 -0
- package/README.md +183 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © `2021` `The Sapphire Community and its contributors`
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person
|
|
6
|
+
obtaining a copy of this software and associated documentation
|
|
7
|
+
files (the “Software”), to deal in the Software without
|
|
8
|
+
restriction, including without limitation the rights to use,
|
|
9
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the
|
|
11
|
+
Software is furnished to do so, subject to the following
|
|
12
|
+
conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be
|
|
15
|
+
included in all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
# @sapphire/docusaurus-plugin-ts2esm2cjs
|
|
6
|
+
|
|
7
|
+
**Docusaurus Remark plugin for converting TypeScript code to ESM and CJS code.**
|
|
8
|
+
|
|
9
|
+
[](https://github.com/sapphiredev/documentation-plugins/blob/main/LICENSE.md)
|
|
10
|
+
[](https://www.npmjs.com/package/@sapphire/docusaurus-plugin-ts2esm2cjs)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
## Description
|
|
15
|
+
|
|
16
|
+
This is a plugin for [Docusaurus](https://docusaurus.io) that adds support for a `ts2esmcjs` meta tag for code blocks.
|
|
17
|
+
It will transpile your TypeScript code into ESM and CJS code, and format it properly. It will then give you a component
|
|
18
|
+
using `Tabs` where users can select their preferred language. By default this will sync across all code blocks that use
|
|
19
|
+
this meta tag, you can disable that through the plugin options.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
In your `docusaurus.config.js`, for the plugins where you need this feature (doc, blog, pages, etc.), register it in the
|
|
24
|
+
`remarkPlugins` option. (See [Docs configuration][docconf] for more details on configuration format)
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
// docusaurus.config.js
|
|
28
|
+
module.exports = {
|
|
29
|
+
// ...
|
|
30
|
+
presets: [
|
|
31
|
+
[
|
|
32
|
+
'@docusaurus/preset-classic',
|
|
33
|
+
{
|
|
34
|
+
docs: {
|
|
35
|
+
remarkPlugins: [[require('@sapphire/docusaurus-plugin-ts2esm2cjs')]]
|
|
36
|
+
},
|
|
37
|
+
pages: {
|
|
38
|
+
remarkPlugins: [require('@sapphire/docusaurus-plugin-ts2esm2cjs')]
|
|
39
|
+
},
|
|
40
|
+
blog: {
|
|
41
|
+
// ...
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
And then use it by adding the `ts2esm2cjs` key to the code block:
|
|
50
|
+
|
|
51
|
+
**meta**: `_typescript ts2esm2cjs_`
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { Command, Args } from '@sapphire/framework';
|
|
55
|
+
import type { Message } from 'discord.js';
|
|
56
|
+
|
|
57
|
+
export class EchoCommand extends Command {
|
|
58
|
+
public constructor(context: Command.Context, options: Command.Options) {
|
|
59
|
+
super(context, {
|
|
60
|
+
...options,
|
|
61
|
+
aliases: ['parrot', 'copy'],
|
|
62
|
+
description: 'Replies with the text you provide'
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public async messageRun(message: Message, args: Args) {
|
|
67
|
+
// ...
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Line Highlighting
|
|
73
|
+
|
|
74
|
+
As you may be aware, Docusaurus supports [Line Highlighting][line-highlighting] for code blocks. As line highlighting
|
|
75
|
+
relies on meta just like this plugin would, we would normally run into a bit of a conflict as to what to set in the meta
|
|
76
|
+
tag. On top of that, often you'll want to highlight different lines for JavaScript as opposed to TypeScript. To solve
|
|
77
|
+
these issues this plugin supports a unique syntax of setting the meta tag. You can configure the line highlighting by
|
|
78
|
+
adding a `|` character after the plugin meta tag. This can be done twice, wherein the first line highlight configuration
|
|
79
|
+
will be for the JavaScript and ESM code blocks, whereas the second will be for the TypeScript code block.
|
|
80
|
+
|
|
81
|
+
For example consider the following code block:
|
|
82
|
+
|
|
83
|
+
**meta:** `_typescript ts2esm2cjs|{1,4-10}|{1,5-11}_ `
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { Command, Args } from '@sapphire/framework';
|
|
87
|
+
import type { Message } from 'discord.js';
|
|
88
|
+
|
|
89
|
+
export class EchoCommand extends Command {
|
|
90
|
+
public constructor(context: Command.Context, options: Command.Options) {
|
|
91
|
+
super(context, {
|
|
92
|
+
...options,
|
|
93
|
+
aliases: ['parrot', 'copy'],
|
|
94
|
+
description: 'Replies with the text you provide'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public async messageRun(message: Message, args: Args) {
|
|
99
|
+
// ...
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This will give you a three code blocks in a `Tabs` layout with the JavaScript and ESM code blocks having lines 1 and 4
|
|
105
|
+
through 10 highlighted, and the TypeScript code block having lines 1 and 5 through 11 highlighted.
|
|
106
|
+
|
|
107
|
+
### Code formatting
|
|
108
|
+
|
|
109
|
+
The output JS and ESM code is formatted using Prettier. The default configuration is:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"endOfLine": "lf",
|
|
114
|
+
"printWidth": 120,
|
|
115
|
+
"quoteProps": "as-needed",
|
|
116
|
+
"semi": true,
|
|
117
|
+
"singleQuote": true,
|
|
118
|
+
"tabWidth": 2,
|
|
119
|
+
"trailingComma": "none",
|
|
120
|
+
"useTabs": false,
|
|
121
|
+
"parser": "babel"
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can customize this by passing `prettierConfig` to the plugin options.
|
|
126
|
+
|
|
127
|
+
### TypeScript compiler options
|
|
128
|
+
|
|
129
|
+
The ESM code is transpiled from TypeScript using the TypeScript compiler with the following base configuration:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"newLine": "lf",
|
|
134
|
+
"removeComments": false,
|
|
135
|
+
"esModuleInterop": true,
|
|
136
|
+
"pretty": true,
|
|
137
|
+
"module": "ESNext",
|
|
138
|
+
"moduleResolution": "Node",
|
|
139
|
+
"target": "ESNext"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
You can customize this by passing `typescriptCompilerOptions` to the plugin options. However, you cannot customize the
|
|
144
|
+
`module`, `moduleResolution`, or `target` options.
|
|
145
|
+
|
|
146
|
+
## Buy us some doughnuts
|
|
147
|
+
|
|
148
|
+
Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are
|
|
149
|
+
amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
|
|
150
|
+
|
|
151
|
+
We accept donations through Open Collective, Ko-fi, Paypal, Patreon and GitHub Sponsorships. You can use the buttons
|
|
152
|
+
below to donate through your method of choice.
|
|
153
|
+
|
|
154
|
+
| Donate With | Address |
|
|
155
|
+
| :-------------: | :-------------------------------------------------: |
|
|
156
|
+
| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |
|
|
157
|
+
| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) |
|
|
158
|
+
| Patreon | [Click Here](https://sapphirejs.dev/patreon) |
|
|
159
|
+
| PayPal | [Click Here](https://sapphirejs.dev/paypal) |
|
|
160
|
+
|
|
161
|
+
## Contributors ✨
|
|
162
|
+
|
|
163
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
164
|
+
|
|
165
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
166
|
+
<!-- prettier-ignore-start -->
|
|
167
|
+
<!-- markdownlint-disable -->
|
|
168
|
+
<table>
|
|
169
|
+
<tr>
|
|
170
|
+
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/documentation-plugins/commits?author=Favna" title="Code">💻</a> <a href="#infra-Favna" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#projectManagement-Favna" title="Project Management">📆</a></td>
|
|
171
|
+
</tr>
|
|
172
|
+
</table>
|
|
173
|
+
|
|
174
|
+
<!-- markdownlint-restore -->
|
|
175
|
+
<!-- prettier-ignore-end -->
|
|
176
|
+
|
|
177
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
178
|
+
|
|
179
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
|
|
180
|
+
Contributions of any kind welcome!
|
|
181
|
+
|
|
182
|
+
[docconf]: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#ex-config
|
|
183
|
+
[line-highlighting]: https://docusaurus.io/docs/markdown-features/code-blocks#line-highlighting
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Options } from 'prettier';
|
|
2
|
+
import { CompilerOptions } from 'typescript';
|
|
3
|
+
export interface PluginOptions {
|
|
4
|
+
sync?: boolean;
|
|
5
|
+
prettierOptions?: Options;
|
|
6
|
+
typescriptCompilerOptions?: CompilerOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare function ts2esm2cjs({ sync, prettierOptions, typescriptCompilerOptions }?: PluginOptions): (node: any) => ({
|
|
9
|
+
type: string;
|
|
10
|
+
value: string;
|
|
11
|
+
lang?: undefined;
|
|
12
|
+
meta?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
type: any;
|
|
15
|
+
lang: any;
|
|
16
|
+
meta: any;
|
|
17
|
+
value: any;
|
|
18
|
+
})[] | null;
|
|
19
|
+
export default ts2esm2cjs;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAiB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA8HjD,MAAM,WAAW,aAAa;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yBAAyB,CAAC,EAAE,eAAe,CAAC;CAC5C;AAED,wBAAgB,UAAU,CACzB,EAAE,IAAW,EAAE,eAAoB,EAAE,yBAA8B,EAAE,GAAE,aAItE,UAK0B,GAAG;;;;;;;;;;YA+B9B;AAGD,eAAe,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ts2esm2cjs = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const prettier_config_1 = (0, tslib_1.__importDefault)(require("@sapphire/prettier-config"));
|
|
6
|
+
const esm_to_cjs_1 = require("esm-to-cjs");
|
|
7
|
+
const prettier_1 = (0, tslib_1.__importDefault)(require("prettier"));
|
|
8
|
+
const typescript_1 = (0, tslib_1.__importDefault)(require("typescript"));
|
|
9
|
+
const documentationPrettierConfig = {
|
|
10
|
+
...prettier_config_1.default,
|
|
11
|
+
tabWidth: 2,
|
|
12
|
+
useTabs: false,
|
|
13
|
+
printWidth: 120,
|
|
14
|
+
parser: 'babel'
|
|
15
|
+
};
|
|
16
|
+
const makeTsCompilerOptions = (overrideOptions) => ({
|
|
17
|
+
newLine: typescript_1.default.NewLineKind.LineFeed,
|
|
18
|
+
removeComments: false,
|
|
19
|
+
esModuleInterop: true,
|
|
20
|
+
pretty: true,
|
|
21
|
+
...overrideOptions,
|
|
22
|
+
module: typescript_1.default.ModuleKind.ESNext,
|
|
23
|
+
moduleResolution: typescript_1.default.ModuleResolutionKind.NodeJs,
|
|
24
|
+
target: typescript_1.default.ScriptTarget.ESNext
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Transpiles input TypeScript code to ESM code.
|
|
28
|
+
* @param code The code to transpile
|
|
29
|
+
* @returns Input code transpiled to ESM
|
|
30
|
+
*/
|
|
31
|
+
const tsToEsm = (code, options) => typescript_1.default.transpileModule(code, { reportDiagnostics: false, compilerOptions: makeTsCompilerOptions(options.typescriptCompilerOptions) });
|
|
32
|
+
/**
|
|
33
|
+
* Transforms input ESM code to CJS code.
|
|
34
|
+
* @param code The code to transform
|
|
35
|
+
* @returns Input code transformed to CommonJS
|
|
36
|
+
*/
|
|
37
|
+
const esmToCjs = (code) => (0, esm_to_cjs_1.runTransform)(code, { quote: 'single' });
|
|
38
|
+
/**
|
|
39
|
+
* Escaped new lines in code with block comments so they can be restored by {@link restoreNewLines}
|
|
40
|
+
* @param code The code to escape new lines in
|
|
41
|
+
* @returns The same code but with new lines escaped using block comments
|
|
42
|
+
*/
|
|
43
|
+
const escapeNewLines = (code) => code.replace(/\n\n/g, '\n/* :newline: */');
|
|
44
|
+
/**
|
|
45
|
+
* Reverses {@link escapeNewLines} and restores new lines
|
|
46
|
+
* @param code The code with escaped new lines
|
|
47
|
+
* @returns The same code with new lines restored
|
|
48
|
+
*/
|
|
49
|
+
const restoreNewLines = (code) => code.replace(/\/\* :newline: \*\//g, '\n');
|
|
50
|
+
/**
|
|
51
|
+
* Formats the code using Prettier
|
|
52
|
+
* @param code The code to prettier format
|
|
53
|
+
* @param prettierConfig Additional prettier options to use for formatting
|
|
54
|
+
* @returns Prettier formatted code
|
|
55
|
+
*/
|
|
56
|
+
const prettierFormatCode = (code, prettierConfig) => prettier_1.default.format(code, { ...documentationPrettierConfig, ...prettierConfig }).slice(0, -1);
|
|
57
|
+
/**
|
|
58
|
+
* Transforms a Docusaurus node from TypeScript to ESM and CJS
|
|
59
|
+
* @param node The Docusaurus node to transform
|
|
60
|
+
* @param isSync Whether the transform should synchronize between all entries of this type
|
|
61
|
+
* @returns The transformed node in the form of Tabs.
|
|
62
|
+
*/
|
|
63
|
+
const transformNode = (node, options) => {
|
|
64
|
+
const groupIdProp = options.sync ? 'groupId="ts2esm2cjs" ' : '';
|
|
65
|
+
const tsCode = escapeNewLines(node.value);
|
|
66
|
+
const esmCode = tsToEsm(tsCode, { typescriptCompilerOptions: options.typescriptCompilerOptions }).outputText;
|
|
67
|
+
const cjsCode = esmToCjs(esmCode);
|
|
68
|
+
const [, jsHighlight, tsHighlight] = node.meta.split('|');
|
|
69
|
+
return [
|
|
70
|
+
{
|
|
71
|
+
type: 'jsx',
|
|
72
|
+
value: `<Tabs defaultValue="typescript" ${groupIdProp}` +
|
|
73
|
+
`values={[
|
|
74
|
+
{ label: 'JavaScript', value: 'javascript', },
|
|
75
|
+
{ label: 'ESM', value: 'esm', },
|
|
76
|
+
{ label: 'TypeScript', value: 'typescript', },
|
|
77
|
+
]}
|
|
78
|
+
>
|
|
79
|
+
<TabItem value="javascript">`
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: node.type,
|
|
83
|
+
lang: node.lang,
|
|
84
|
+
meta: jsHighlight,
|
|
85
|
+
value: prettierFormatCode(restoreNewLines(cjsCode), options.prettierOptions)
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'jsx',
|
|
89
|
+
value: '</TabItem>\n<TabItem value="esm">'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: node.type,
|
|
93
|
+
lang: node.lang,
|
|
94
|
+
meta: jsHighlight,
|
|
95
|
+
value: prettierFormatCode(restoreNewLines(esmCode), options.prettierOptions)
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'jsx',
|
|
99
|
+
value: '</TabItem>\n<TabItem value="typescript">'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
type: node.type,
|
|
103
|
+
lang: node.lang,
|
|
104
|
+
meta: tsHighlight,
|
|
105
|
+
value: node.value
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'jsx',
|
|
109
|
+
value: '</TabItem>\n</Tabs>'
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
};
|
|
113
|
+
const matchNode = (node) => node.type === 'code' && typeof node.meta === 'string' && node.meta.startsWith('ts2esm2cjs');
|
|
114
|
+
const nodeForImport = {
|
|
115
|
+
type: 'import',
|
|
116
|
+
value: "import Tabs from '@theme/Tabs';\nimport TabItem from '@theme/TabItem';"
|
|
117
|
+
};
|
|
118
|
+
function ts2esm2cjs({ sync = true, prettierOptions = {}, typescriptCompilerOptions = {} } = {
|
|
119
|
+
sync: true,
|
|
120
|
+
prettierOptions: {},
|
|
121
|
+
typescriptCompilerOptions: {}
|
|
122
|
+
}) {
|
|
123
|
+
let transformed = false;
|
|
124
|
+
let alreadyImported = false;
|
|
125
|
+
const transformer = (node) => {
|
|
126
|
+
if (node.type === 'import' && node.value.includes('@theme/Tabs')) {
|
|
127
|
+
alreadyImported = true;
|
|
128
|
+
}
|
|
129
|
+
if (matchNode(node)) {
|
|
130
|
+
transformed = true;
|
|
131
|
+
return transformNode(node, { sync, prettierOptions, typescriptCompilerOptions });
|
|
132
|
+
}
|
|
133
|
+
if (Array.isArray(node.children)) {
|
|
134
|
+
let index = 0;
|
|
135
|
+
while (index < node.children.length) {
|
|
136
|
+
const result = transformer(node.children[index]);
|
|
137
|
+
if (result) {
|
|
138
|
+
node.children.splice(index, 1, ...result);
|
|
139
|
+
index += result.length;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
index += 1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (node.type === 'root' && transformed && !alreadyImported) {
|
|
147
|
+
node.children.unshift(nodeForImport);
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
};
|
|
151
|
+
return transformer;
|
|
152
|
+
}
|
|
153
|
+
exports.ts2esm2cjs = ts2esm2cjs;
|
|
154
|
+
module.exports = ts2esm2cjs;
|
|
155
|
+
exports.default = ts2esm2cjs;
|
|
156
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,6FAA+D;AAC/D,2CAA0C;AAC1C,qEAA6C;AAC7C,yEAAiD;AAEjD,MAAM,2BAA2B,GAAY;IAC5C,GAAG,yBAAsB;IACzB,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,GAAG;IACf,MAAM,EA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GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBACjD,IAAI,MAAM,EAAE;oBACX,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;oBAC1C,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;iBACvB;qBAAM;oBACN,KAAK,IAAI,CAAC,CAAC;iBACX;aACD;SACD;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,WAAW,IAAI,CAAC,eAAe,EAAE;YAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SACrC;QAED,OAAO,IAAI,CAAC;IACb,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC;AACpB,CAAC;AAzCD,gCAyCC;AAED,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC;AAC5B,kBAAe,UAAU,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sapphire/docusaurus-plugin-ts2esm2cjs",
|
|
3
|
+
"version": "0.1.0-next.2e75537.0",
|
|
4
|
+
"description": "Docusaurus Remark plugin for converting TypeScript code to ESM and CJS code",
|
|
5
|
+
"author": "@sapphire",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"require": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "eslint src --ext ts --fix",
|
|
14
|
+
"build": "tsc -b src",
|
|
15
|
+
"clean": "tsc -b src --clean",
|
|
16
|
+
"watch": "tsc -b src -w",
|
|
17
|
+
"prepublishOnly": "yarn build"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@sapphire/prettier-config": "^1.2.4",
|
|
21
|
+
"esm-to-cjs": "^1.2.0",
|
|
22
|
+
"prettier": "^2.5.0",
|
|
23
|
+
"tslib": "^2.3.1",
|
|
24
|
+
"typescript": "^4.5.2"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/sapphiredev/documentation-plugins.git",
|
|
29
|
+
"directory": "packages/ts2esm2cjs"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"!dist/*.tsbuildinfo"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=v16.6.0",
|
|
37
|
+
"npm": ">=7.0.0"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"docusaurus",
|
|
41
|
+
"docusaurus-plugin",
|
|
42
|
+
"@sapphire",
|
|
43
|
+
"typescript",
|
|
44
|
+
"ts",
|
|
45
|
+
"esm",
|
|
46
|
+
"cjs",
|
|
47
|
+
"discord",
|
|
48
|
+
"sapphire",
|
|
49
|
+
"discordjs"
|
|
50
|
+
],
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/sapphiredev/documentation-plugins/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://www.sapphirejs.dev",
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/prettier": "^2"
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "2e75537a99d0614f55c4e3c8c963d0a37cf02768"
|
|
62
|
+
}
|