Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5d80550e7 | |||
23a0a59454 | |||
ccc391607a | |||
968c3aed0f | |||
9c7a80729b | |||
5f26ca1c94 | |||
3b9f80fb1a | |||
8da57bec51 | |||
63db9f290c | |||
e8bd4bd6c6 | |||
28d93b0c42 |
@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="../build/index.umd.js"></script>
|
<script src="../build/index.umd.js"></script>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Bullets and Numbering
|
# Bullets and Numbering
|
||||||
|
|
||||||
|
!> Bullets and Numbering requires an understanding of [Sections](usage/sections.md) and [Paragraphs](usage/paragraph.md).
|
||||||
|
|
||||||
`docx` is quite flexible in its bullets and numbering system, allowing
|
`docx` is quite flexible in its bullets and numbering system, allowing
|
||||||
the user great freedom in how bullets and numbers are to be styled and
|
the user great freedom in how bullets and numbers are to be styled and
|
||||||
displayed. E.g., numbers can be shown using Arabic numerals, roman
|
displayed. E.g., numbers can be shown using Arabic numerals, roman
|
||||||
@ -8,112 +10,128 @@ format also supports re-using bullets/numbering styles throughout the
|
|||||||
document, so that different lists using the same style need not
|
document, so that different lists using the same style need not
|
||||||
redefine them.
|
redefine them.
|
||||||
|
|
||||||
Because of this flexibility, bullets and numbering in DOCX involves a
|
## Configuration
|
||||||
couple of moving pieces:
|
|
||||||
|
|
||||||
1. Document-level bullets/numbering definitions (abstract)
|
Numbering is configured by adding config into `Document`:
|
||||||
2. Document-level bullets/numbering definitions (concrete)
|
|
||||||
3. Paragraph-level bullets/numbering selection
|
|
||||||
|
|
||||||
## Document-level bullets/numbering definitions (abstract)
|
|
||||||
|
|
||||||
Every document contains a set of abstract bullets/numbering
|
|
||||||
definitions which define the formatting and layout of paragraphs using
|
|
||||||
those bullets/numbering. An abstract numbering system defines how
|
|
||||||
bullets/numbers are to be shown for lists, including any sublists that
|
|
||||||
may be used. Thus each abstract definition includes a series of
|
|
||||||
_levels_ which form a sequence starting at 0 indicating the top-level
|
|
||||||
list look and increasing from there to describe the sublists, then
|
|
||||||
sub-sublists, etc. Each level includes the following properties:
|
|
||||||
|
|
||||||
* **level**: This is its 0-based index in the definition stack
|
|
||||||
* **numberFormat**: This indicates how the bullet or number should be
|
|
||||||
generated. Options include `bullet` (meaning don't count), `decimal`
|
|
||||||
(arabic numerals), `upperRoman`, `lowerRoman`, `hex`, and many
|
|
||||||
more.
|
|
||||||
* **levelText**: This is a format string using the output of the
|
|
||||||
`numberFormat` function and generating a string to insert before
|
|
||||||
every item in the list. You may use `%1`, `%2`, ... to reference the
|
|
||||||
numbers from each numbering level before this one. Thus a level
|
|
||||||
text of `%d)` with a number format of `lowerLetter` would result in
|
|
||||||
the sequence "a)", "b)", ...
|
|
||||||
* and a few others, which you can see in the OOXML spec section 17.9.6
|
|
||||||
|
|
||||||
## Document-level bullets/numbering definitions (concrete)
|
|
||||||
|
|
||||||
Concrete definitions are sort of like concrete subclasses of the
|
|
||||||
abstract definitions. They indicate their parent and are allowed to
|
|
||||||
override certain level definitions. Thus two lists that differ only in
|
|
||||||
how sub-sub-lists are to be displayed can share the same abstract
|
|
||||||
numbering definition and have slightly different concrete definitions.
|
|
||||||
|
|
||||||
## Paragraph-level bullets/numbering selection
|
|
||||||
|
|
||||||
In order to use a bullets/numbering definition (which must be
|
|
||||||
concrete), paragraphs need to select it, similar to applying a CSS
|
|
||||||
class to an element, using both the concrete numbering definition ID
|
|
||||||
and the level number that the paragraph should be at. Additionally, MS
|
|
||||||
Word and LibreOffice typically apply a "ListParagraph" style to
|
|
||||||
paragraphs that are being numbered.
|
|
||||||
|
|
||||||
## Using bullets/numbering in `docx`
|
|
||||||
|
|
||||||
`docx` includes a pre-defined bullet style which you can add to your
|
|
||||||
paragraphs using `para.bullets()`. If you require different bullet
|
|
||||||
styles or numbering of any kind, you'll have to use the
|
|
||||||
`docx.Numbering` class.
|
|
||||||
|
|
||||||
First you need to create a new numbering container class and use it to
|
|
||||||
create your abstract numbering style, define your levels, and create
|
|
||||||
your concrete numbering style:
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const numbering = new docx.Numbering();
|
new Document({
|
||||||
|
numbering: {
|
||||||
const abstractNum = numbering.createAbstractNumbering();
|
config: [...]
|
||||||
abstractNum.createLevel(0, "upperRoman", "%1", "start").addParagraphProperty(new Indent(720, 260));
|
}
|
||||||
abstractNum.createLevel(1, "decimal", "%2.", "start").addParagraphProperty(new Indent(1440, 980));
|
})
|
||||||
abstractNum.createLevel(2, "lowerLetter", "%3)", "start").addParagraphProperty(new Indent(2160, 1700));
|
|
||||||
|
|
||||||
const concrete = numbering.createConcreteNumbering(abstractNum);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then apply your concrete style to paragraphs using the
|
Each `config` entry includes the following properties:
|
||||||
`setNumbering` method:
|
|
||||||
|
. Each level includes the following properties:
|
||||||
|
|
||||||
|
| Property | Type | Notes | Possible Values |
|
||||||
|
| --------- | ----------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| reference | `string` | Required | A unique `string` |
|
||||||
|
| levels | `ILevelOptions[]` | Required | a series of _levels_ which form a sequence starting at 0 indicating the top-level list look and increasing from there to describe the sublists, then sub-sublists, etc |
|
||||||
|
|
||||||
|
### Level Options
|
||||||
|
|
||||||
|
Levels define the numbering definition itself, what it looks like, the indention, the alignment and the style. The reason why it is an array is because it allows the ability to create sub-lists. A sub list will have a different configuration because you may want the sub-list to have a different indentation or different bullet.
|
||||||
|
|
||||||
|
| Property | Type | Notes | Possible Values |
|
||||||
|
| --------- | ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| level | `number` | Required | The list level this definition is for. `0` is for the root level, `1` is for a sub list, `2` is for a sub-sub-list etc. |
|
||||||
|
| format | `LevelFormat` | Optional | `DECIMAL`, `UPPER_ROMAN`, `LOWER_ROMAN`, `UPPER_LETTER`, `LOWER_LETTER`, `ORDINAL`, `CARDINAL_TEXT`, `ORDINAL_TEXT`, `HEX`, `CHICAGO`, `IDEOGRAPH__DIGITAL`, `JAPANESE_COUNTING`, `AIUEO`, `IROHA`, `DECIMAL_FULL_WIDTH`, `DECIMAL_HALF_WIDTH`, `JAPANESE_LEGAL`, `JAPANESE_DIGITAL_TEN_THOUSAND`, `DECIMAL_ENCLOSED_CIRCLE`, `DECIMAL_FULL_WIDTH2`, `AIUEO_FULL_WIDTH`, `IROHA_FULL_WIDTH`, `DECIMAL_ZERO`, `BULLET`, `GANADA`, `CHOSUNG`, `DECIMAL_ENCLOSED_FULLSTOP`, `DECIMAL_ENCLOSED_PARENTHESES`, `DECIMAL_ENCLOSED_CIRCLE_CHINESE`, `IDEOGRAPH_ENCLOSED_CIRCLE`, `IDEOGRAPH_TRADITIONAL`, `IDEOGRAPH_ZODIAC`, `IDEOGRAPH_ZODIAC_TRADITIONAL`, `TAIWANESE_COUNTING`, `IDEOGRAPH_LEGAL_TRADITIONAL`, `TAIWANESE_COUNTING_THOUSAND`, `TAIWANESE_DIGITAL`, `CHINESE_COUNTING`, `CHINESE_LEGAL_SIMPLIFIED`, `CHINESE_COUNTING_THOUSAND`, `KOREAN_DIGITAL`, `KOREAN_COUNTING`, `KOREAN_LEGAL`, `KOREAN_DIGITAL2`, `VIETNAMESE_COUNTING`, `RUSSIAN_LOWER`, `RUSSIAN_UPPER`, `NONE`, `NUMBER_IN_DASH`, `HEBREW1`, `HEBREW2`, `ARABIC_ALPHA`, `ARABIC_ABJAD`, `HINDI_VOWELS`, `HINDI_CONSONANTS`, `HINDI_NUMBERS`, `HINDI_COUNTING`, `THAI_LETTERS`, `THAI_NUMBERS`, `THAI_COUNTING`, `BAHT_TEXT`, `DOLLAR_TEXT`, `CUSTOM` |
|
||||||
|
| text | `string` | Optional | A unique `string` to describe the shape of the bullet |
|
||||||
|
| alignment | `string` | Required | `START`, `CENTER`, `END`, `BOTH`, `MEDIUM_KASHIDA`, `DISTRIBUTE`, `NUM_TAB`, `HIGH_KASHIDA`, `LOW_KASHIDA`, `THAI_DISTRIBUTE`, `LEFT`, `RIGHT`, `JUSTIFIED` |
|
||||||
|
| style | `string` | Optional | [Sections](usage/styling-with-js.md) |
|
||||||
|
|
||||||
|
## Using ordered lists in `docx`
|
||||||
|
|
||||||
|
Add a `numbering` section to the `Document` to numbering style, define your levels. Use `LevelFormat.UPPER_ROMAN` for the `format` in `levels`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
topLevelP.setNumbering(concrete, 0);
|
const doc = new Document({
|
||||||
subP.setNumbering(concrete, 1);
|
...
|
||||||
subSubP.setNumbering(concrete, 2);
|
numbering: {
|
||||||
```
|
config: [
|
||||||
|
{
|
||||||
## Unindent numbering
|
reference: "my-numbering",
|
||||||
|
levels: [
|
||||||
Default:1. test
|
{
|
||||||
|
|
||||||
After:1.test
|
|
||||||
|
|
||||||
Use default numbering have indent,If you want unindent numbering
|
|
||||||
|
|
||||||
How to custom number see the demo:
|
|
||||||
https://runkit.com/dolanmiu/docx-demo3
|
|
||||||
|
|
||||||
```ts
|
|
||||||
|
|
||||||
enum LevelSuffix {
|
|
||||||
NOTHING = "nothing",
|
|
||||||
SPACE = "space",
|
|
||||||
TAB = "tab"
|
|
||||||
}
|
|
||||||
|
|
||||||
// custom numbering
|
|
||||||
const levels=[
|
|
||||||
{
|
|
||||||
level: 0,
|
level: 0,
|
||||||
format: "decimal",
|
format: LevelFormat.UPPER_ROMAN,
|
||||||
text: "%1.",
|
text: "%1",
|
||||||
alignment: AlignmentType.START,
|
alignment: AlignmentType.START,
|
||||||
suffix: LevelSuffix.NOTHING, // Cancel intent
|
style: {
|
||||||
}]
|
paragraph: {
|
||||||
|
indent: { left: 2880, hanging: 2420 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
...
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
And then on a `Paragraph`, we can add use the numbering created:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
new Paragraph({
|
||||||
|
text: "Hey you!",
|
||||||
|
numbering: {
|
||||||
|
reference: "my-numbering",
|
||||||
|
level: 0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
```
|
||||||
|
|
||||||
|
## Un-ordered lists / Bullet points
|
||||||
|
|
||||||
|
Add a `numbering` section to the `Document` to numbering style, define your levels. Use `LevelFormat.BULLET` for the `format` in `levels`:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
const doc = new Document({
|
||||||
|
...
|
||||||
|
numbering: {
|
||||||
|
config: [
|
||||||
|
{
|
||||||
|
reference: "my-bullet-points",
|
||||||
|
levels: [
|
||||||
|
{
|
||||||
|
level: 0,
|
||||||
|
format: LevelFormat.BULLET,
|
||||||
|
text: "\u1F60",
|
||||||
|
alignment: AlignmentType.LEFT,
|
||||||
|
style: {
|
||||||
|
paragraph: {
|
||||||
|
indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
...
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
And then on a `Paragraph`, we can add use the numbering created:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
new Paragraph({
|
||||||
|
text: "Hey you!",
|
||||||
|
numbering: {
|
||||||
|
reference: "my-bullet-points",
|
||||||
|
level: 0,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
```
|
||||||
|
|
||||||
|
## Full Example
|
||||||
|
|
||||||
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/3-numbering-and-bullet-points.ts ":include")
|
||||||
|
|
||||||
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/3-numbering-and-bullet-points.ts_
|
||||||
|
@ -9,11 +9,16 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
*Note*: Font and color selection from the theme are currently not supported.
|
||||||
|
|
||||||
3. You can even create a totally new `Style`:
|
3. You can even create a totally new `Style`:
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
*Note*: When selecting the style type, it is important to consider the component being used.
|
||||||
|
|
||||||
|
|
||||||
4. Save
|
4. Save
|
||||||
5. Re-name the saved `.docx` file to `.zip` and un-zip
|
5. Re-name the saved `.docx` file to `.zip` and un-zip
|
||||||
6. Find `styles.xml`
|
6. Find `styles.xml`
|
||||||
|
22
package-lock.json
generated
22
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "docx",
|
"name": "docx",
|
||||||
"version": "8.2.1",
|
"version": "8.2.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "docx",
|
"name": "docx",
|
||||||
"version": "8.2.1",
|
"version": "8.2.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^20.3.1",
|
"@types/node": "^20.3.1",
|
||||||
@ -39,7 +39,7 @@
|
|||||||
"inquirer": "^9.2.7",
|
"inquirer": "^9.2.7",
|
||||||
"jsdom": "^22.1.0",
|
"jsdom": "^22.1.0",
|
||||||
"pre-commit": "^1.2.2",
|
"pre-commit": "^1.2.2",
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^3.0.0",
|
||||||
"ts-node": "^10.2.1",
|
"ts-node": "^10.2.1",
|
||||||
"tsconfig-paths": "^4.0.0",
|
"tsconfig-paths": "^4.0.0",
|
||||||
"typedoc": "^0.24.8",
|
"typedoc": "^0.24.8",
|
||||||
@ -9444,15 +9444,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prettier": {
|
"node_modules/prettier": {
|
||||||
"version": "2.8.8",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz",
|
||||||
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
"integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin-prettier.js"
|
"prettier": "bin/prettier.cjs"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.13.0"
|
"node": ">=14"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||||
@ -19280,9 +19280,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"version": "2.8.8",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz",
|
||||||
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
"integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"prismjs": {
|
"prismjs": {
|
||||||
|
13
package.json
13
package.json
@ -1,20 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "docx",
|
"name": "docx",
|
||||||
"version": "8.2.1",
|
"version": "8.2.3",
|
||||||
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
|
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "build/index.umd.js",
|
"main": "build/index.umd.js",
|
||||||
"module": "./build/index.js",
|
"module": "./build/index.mjs",
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"browser": {
|
|
||||||
"default": "./build/index.umd.js"
|
|
||||||
},
|
|
||||||
"require": "./build/index.cjs",
|
"require": "./build/index.cjs",
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
"import": "./build/index.js",
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.mjs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
@ -93,7 +90,7 @@
|
|||||||
"inquirer": "^9.2.7",
|
"inquirer": "^9.2.7",
|
||||||
"jsdom": "^22.1.0",
|
"jsdom": "^22.1.0",
|
||||||
"pre-commit": "^1.2.2",
|
"pre-commit": "^1.2.2",
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^3.0.0",
|
||||||
"ts-node": "^10.2.1",
|
"ts-node": "^10.2.1",
|
||||||
"tsconfig-paths": "^4.0.0",
|
"tsconfig-paths": "^4.0.0",
|
||||||
"typedoc": "^0.24.8",
|
"typedoc": "^0.24.8",
|
||||||
|
@ -17,7 +17,11 @@ export class FooterWrapper implements IViewWrapper {
|
|||||||
private readonly footer: Footer;
|
private readonly footer: Footer;
|
||||||
private readonly relationships: Relationships;
|
private readonly relationships: Relationships;
|
||||||
|
|
||||||
public constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
|
public constructor(
|
||||||
|
private readonly media: Media,
|
||||||
|
referenceId: number,
|
||||||
|
initContent?: XmlComponent,
|
||||||
|
) {
|
||||||
this.footer = new Footer(referenceId, initContent);
|
this.footer = new Footer(referenceId, initContent);
|
||||||
this.relationships = new Relationships();
|
this.relationships = new Relationships();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,11 @@ export class HeaderWrapper implements IViewWrapper {
|
|||||||
private readonly header: Header;
|
private readonly header: Header;
|
||||||
private readonly relationships: Relationships;
|
private readonly relationships: Relationships;
|
||||||
|
|
||||||
public constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
|
public constructor(
|
||||||
|
private readonly media: Media,
|
||||||
|
referenceId: number,
|
||||||
|
initContent?: XmlComponent,
|
||||||
|
) {
|
||||||
this.header = new Header(referenceId, initContent);
|
this.header = new Header(referenceId, initContent);
|
||||||
this.relationships = new Relationships();
|
this.relationships = new Relationships();
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,11 @@ export const patchDocument = async (data: InputDataType, options: PatchDocumentO
|
|||||||
const hyperlinkRelationshipAdditions: IHyperlinkRelationshipAddition[] = [];
|
const hyperlinkRelationshipAdditions: IHyperlinkRelationshipAddition[] = [];
|
||||||
let hasMedia = false;
|
let hasMedia = false;
|
||||||
|
|
||||||
const binaryContentMap = new Map<string, Buffer>();
|
const binaryContentMap = new Map<string, Uint8Array>();
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(zipContent.files)) {
|
for (const [key, value] of Object.entries(zipContent.files)) {
|
||||||
if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
|
if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
|
||||||
binaryContentMap.set(key, await value.async("nodebuffer"));
|
binaryContentMap.set(key, await value.async("uint8array"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ export default defineConfig({
|
|||||||
tsconfigPaths(),
|
tsconfigPaths(),
|
||||||
dts(),
|
dts(),
|
||||||
nodePolyfills({
|
nodePolyfills({
|
||||||
exclude: ["fs"],
|
exclude: [],
|
||||||
globals: {
|
globals: {
|
||||||
Buffer: false,
|
Buffer: false,
|
||||||
},
|
},
|
||||||
@ -39,7 +39,7 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d === "es") {
|
if (d === "es") {
|
||||||
return "index.js";
|
return "index.mjs";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d === "iife") {
|
if (d === "iife") {
|
||||||
|
Reference in New Issue
Block a user