@hyperframes/parsers 0.9.87 → 0.9.89

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.
@@ -140,15 +140,18 @@ function findTrustedExecutable(name) {
140
140
  }
141
141
 
142
142
  // src/literalMediaInput.ts
143
- var PATTERN_IMAGE2_EXPANDS = /%(?:\d*d|[%*?[\]{}])/;
143
+ var PATTERN_IMAGE2_EXPANDS = /%\d*[d%*?[\]{}]/;
144
144
  var URL_SCHEME = /^[a-z][a-z0-9+.-]+:/i;
145
- function assertLiteralMediaInput(input) {
146
- const local = !URL_SCHEME.test(input) || /^file:/i.test(input);
147
- if (!local || !PATTERN_IMAGE2_EXPANDS.test(input)) return;
145
+ function refusePattern(path, use) {
146
+ const local = !URL_SCHEME.test(path) || /^file:/i.test(path);
147
+ if (!local || !PATTERN_IMAGE2_EXPANDS.test(path)) return;
148
148
  throw new Error(
149
- `[FFmpeg] refused media path "${input.split(/[\\/]/).pop()}": a "%" followed by a number and "d", another "%" or a wildcard would make ffmpeg read it as a pattern of other files. Rename the file or folder.`
149
+ `[FFmpeg] refused media path "${path.split(/[\\/]/).pop()}": a "%" followed by "d", another "%" or a wildcard, with or without digits between, would make ffmpeg ${use} it as a pattern of other files. Rename the file or folder.`
150
150
  );
151
151
  }
152
+ function assertLiteralMediaInput(input) {
153
+ refusePattern(input, "read");
154
+ }
152
155
 
153
156
  // src/ffBinaries.ts
154
157
  var FFMPEG_PATH_ENV = "HYPERFRAMES_FFMPEG_PATH";
@@ -1,4 +1,5 @@
1
1
  /** ffmpeg's image2 demuxer would open other files, folders included, than the one a project check approved. */
2
2
  declare function assertLiteralMediaInput(input: string): void;
3
+ declare function assertLiteralMediaOutput(output: string): void;
3
4
 
4
- export { assertLiteralMediaInput };
5
+ export { assertLiteralMediaInput, assertLiteralMediaOutput };
@@ -1,13 +1,20 @@
1
1
  // src/literalMediaInput.ts
2
- var PATTERN_IMAGE2_EXPANDS = /%(?:\d*d|[%*?[\]{}])/;
2
+ var PATTERN_IMAGE2_EXPANDS = /%\d*[d%*?[\]{}]/;
3
3
  var URL_SCHEME = /^[a-z][a-z0-9+.-]+:/i;
4
- function assertLiteralMediaInput(input) {
5
- const local = !URL_SCHEME.test(input) || /^file:/i.test(input);
6
- if (!local || !PATTERN_IMAGE2_EXPANDS.test(input)) return;
4
+ function refusePattern(path, use) {
5
+ const local = !URL_SCHEME.test(path) || /^file:/i.test(path);
6
+ if (!local || !PATTERN_IMAGE2_EXPANDS.test(path)) return;
7
7
  throw new Error(
8
- `[FFmpeg] refused media path "${input.split(/[\\/]/).pop()}": a "%" followed by a number and "d", another "%" or a wildcard would make ffmpeg read it as a pattern of other files. Rename the file or folder.`
8
+ `[FFmpeg] refused media path "${path.split(/[\\/]/).pop()}": a "%" followed by "d", another "%" or a wildcard, with or without digits between, would make ffmpeg ${use} it as a pattern of other files. Rename the file or folder.`
9
9
  );
10
10
  }
11
+ function assertLiteralMediaInput(input) {
12
+ refusePattern(input, "read");
13
+ }
14
+ function assertLiteralMediaOutput(output) {
15
+ refusePattern(output, "write");
16
+ }
11
17
  export {
12
- assertLiteralMediaInput
18
+ assertLiteralMediaInput,
19
+ assertLiteralMediaOutput
13
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/parsers",
3
- "version": "0.9.87",
3
+ "version": "0.9.89",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -151,7 +151,7 @@
151
151
  "tsx": "^4.21.0",
152
152
  "typescript": "^5.0.0",
153
153
  "vitest": "^4.1.12",
154
- "@hyperframes/core": "0.9.87"
154
+ "@hyperframes/core": "0.9.89"
155
155
  },
156
156
  "scripts": {
157
157
  "build": "tsup",