docx-to-vfile
Advanced tools
Comparing version 0.6.1 to 0.7.0
{ | ||
"name": "docx-to-vfile", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"license": "GPL-3.0-or-later", | ||
@@ -43,5 +43,5 @@ "repository": "https://github.com/TrialAndErrorOrg/parsers", | ||
"dependencies": { | ||
"unzipit": "1.4.2", | ||
"vfile": "5.3.7" | ||
"unzipit": "^1.4.2", | ||
"vfile": "^5.3.7" | ||
} | ||
} |
783
README.md
@@ -17,98 +17,98 @@ > **Note** | ||
- [docx-to-vfile](#docx-to-vfile) | ||
- [Contents](#contents) | ||
- [What is this?](#what-is-this) | ||
- [When should I use this?](#when-should-i-use-this) | ||
- [Install](#install) | ||
- [Use](#use) | ||
- [In Node](#in-node) | ||
- [In the browser](#in-the-browser) | ||
- [Output](#output) | ||
- [API](#api) | ||
- [`docxToVFile()`](#docxtovfile) | ||
- [Signature](#signature) | ||
- [Parameters](#parameters) | ||
- [Returns](#returns) | ||
- [`DocxData`](#docxdata) | ||
- [Hierarchy](#hierarchy) | ||
- [Indexable](#indexable) | ||
- [Properties](#properties) | ||
- [`media`](#media) | ||
- [Index signature](#index-signature) | ||
- [Type declaration](#type-declaration) | ||
- [`relations`](#relations) | ||
- [Index signature](#index-signature-1) | ||
- [Type declaration](#type-declaration-1) | ||
- [`DocxVFile`](#docxvfile) | ||
- [Hierarchy](#hierarchy-1) | ||
- [Properties](#properties-1) | ||
- [`cwd`](#cwd) | ||
- [`data`](#data) | ||
- [`history`](#history) | ||
- [`map`](#map) | ||
- [`messages`](#messages) | ||
- [`result`](#result) | ||
- [`stored`](#stored) | ||
- [`value`](#value) | ||
- [Accessors](#accessors) | ||
- [`basename`](#basename) | ||
- [Signature](#signature-1) | ||
- [Returns](#returns-1) | ||
- [Signature](#signature-2) | ||
- [Parameters](#parameters-1) | ||
- [Returns](#returns-2) | ||
- [`dirname`](#dirname) | ||
- [Signature](#signature-3) | ||
- [Returns](#returns-3) | ||
- [Signature](#signature-4) | ||
- [Parameters](#parameters-2) | ||
- [Returns](#returns-4) | ||
- [`extname`](#extname) | ||
- [Signature](#signature-5) | ||
- [Returns](#returns-5) | ||
- [Signature](#signature-6) | ||
- [Parameters](#parameters-3) | ||
- [Returns](#returns-6) | ||
- [`path`](#path) | ||
- [Signature](#signature-7) | ||
- [Returns](#returns-7) | ||
- [Signature](#signature-8) | ||
- [Parameters](#parameters-4) | ||
- [Returns](#returns-8) | ||
- [`stem`](#stem) | ||
- [Signature](#signature-9) | ||
- [Returns](#returns-9) | ||
- [Signature](#signature-10) | ||
- [Parameters](#parameters-5) | ||
- [Returns](#returns-10) | ||
- [Methods](#methods) | ||
- [`fail()`](#fail) | ||
- [Throws](#throws) | ||
- [Signature](#signature-11) | ||
- [Parameters](#parameters-6) | ||
- [Returns](#returns-11) | ||
- [`info()`](#info) | ||
- [Signature](#signature-12) | ||
- [Parameters](#parameters-7) | ||
- [Returns](#returns-12) | ||
- [`message()`](#message) | ||
- [Signature](#signature-13) | ||
- [Parameters](#parameters-8) | ||
- [Returns](#returns-13) | ||
- [`toString()`](#tostring) | ||
- [Signature](#signature-14) | ||
- [Parameters](#parameters-9) | ||
- [Returns](#returns-14) | ||
- [`Options`](#options) | ||
- [Properties](#properties-2) | ||
- [`include?`](#include) | ||
- [Default](#default) | ||
- [`withoutMedia?`](#withoutmedia) | ||
- [Default](#default-1) | ||
- [`XMLOrRelsString`](#xmlorrelsstring) | ||
- [Compatibility](#compatibility) | ||
- [Security](#security) | ||
- [Related](#related) | ||
- [Contribute](#contribute) | ||
- [License](#license) | ||
* [docx-to-vfile](#docx-to-vfile) | ||
* [Contents](#contents) | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [In Node](#in-node) | ||
* [In the browser](#in-the-browser) | ||
* [Output](#output) | ||
* [API](#api) | ||
* [`docxToVFile()`](#docxtovfile) | ||
* [Signature](#signature) | ||
* [Parameters](#parameters) | ||
* [Returns](#returns) | ||
* [`DocxData`](#docxdata) | ||
* [Hierarchy](#hierarchy) | ||
* [Indexable](#indexable) | ||
* [Properties](#properties) | ||
* [`media`](#media) | ||
* [Index signature](#index-signature) | ||
* [Type declaration](#type-declaration) | ||
* [`relations`](#relations) | ||
* [Index signature](#index-signature-1) | ||
* [Type declaration](#type-declaration-1) | ||
* [`DocxVFile`](#docxvfile) | ||
* [Hierarchy](#hierarchy-1) | ||
* [Properties](#properties-1) | ||
* [`cwd`](#cwd) | ||
* [`data`](#data) | ||
* [`history`](#history) | ||
* [`map`](#map) | ||
* [`messages`](#messages) | ||
* [`result`](#result) | ||
* [`stored`](#stored) | ||
* [`value`](#value) | ||
* [Accessors](#accessors) | ||
* [`basename`](#basename) | ||
* [Signature](#signature-1) | ||
* [Returns](#returns-1) | ||
* [Signature](#signature-2) | ||
* [Parameters](#parameters-1) | ||
* [Returns](#returns-2) | ||
* [`dirname`](#dirname) | ||
* [Signature](#signature-3) | ||
* [Returns](#returns-3) | ||
* [Signature](#signature-4) | ||
* [Parameters](#parameters-2) | ||
* [Returns](#returns-4) | ||
* [`extname`](#extname) | ||
* [Signature](#signature-5) | ||
* [Returns](#returns-5) | ||
* [Signature](#signature-6) | ||
* [Parameters](#parameters-3) | ||
* [Returns](#returns-6) | ||
* [`path`](#path) | ||
* [Signature](#signature-7) | ||
* [Returns](#returns-7) | ||
* [Signature](#signature-8) | ||
* [Parameters](#parameters-4) | ||
* [Returns](#returns-8) | ||
* [`stem`](#stem) | ||
* [Signature](#signature-9) | ||
* [Returns](#returns-9) | ||
* [Signature](#signature-10) | ||
* [Parameters](#parameters-5) | ||
* [Returns](#returns-10) | ||
* [Methods](#methods) | ||
* [`fail()`](#fail) | ||
* [Throws](#throws) | ||
* [Signature](#signature-11) | ||
* [Parameters](#parameters-6) | ||
* [Returns](#returns-11) | ||
* [`info()`](#info) | ||
* [Signature](#signature-12) | ||
* [Parameters](#parameters-7) | ||
* [Returns](#returns-12) | ||
* [`message()`](#message) | ||
* [Signature](#signature-13) | ||
* [Parameters](#parameters-8) | ||
* [Returns](#returns-13) | ||
* [`toString()`](#tostring) | ||
* [Signature](#signature-14) | ||
* [Parameters](#parameters-9) | ||
* [Returns](#returns-14) | ||
* [`Options`](#options) | ||
* [Properties](#properties-2) | ||
* [`include?`](#include) | ||
* [Default](#default) | ||
* [`withoutMedia?`](#withoutmedia) | ||
* [Default](#default-1) | ||
* [`XMLOrRelsString`](#xmlorrelsstring) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Related](#related) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
@@ -223,7 +223,7 @@ ## What is this? | ||
--- | ||
*** | ||
### `docxToVFile()` | ||
Takes a docx file as an ArrayBuffer and returns a VFile with the contents of the document.xml file as the root, and the contents of the other xml files as data. | ||
Takes a docx file as a Blob or File and returns a VFile with the contents of the document.xml file as the root, and the contents of the other xml files as data. | ||
@@ -233,3 +233,3 @@ #### Signature | ||
```ts | ||
docxToVFile(file: ArrayBuffer, userOptions: Options = {}): Promise<VFile>; | ||
docxToVFile(file: string | Blob | ArrayBuffer | File | Buffer, userOptions?: Options): Promise<VFile>; | ||
``` | ||
@@ -239,6 +239,6 @@ | ||
| Name | Type | Description | | ||
| :------------ | :------------------------------ | :------------------------------ | | ||
| `file` | `ArrayBuffer` | The docx file as an ArrayBuffer | | ||
| `userOptions` | [`Options`](modules.md#options) | - | | ||
| Name | Type | Description | | ||
| :------ | :------ | :------ | | ||
| `file` | `string` | `Blob` | `ArrayBuffer` | `File` | `Buffer` | The docx file as a Blob or File | | ||
| `userOptions?` | [`Options`](modules.md#options) | - | | ||
@@ -251,15 +251,10 @@ #### Returns | ||
Defined in: [src/lib/docx-to-vfile-unzipit.ts:90](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L90) | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:91](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L91) | ||
--- | ||
*** | ||
### `DocxData` | ||
### `DocxVFileData` | ||
The data attribute of a VFile | ||
Is set to the DataMap interface in the vfile module | ||
The data attribute of the VFile will contain the following: | ||
#### Hierarchy | ||
- `Data`.**DocxData** | ||
#### Indexable | ||
@@ -276,505 +271,126 @@ | ||
The media files in the .docx file | ||
Possibly undefined only to be compatible with the VFile interface | ||
###### Since | ||
0.5.0 - Added media, removed images | ||
###### Index signature | ||
[`key`: `string`]: `ArrayBuffer` | ||
[`key`: `string`]: `Blob` | ||
###### Type declaration | ||
Overrides: Data.media | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:53](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L53) | ||
Defined in: [src/lib/docx-to-vfile-unzipit.ts:45](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L45) | ||
##### `parsed?` | ||
##### `relations` | ||
> `object` | ||
The relations between the .xml files in the .docx file | ||
The parsed .xml files in the .docx file | ||
Usually added by `reoff-parse` | ||
###### Index signature | ||
[`key`: `string`]: `string` | ||
[`key`: [`XMLOrRelsString`](modules.md#xmlorrelsstring)]: `Root` | `undefined` | ||
###### Type declaration | ||
Overrides: Data.relations | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:72](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L72) | ||
Defined in: [src/lib/docx-to-vfile-unzipit.ts:49](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L49) | ||
##### `relations?` | ||
--- | ||
> `object` | ||
### `DocxVFile` | ||
Extends VFile with a custom data attribute | ||
This information should be on the VFile interface, this is just used in contexts where you only want to know the type of the data attribute, | ||
e.g. when writing a library that does something with the output of `docxToVFile`. | ||
#### Hierarchy | ||
- `VFile`.**DocxVFile** | ||
#### Properties | ||
##### `cwd` | ||
> `string` | ||
Base of `path` (default: `process.cwd()` or `'/'` in browsers). | ||
Inherited from: VFile.cwd | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:53 | ||
##### `data` | ||
> [`DocxData`](modules.md#docxdata) | ||
Overrides: VFile.data | ||
Defined in: [src/lib/docx-to-vfile-unzipit.ts:80](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L80) | ||
##### `history` | ||
> `string`[] | ||
List of filepaths the file moved between. | ||
The first is the original path and the last is the current path. | ||
Inherited from: VFile.history | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:47 | ||
##### `map` | ||
> `undefined` | `null` | `Map` | ||
Source map. | ||
This type is equivalent to the `RawSourceMap` type from the `source-map` | ||
module. | ||
Inherited from: VFile.map | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:85 | ||
##### `messages` | ||
> `VFileMessage`[] | ||
List of messages associated with the file. | ||
Inherited from: VFile.messages | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:39 | ||
##### `result` | ||
> `unknown` | ||
Custom, non-string, compiled, representation. | ||
This is used by unified to store non-string results. | ||
One example is when turning markdown into React nodes. | ||
Inherited from: VFile.result | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:76 | ||
##### `stored` | ||
> `boolean` | ||
Whether a file was saved to disk. | ||
This is used by vfile reporters. | ||
Inherited from: VFile.stored | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:67 | ||
##### `value` | ||
> `Value` | ||
Raw value. | ||
Inherited from: VFile.value | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:59 | ||
#### Accessors | ||
##### `basename` | ||
Get the basename (including extname) (example: `'index.min.js'`). | ||
###### Signature | ||
```ts | ||
basename(): undefined | string; | ||
{ | ||
document: { | ||
}; | ||
endnotes?: { | ||
}; | ||
footnotes?: { | ||
}; | ||
} | ||
``` | ||
###### Returns | ||
The relations between the .xml files in the .docx file | ||
Possibly undefined only to be compatible with the VFile interface | ||
`undefined` | `string` | ||
###### Since | ||
Inherited from: VFile.basename | ||
0.7.0 - Added relations.footnotes and relations.endnotes. `relations.document` is now an alias for `relations`. This now gets added by `reoff-parse`. | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:123 | ||
###### Type declaration | ||
Set basename (including extname) (`'index.min.js'`). | ||
| Member | Type | | ||
| :------ | :------ | | ||
| `document` | { } | | ||
| `endnotes`? | { } | | ||
| `footnotes`? | { } | | ||
Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` | ||
on windows). | ||
Cannot be nullified (use `file.path = file.dirname` instead). | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:61](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L61) | ||
###### Signature | ||
*** | ||
```ts | ||
basename(arg: undefined | string): void; | ||
``` | ||
### `Options` | ||
###### Parameters | ||
#### Hierarchy | ||
| Name | Type | | ||
| :---- | :---------- | -------- | | ||
| `arg` | `undefined` | `string` | | ||
* [`OptionsWithFetchConfig`](modules.md#optionswithfetchconfig) | ||
###### Returns | ||
#### Properties | ||
`void` | ||
##### `include?` | ||
Inherited from: VFile.basename | ||
> `string`[] | `RegExp`[] | (`key`: `string`) => `boolean` | `"all"` | `"allWithDocumentXML"` | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:119 | ||
Include only the specified files on the `data` attribute of the VFile. | ||
This may be useful if you want to only do something with a subset of the files in the docx file, and don't intend to use 'reoff-stringify' to turn the VFile back into a docx file. | ||
Inherited from: VFile.basename | ||
* If an array of strings or regexps is passed, only files that match one of the values will be included. | ||
* If a function is passed, it will be called for each file and should return true to include the file. | ||
* If the value is 'all', almost all files will be included, except for 'word/document.xml', as that already is the root of the VFile. | ||
* If the value is 'allWithDocumentXML', all files will be included, including `word/document.xml`, even though that is already the root of the VFile. Useful if you really want to mimic the original docx file. | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:119 node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:123 | ||
You should keep it at the default value if you intend to use 'reoff-stringify' to turn the VFile back into a docx file. | ||
##### `dirname` | ||
###### Default | ||
Get the parent path (example: `'~'`). | ||
'all' | ||
###### Signature | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:29](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L29) | ||
```ts | ||
dirname(): undefined | string; | ||
``` | ||
##### `withoutMedia?` | ||
###### Returns | ||
> `boolean` | ||
`undefined` | `string` | ||
Whether or not to include media in the VFile. | ||
Inherited from: VFile.dirname | ||
By default, images are included on the `data.media` attribute of the VFile as an object of Blobs, which are accessible both client and serverside. | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:111 | ||
###### Default | ||
Set the parent path (example: `'~'`). | ||
false | ||
Cannot be set if there’s no `path` yet. | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:15](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L15) | ||
###### Signature | ||
*** | ||
```ts | ||
dirname(arg: undefined | string): void; | ||
``` | ||
### `OptionsWithFetchConfig` | ||
###### Parameters | ||
#### Hierarchy | ||
| Name | Type | | ||
| :---- | :---------- | -------- | | ||
| `arg` | `undefined` | `string` | | ||
* [`Options`](modules.md#options).**OptionsWithFetchConfig** | ||
###### Returns | ||
#### Properties | ||
`void` | ||
##### `fetchConfig?` | ||
Inherited from: VFile.dirname | ||
> `RequestInit` | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:107 | ||
The config to pass to fetch, for e.g. authorization headers. | ||
Inherited from: VFile.dirname | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:36](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L36) | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:107 node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:111 | ||
##### `extname` | ||
Get the extname (including dot) (example: `'.js'`). | ||
###### Signature | ||
```ts | ||
extname(): undefined | string; | ||
``` | ||
###### Returns | ||
`undefined` | `string` | ||
Inherited from: VFile.extname | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:135 | ||
Set the extname (including dot) (example: `'.js'`). | ||
Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` | ||
on windows). | ||
Cannot be set if there’s no `path` yet. | ||
###### Signature | ||
```ts | ||
extname(arg: undefined | string): void; | ||
``` | ||
###### Parameters | ||
| Name | Type | | ||
| :---- | :---------- | -------- | | ||
| `arg` | `undefined` | `string` | | ||
###### Returns | ||
`void` | ||
Inherited from: VFile.extname | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:131 | ||
Inherited from: VFile.extname | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:131 node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:135 | ||
##### `path` | ||
Get the full path (example: `'~/index.min.js'`). | ||
###### Signature | ||
```ts | ||
path(): string; | ||
``` | ||
###### Returns | ||
`string` | ||
Inherited from: VFile.path | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:101 | ||
Set the full path (example: `'~/index.min.js'`). | ||
Cannot be nullified. | ||
You can set a file URL (a `URL` object with a `file:` protocol) which will | ||
be turned into a path with `url.fileURLToPath`. | ||
###### Signature | ||
```ts | ||
path(arg: string): void; | ||
``` | ||
###### Parameters | ||
| Name | Type | | ||
| :---- | :------- | | ||
| `arg` | `string` | | ||
###### Returns | ||
`void` | ||
Inherited from: VFile.path | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:95 | ||
Inherited from: VFile.path | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:95 node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:101 | ||
##### `stem` | ||
Get the stem (basename w/o extname) (example: `'index.min'`). | ||
###### Signature | ||
```ts | ||
stem(): undefined | string; | ||
``` | ||
###### Returns | ||
`undefined` | `string` | ||
Inherited from: VFile.stem | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:147 | ||
Set the stem (basename w/o extname) (example: `'index.min'`). | ||
Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'` | ||
on windows). | ||
Cannot be nullified (use `file.path = file.dirname` instead). | ||
###### Signature | ||
```ts | ||
stem(arg: undefined | string): void; | ||
``` | ||
###### Parameters | ||
| Name | Type | | ||
| :---- | :---------- | -------- | | ||
| `arg` | `undefined` | `string` | | ||
###### Returns | ||
`void` | ||
Inherited from: VFile.stem | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:143 | ||
Inherited from: VFile.stem | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:143 node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:147 | ||
#### Methods | ||
##### `fail()` | ||
Create a fatal error associated with the file. | ||
Its `fatal` is set to `true` and `file` is set to the current file path. | ||
Its added to `file.messages`. | ||
> 👉 **Note**: a fatal error means that a file is no longer processable. | ||
###### Throws | ||
Message. | ||
###### Signature | ||
```ts | ||
fail(reason: string | VFileMessage | Error, place?: null | Node<Data> | NodeLike | Position | Point, origin?: null | string): never; | ||
``` | ||
###### Parameters | ||
| Name | Type | Description | | ||
| :-------- | :------- | :------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- | ----------------------------------------- | | ||
| `reason` | `string` | `VFileMessage` | `Error` | Reason for message, uses the stack and message of the error if given. | | ||
| `place?` | `null` | `Node`<`Data`> | `NodeLike` | `Position` | `Point` | Place in file where the message occurred. | | ||
| `origin?` | `null` | `string` | Place in code where the message originates (example: `'my-package:my-rule'` or `'my-rule'`). | | ||
###### Returns | ||
`never` | ||
Message. | ||
Inherited from: VFile.fail | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:220 | ||
##### `info()` | ||
Create an info message associated with the file. | ||
Its `fatal` is set to `null` and `file` is set to the current file path. | ||
Its added to `file.messages`. | ||
###### Signature | ||
```ts | ||
info(reason: string | VFileMessage | Error, place?: null | Node<Data> | NodeLike | Position | Point, origin?: null | string): VFileMessage; | ||
``` | ||
###### Parameters | ||
| Name | Type | Description | | ||
| :-------- | :------- | :------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- | ----------------------------------------- | | ||
| `reason` | `string` | `VFileMessage` | `Error` | Reason for message, uses the stack and message of the error if given. | | ||
| `place?` | `null` | `Node`<`Data`> | `NodeLike` | `Position` | `Point` | Place in file where the message occurred. | | ||
| `origin?` | `null` | `string` | Place in code where the message originates (example: `'my-package:my-rule'` or `'my-rule'`). | | ||
###### Returns | ||
`VFileMessage` | ||
Message. | ||
Inherited from: VFile.info | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:195 | ||
##### `message()` | ||
Create a warning message associated with the file. | ||
Its `fatal` is set to `false` and `file` is set to the current file path. | ||
Its added to `file.messages`. | ||
###### Signature | ||
```ts | ||
message(reason: string | VFileMessage | Error, place?: null | Node<Data> | NodeLike | Position | Point, origin?: null | string): VFileMessage; | ||
``` | ||
###### Parameters | ||
| Name | Type | Description | | ||
| :-------- | :------- | :------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- | ----------------------------------------- | | ||
| `reason` | `string` | `VFileMessage` | `Error` | Reason for message, uses the stack and message of the error if given. | | ||
| `place?` | `null` | `Node`<`Data`> | `NodeLike` | `Position` | `Point` | Place in file where the message occurred. | | ||
| `origin?` | `null` | `string` | Place in code where the message originates (example: `'my-package:my-rule'` or `'my-rule'`). | | ||
###### Returns | ||
`VFileMessage` | ||
Message. | ||
Inherited from: VFile.message | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:174 | ||
##### `toString()` | ||
Serialize the file. | ||
###### Signature | ||
```ts | ||
toString(encoding?: null | BufferEncoding): string; | ||
``` | ||
###### Parameters | ||
| Name | Type | Description | | ||
| :---------- | :----- | :--------------- | ------------------------------------------------------------------------------------- | | ||
| `encoding?` | `null` | `BufferEncoding` | Character encoding to understand `value` as when it’s a `Buffer` (default: `'utf8'`). | | ||
###### Returns | ||
`string` | ||
Serialized file. | ||
Inherited from: VFile.toString | ||
Defined in: node_modules/.pnpm/vfile\@5.3.7/node_modules/vfile/lib/index.d.ts:157 | ||
--- | ||
### `Options` | ||
#### Properties | ||
##### `include?` | ||
@@ -787,6 +403,6 @@ | ||
- If an array of strings or regexps is passed, only files that match one of the values will be included. | ||
- If a function is passed, it will be called for each file and should return true to include the file. | ||
- If the value is 'all', almost all files will be included, except for 'word/document.xml', as that already is the root of the VFile. | ||
- If the value is 'allWithDocumentXML', all files will be included, including `word/document.xml`, even though that is already the root of the VFile. Useful if you really want to mimic the original docx file. | ||
* If an array of strings or regexps is passed, only files that match one of the values will be included. | ||
* If a function is passed, it will be called for each file and should return true to include the file. | ||
* If the value is 'all', almost all files will be included, except for 'word/document.xml', as that already is the root of the VFile. | ||
* If the value is 'allWithDocumentXML', all files will be included, including `word/document.xml`, even though that is already the root of the VFile. Useful if you really want to mimic the original docx file. | ||
@@ -799,4 +415,6 @@ You should keep it at the default value if you intend to use 'reoff-stringify' to turn the VFile back into a docx file. | ||
Defined in: [src/lib/docx-to-vfile-unzipit.ts:30](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L30) | ||
Inherited from: [Options](modules.md#options).[include](modules.md#include) | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:29](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L29) | ||
##### `withoutMedia?` | ||
@@ -808,3 +426,3 @@ | ||
By default, images are included on the `data.media` attribute of the VFile as an object of ArrayBuffers, which are accessible both client and serverside. | ||
By default, images are included on the `data.media` attribute of the VFile as an object of Blobs, which are accessible both client and serverside. | ||
@@ -815,6 +433,8 @@ ###### Default | ||
Defined in: [src/lib/docx-to-vfile-unzipit.ts:16](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L16) | ||
Inherited from: [Options](modules.md#options).[withoutMedia](modules.md#withoutmedia) | ||
--- | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:15](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L15) | ||
*** | ||
### `XMLOrRelsString` | ||
@@ -824,3 +444,3 @@ | ||
Defined in: [src/lib/docx-to-vfile-unzipit.ts:71](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L71) | ||
Defined in: [lib/docx-to-vfile-unzipit.ts:82](https://github.com/TrialAndErrorOrg/parsers/blob/main/libs/reoff/docx-to-vfile/src/lib/docx-to-vfile-unzipit.ts#L82) | ||
@@ -837,3 +457,3 @@ ## Compatibility | ||
- [`reoff-parse`][reoff-parse] — Parse the output of `docx-to-vfile` into a `VFile` with an `ooxast` tree. | ||
* [`reoff-parse`][reoff-parse] — Parse the output of `docx-to-vfile` into a `VFile` with an `ooxast` tree. | ||
@@ -847,28 +467,55 @@ ## Contribute | ||
[unified]: https://unifiedjs.com | ||
[unifiedgh]: https://github.com/unifiedjs/unified | ||
[xast-from-xml]: https://github.com/syntax-tree/xast-util-from-xml | ||
[rehype]: https://github.com/rehypejs/rehype | ||
[rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour | ||
[rejour-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-parse | ||
[rejour-stringify]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-stringify | ||
[rejour-move-abstract]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-move-abstract | ||
[rejour-meta]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-meta | ||
[rejour-relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-relatex | ||
[relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex | ||
[reoff-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/reoff-parse | ||
[jast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast | ||
[jast-util-to-texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast-util-to-texast | ||
[jastscript]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jastscript | ||
[texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast | ||
[texast-util-to-latex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast-util-to-latex | ||
[hast]: https://github.com/syntax-tree/hast | ||
[xast]: https://github.com/syntax-tree/xast | ||
[mdast]: https://github.com/syntax-tree/mdast | ||
[mdast-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown | ||
[latex-utensils]: https://github.com/tamuratak/latex-utensils | ||
[latexjs]: https://github.com/latexjs/latexjs | ||
[reoff]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff | ||
[reoff-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-parse | ||
[reoff-rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-rejour | ||
[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast | ||
[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast-util-to-jast |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18324
509
+ Addedunzipit@1.4.3(transitive)
- Removedunzipit@1.4.2(transitive)
Updatedunzipit@^1.4.2
Updatedvfile@^5.3.7