@t4h.framework/zip 0.2.8 → 0.2.10
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/.ai/skills/framework-zip/SKILL.md +11 -17
- package/CHANGELOG.md +25 -0
- package/README.md +3 -3
- package/dist/helpers/ZipChecksum.d.ts.map +1 -1
- package/dist/helpers/ZipChecksum.js +12 -6
- package/dist/helpers/ZipChecksum.js.map +1 -1
- package/dist/helpers/ZipSource.js +1 -1
- package/dist/helpers/ZipSource.js.map +1 -1
- package/dist/helpers/extract-entry.js +1 -1
- package/dist/helpers/extract-entry.js.map +1 -1
- package/dist/helpers/open-archive.js +1 -1
- package/dist/helpers/open-archive.js.map +1 -1
- package/dist/tools/match-path.js +7 -8
- package/dist/tools/match-path.js.map +1 -1
- package/package.json +5 -4
|
@@ -44,7 +44,7 @@ carries the records, fan it out:
|
|
|
44
44
|
import { split, Split } from '@t4h.framework/fs'
|
|
45
45
|
import { unzip } from '@t4h.framework/zip'
|
|
46
46
|
|
|
47
|
-
const main = new Workflow(inputSchema, async input => {
|
|
47
|
+
const main = new Workflow({ id: 'main', schema: inputSchema }, async input => {
|
|
48
48
|
const archive = await sftp.get(input.path)
|
|
49
49
|
|
|
50
50
|
const [file] = await unzip(archive, { include: 'MOVIMENTO.TXT' })
|
|
@@ -93,17 +93,17 @@ a `/`, `**` does (`'**.csv'` reaches any depth, `'invoices/*'` one level). An
|
|
|
93
93
|
first, then read by range.
|
|
94
94
|
- **Corruption fails the activity.** CRC-32 and size are verified as the entry
|
|
95
95
|
flows to storage.
|
|
96
|
-
- **Hostile paths are refused** before anything is written (`../`, absolute,
|
|
97
|
-
drive qualified).
|
|
98
96
|
- **Format coverage.** Stored and deflate, ZIP64, data descriptors, archive
|
|
99
|
-
comments, UTF-8 and legacy names, empty entries.
|
|
100
|
-
|
|
97
|
+
comments, UTF-8 and legacy names, empty entries.
|
|
98
|
+
- **What `unzip` refuses.** It throws a `TypeError` for an encrypted entry and
|
|
99
|
+
for a compression method other than stored or deflate (bzip2, LZMA, zstd).
|
|
100
|
+
It also throws for a hostile path (`../`, absolute, drive qualified), before
|
|
101
|
+
it writes any entry.
|
|
101
102
|
|
|
102
103
|
## Limits
|
|
103
104
|
|
|
104
105
|
- **No writing.** The package reads archives; it does not create them. A file
|
|
105
106
|
to send compressed has to be produced another way.
|
|
106
|
-
- **Deflate and stored only.** bzip2, LZMA and zstd entries are refused.
|
|
107
107
|
- **Extraction is one activity per call.** The result is recorded whole, so a
|
|
108
108
|
`unzip` with no `include` over a 3 000-entry archive puts 3 000 references in
|
|
109
109
|
the history and 3 000 files in storage. Filter.
|
|
@@ -126,17 +126,11 @@ a `/`, `**` does (`'**.csv'` reaches any depth, `'invoices/*'` one level). An
|
|
|
126
126
|
|
|
127
127
|
## Anti-patterns
|
|
128
128
|
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
closure no longer exists. Its `contentLength` also has to lie — the real size
|
|
135
|
-
lives in the central directory — so every ranged `read` over it truncates.
|
|
136
|
-
`unzip` does the same work inside an activity; that is the supported way.
|
|
137
|
-
- **Inflating in workflow code.** `createInflateRaw` in a workflow re-runs on
|
|
138
|
-
every replay and holds the content in workflow memory. Extraction belongs to
|
|
139
|
-
an activity.
|
|
129
|
+
- `@t4h.framework/core/no-binary-subclass` rejects a lazy `Binary` that
|
|
130
|
+
inflates on `stream()` (`class ZipEntryBinary extends Binary`). `unzip` does
|
|
131
|
+
the same work inside an activity.
|
|
132
|
+
- `@t4h.framework/core/no-io-in-workflow` rejects `node:zlib` calls, such as
|
|
133
|
+
`createInflateRaw`, in a workflow. Extraction belongs to an activity.
|
|
140
134
|
- **Calling `unzip` per record.** Extract once, high in the workflow, and pass
|
|
141
135
|
the entry `Binary` down to children. `unzip` inside a loop or inside a helper
|
|
142
136
|
every child calls turns one extraction into thousands of activities.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @t4h.framework/zip
|
|
2
2
|
|
|
3
|
+
## 0.2.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#241](https://github.com/tech4humans-brasil/framework/pull/241) [`f6b8454`](https://github.com/tech4humans-brasil/framework/commit/f6b845484d22e7c8e7240fe2e113f1cdea7c8ce3) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds seven rules to `@t4h.framework/core/eslint` and turns them on in `configs.recommended`:
|
|
8
|
+
- `no-io-in-workflow` reports `fetch` and calls to network, file, database and mail modules in a workflow and in the `constructor`, `toInput` and `toOutput` of an activity. It also reports `zlib` and `stream` calls there, because they work on the content in memory on each replay.
|
|
9
|
+
- `no-binary-subclass` reports a class that extends `Binary`.
|
|
10
|
+
- `no-framework-activity-in-app` reports `new` and `extends` on an activity of a framework package other than the core.
|
|
11
|
+
- `no-testing-import-in-source` reports an import of a `@t4h.framework/<package>/testing` entry out of a test file.
|
|
12
|
+
- `require-workflow-id` reports a `Workflow` with no `id`.
|
|
13
|
+
- `no-secret-to-string` reports a `Secret` that becomes a string.
|
|
14
|
+
- `no-literal-secret-in-authorization` reports a string literal in the `secret` or `clientSecret` field of an `Authorization`.
|
|
15
|
+
|
|
16
|
+
The package skills now name these rules in place of the text that the rules enforce. The docs and skills give each `Workflow` an `id`, read the HMAC secret from `EnvDesign`, and do not document a custom HTTP activity.
|
|
17
|
+
|
|
18
|
+
- [#240](https://github.com/tech4humans-brasil/framework/pull/240) [`0606115`](https://github.com/tech4humans-brasil/framework/commit/0606115e2e0baa994e9f0ed3559ee54ecac88e44) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - The skills do not repeat a rule that a lint rule, `tsc` or a runtime error already enforces. Each such rule is now one line that names the gate. The examples that broke a gate (`process.env`, `as any`, an inline secret, an `EnvDesign` in a workflow file, `ref.output` before `wait()`) are correct now.
|
|
19
|
+
|
|
20
|
+
- [#228](https://github.com/tech4humans-brasil/framework/pull/228) [`d29e1ab`](https://github.com/tech4humans-brasil/framework/commit/d29e1ab29a039b13c3e4b075472bd615566ae75e) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Uses exact types and `unknown` in place of `any`, and checks external data with guards.
|
|
21
|
+
- harness: the fix-issues prompt lists each sensor as `- checkTypes: PASS`. Before, it printed `- 0: [object Object]`.
|
|
22
|
+
- hmac: an algorithm name such as `constructor` throws `Unsupported algorithm`.
|
|
23
|
+
- oidc: a discovery response with no `introspection_endpoint`, or a null introspection body, throws a clear error.
|
|
24
|
+
- `HttpRequestActivity.toOutput` takes `HttpRequestActivityOutput` in place of `any`.
|
|
25
|
+
|
|
26
|
+
## 0.2.9
|
|
27
|
+
|
|
3
28
|
## 0.2.8
|
|
4
29
|
|
|
5
30
|
## 0.2.7
|
package/README.md
CHANGED
|
@@ -105,9 +105,9 @@ The package never holds an archive, or an entry, in memory.
|
|
|
105
105
|
|
|
106
106
|
Ranged reads need a binary the file system claim owns. An `sftp.get` reference
|
|
107
107
|
or an HTTP body is not one: for those, the archive is streamed **once** into
|
|
108
|
-
storage (`zip/<activity-id>.zip`) and the ranges are read from that copy
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
storage (`zip/<activity-id>.zip`) and the ranges are read from that copy. It
|
|
109
|
+
costs one pass and one durable copy of the archive, and everything downstream
|
|
110
|
+
behaves identically.
|
|
111
111
|
|
|
112
112
|
Nothing has to be configured for this; it is the fallback, not a mode.
|
|
113
113
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZipChecksum.d.ts","sourceRoot":"","sources":["../../src/helpers/ZipChecksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,qBAAa,WAAY,SAAQ,SAAS;IAK5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJrC,OAAO,CAAC,QAAQ,CAAI;IAEpB,OAAO,CAAC,MAAM,CAAI;gBAEW,QAAQ,EAAE,sBAAsB;IAI7C,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,cAAc,EACzB,QAAQ,EAAE,iBAAiB,GAC1B,IAAI;
|
|
1
|
+
{"version":3,"file":"ZipChecksum.d.ts","sourceRoot":"","sources":["../../src/helpers/ZipChecksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,qBAAa,WAAY,SAAQ,SAAS;IAK5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJrC,OAAO,CAAC,QAAQ,CAAI;IAEpB,OAAO,CAAC,MAAM,CAAI;gBAEW,QAAQ,EAAE,sBAAsB;IAI7C,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,cAAc,EACzB,QAAQ,EAAE,iBAAiB,GAC1B,IAAI;IAmBS,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;CAqB1D"}
|
|
@@ -10,18 +10,24 @@ export class ZipChecksum extends Transform {
|
|
|
10
10
|
}
|
|
11
11
|
_transform(chunk, _encoding, callback) {
|
|
12
12
|
const { path, contentLength } = this.expected;
|
|
13
|
-
if (this.length + chunk.length > contentLength)
|
|
14
|
-
|
|
13
|
+
if (this.length + chunk.length > contentLength) {
|
|
14
|
+
callback(new SyntaxError(`ZIP entry "${path}" unpacked past the ${String(contentLength)} bytes the archive declares`));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
15
17
|
this.checksum = crc32(chunk, this.checksum);
|
|
16
18
|
this.length += chunk.length;
|
|
17
19
|
callback(null, chunk);
|
|
18
20
|
}
|
|
19
21
|
_flush(callback) {
|
|
20
22
|
const { path, crc32: expectedChecksum, contentLength } = this.expected;
|
|
21
|
-
if (this.length !== contentLength)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (this.length !== contentLength) {
|
|
24
|
+
callback(new SyntaxError(`ZIP entry "${path}" unpacked to ${String(this.length)} bytes, the archive declares ${String(contentLength)}`));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (this.checksum !== expectedChecksum) {
|
|
28
|
+
callback(new SyntaxError(`ZIP entry "${path}" failed its CRC-32 check`));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
25
31
|
callback();
|
|
26
32
|
}
|
|
27
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZipChecksum.js","sourceRoot":"","sources":["../../src/helpers/ZipChecksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAQjC,MAAM,OAAO,WAAY,SAAQ,SAAS;IAKX;IAJrB,QAAQ,GAAG,CAAC,CAAA;IAEZ,MAAM,GAAG,CAAC,CAAA;IAElB,YAA6B,QAAgC;QAC3D,KAAK,EAAE,CAAA;QADoB,aAAQ,GAAR,QAAQ,CAAwB;IAE7D,CAAC;IAEe,UAAU,CACxB,KAAa,EACb,SAAyB,EACzB,QAA2B;QAE3B,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAA;QAE7C,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"ZipChecksum.js","sourceRoot":"","sources":["../../src/helpers/ZipChecksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,a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W,CAAC,cAAc,IAAI,2BAA2B,CAAC,CAAC,CAAA;YAExE,OAAM;QACR,CAAC;QAED,QAAQ,EAAE,CAAA;IACZ,CAAC;CACF"}
|
|
@@ -24,7 +24,7 @@ export class ZipSource {
|
|
|
24
24
|
}
|
|
25
25
|
async stream(start, end) {
|
|
26
26
|
if (start < 0 || end > this.contentLength)
|
|
27
|
-
throw new SyntaxError(`ZIP archive is truncated: bytes ${start}-${end} are outside a file of ${this.contentLength} bytes`);
|
|
27
|
+
throw new SyntaxError(`ZIP archive is truncated: bytes ${String(start)}-${String(end)} are outside a file of ${String(this.contentLength)} bytes`);
|
|
28
28
|
const slice = await this.slice(start, end);
|
|
29
29
|
return await slice.stream();
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZipSource.js","sourceRoot":"","sources":["../../src/helpers/ZipSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAK9C,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACrB;IAA5B,YAA4B,MAAe;QACzC,KAAK,CAAC,mDAAmD,CAAC,CAAA;QADhC,WAAM,GAAN,MAAM,CAAS;QAGzC,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF;AAED,MAAM,OAAO,SAAS;IAED;IACD;IAFlB,YACmB,EAAmB,EACpB,MAAc;QADb,OAAE,GAAF,EAAE,CAAiB;QACpB,WAAM,GAAN,MAAM,CAAQ;IAC7B,CAAC;IAEJ,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAA;IAClC,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,KAAa,EAAE,GAAW;QAC1C,IAAI,GAAG,IAAI,KAAK;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAExC,OAAO,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE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,GAAG,CAAC,0BAA0B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAC5H,CAAA;QAEH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QAE1C,OAAO,MAAM,KAAK,CAAC,MAAM,EAAE,CAAA;IAC7B,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,KAAa,EAAE,GAAW;QAC5C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,wBAAwB,CAAC,KAAK,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -25,6 +25,6 @@ function assertReadable(entry) {
|
|
|
25
25
|
throw new TypeError(`ZIP entry "${entry.path}" is encrypted; encrypted archives are not supported`);
|
|
26
26
|
if (entry.compressionMethod !== ZIP_COMPRESSION_STORED &&
|
|
27
27
|
entry.compressionMethod !== ZIP_COMPRESSION_DEFLATE)
|
|
28
|
-
throw new TypeError(`ZIP entry "${entry.path}" uses compression method ${entry.compressionMethod}; only stored (0) and deflate (8) are supported`);
|
|
28
|
+
throw new TypeError(`ZIP entry "${entry.path}" uses compression method ${String(entry.compressionMethod)}; only stored (0) and deflate (8) are supported`);
|
|
29
29
|
}
|
|
30
30
|
//# sourceMappingURL=extract-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-entry.js","sourceRoot":"","sources":["../../src/helpers/extract-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAK5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA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
|
|
@@ -21,7 +21,7 @@ export async function openArchive(fs, binary, options) {
|
|
|
21
21
|
async function read(source, encoding) {
|
|
22
22
|
const { contentLength } = source;
|
|
23
23
|
if (contentLength < ZIP_END_OF_CENTRAL_DIRECTORY_LENGTH)
|
|
24
|
-
throw new SyntaxError(`A ZIP archive is at least ${ZIP_END_OF_CENTRAL_DIRECTORY_LENGTH} bytes, this file has ${contentLength}`);
|
|
24
|
+
throw new SyntaxError(`A ZIP archive is at least ${String(ZIP_END_OF_CENTRAL_DIRECTORY_LENGTH)} bytes, this file has ${String(contentLength)}`);
|
|
25
25
|
const end = findEndOfCentralDirectory(await readTail(source));
|
|
26
26
|
const { entryCount, centralDirectoryOffset, centralDirectoryLength } = end.zip64Offset === null
|
|
27
27
|
? end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-archive.js","sourceRoot":"","sources":["../../src/helpers/open-archive.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,+BAA+B,EAC/B,mCAAmC,EACnC,sBAAsB,EACtB,sBAAsB,EACtB,yCAAyC,EACzC,wBAAwB,GAEzB,MAAM,wBAAwB,CAAA;AAY/B,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,EAAmB,EACnB,MAAc,EACd,OAA2B;IAE3B,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,CAAC,IAAI,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,wBAAwB,CAAC;YAAE,MAAM,KAAK,CAAA;IAC/D,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,KAAK,CAC5B,OAAO,CAAC,WAAW,EACnB,MAAM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,OAAO,CAAC,MAAM,GAAG,UAAU,GAAI,CAAC;QACnD,MAAM,MAAM,GAAG,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QAE9D,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,MAAM,IAAI,MAAM,CAAC,MAAM,CAAA;IACzB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAC5B,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,MAAiB;IACvC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAA;IAEhC,MAAM,OAAO,GAAG;QACd,sBAAsB;QACtB,sBAAsB;YACpB,mCAAmC;YACnC,wBAAwB;KAC3B,CAAA;IAED,IAAI,IAAI,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAElC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QAE9C,IAAI,MAAM,IAAI,IAAI,CAAC,MAAM;YAAE,MAAK;QAEhC,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,aAAa,GAAG,MAAM,EAAE,aAAa,CAAC,CAAA;QAE/D,IAAI,wBAAwB,CAAC,IAAI,CAAC;YAAE,MAAK;IAC3C,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/tools/match-path.js
CHANGED
|
@@ -8,15 +8,14 @@ function toRegExp(pattern) {
|
|
|
8
8
|
return cached;
|
|
9
9
|
let source = '^';
|
|
10
10
|
for (let index = 0; index < pattern.length; index += 1) {
|
|
11
|
-
const char = pattern
|
|
11
|
+
const char = pattern.charAt(index);
|
|
12
|
+
if (char === '*' && pattern[index + 1] === '*') {
|
|
13
|
+
source += '.*';
|
|
14
|
+
index += 1;
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
12
17
|
if (char === '*') {
|
|
13
|
-
|
|
14
|
-
source += '.*';
|
|
15
|
-
index += 1;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
source += '[^/]*';
|
|
19
|
-
}
|
|
18
|
+
source += '[^/]*';
|
|
20
19
|
continue;
|
|
21
20
|
}
|
|
22
21
|
source += char === '?' ? '[^/]' : escape(char);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-path.js","sourceRoot":"","sources":["../../src/tools/match-path.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,QAA2B;IACjE,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;AAEvC,SAAS,QAAQ,CAAC,OAAe;IAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAEjC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAA;IAEzB,IAAI,MAAM,GAAG,GAAG,CAAA;IAEhB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"match-path.js","sourceRoot":"","sources":["../../src/tools/match-path.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,QAA2B;IACjE,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;AAEvC,SAAS,QAAQ,C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",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/zip",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|
|
@@ -26,14 +26,15 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc --project tsconfig.build.json",
|
|
28
28
|
"check-types": "tsc --noEmit",
|
|
29
|
-
"
|
|
29
|
+
"check-package": "publint --strict && attw --pack . --profile esm-only",
|
|
30
|
+
"lint": "eslint . --max-warnings 0",
|
|
30
31
|
"prepublishOnly": "yarn build",
|
|
31
32
|
"test": "vitest run",
|
|
32
33
|
"test:watch": "vitest"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@t4h.framework/core": "^0.
|
|
36
|
-
"@t4h.framework/fs": "^0.
|
|
36
|
+
"@t4h.framework/core": "^0.20.0",
|
|
37
|
+
"@t4h.framework/fs": "^0.13.1",
|
|
37
38
|
"typescript": "^5.9.3",
|
|
38
39
|
"vitest": "^4.0.18"
|
|
39
40
|
},
|