@json-to-office/core-pptx 0.26.0 → 0.28.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.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Scope the document base directory for a generation run, so relative asset
3
+ * paths (`image.props.path`, slide background images) resolve against the
4
+ * document's own location rather than `process.cwd()` (#142). No baseDir →
5
+ * plain callback, preserving the historical cwd-relative behavior. Mirrors
6
+ * core-docx/src/utils/generationContext.ts.
7
+ */
8
+ export declare function runWithBaseDir<T>(baseDir: string | undefined, callback: () => T): T;
9
+ /** The active document base directory, if a generation scope set one. */
10
+ export declare function getBaseDir(): string | undefined;
11
+ /**
12
+ * Resolve a relative file path against the active base directory. Absolute
13
+ * paths pass through; with no active baseDir the path is returned as-is,
14
+ * which pptxgenjs / `fs` resolve against cwd — the legacy behavior. The
15
+ * rewrite must happen eagerly at render time: pptxgenjs reads `path` entries
16
+ * later, during `write()`, outside any generation scope.
17
+ */
18
+ export declare function resolveFromBaseDir(filePath: string): string;
19
+ //# sourceMappingURL=baseDirContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseDirContext.d.ts","sourceRoot":"","sources":["../../src/utils/baseDirContext.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,QAAQ,EAAE,MAAM,CAAC,GAChB,CAAC,CAIH;AAED,yEAAyE;AACzE,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI3D"}
@@ -3,4 +3,18 @@ export declare function resolveImageSource(props: {
3
3
  base64?: string;
4
4
  path?: string;
5
5
  }): string | undefined;
6
+ /**
7
+ * Local files must live under the document base directory (when set) or CWD —
8
+ * path-traversal guard (#142). `resolved` must already be absolute.
9
+ */
10
+ export declare function isAllowedLocalPath(resolved: string): boolean;
11
+ /**
12
+ * Resolve a source string that may be a URL, data URI, or local file path:
13
+ * URLs and data URIs pass through; local paths resolve against the active
14
+ * document base directory when the generation scope set one, eagerly —
15
+ * pptxgenjs reads `path` entries during write(), outside the generation
16
+ * scope. Returns `undefined` when a local path escapes the allowed roots, so
17
+ * out-of-root paths never reach pptxgenjs (#142).
18
+ */
19
+ export declare function safeLocalPath(source: string): string | undefined;
6
20
  //# sourceMappingURL=imageSource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imageSource.d.ts","sourceRoot":"","sources":["../../src/utils/imageSource.ts"],"names":[],"mappings":"AAYA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,GAAG,SAAS,CAUrB"}
1
+ {"version":3,"file":"imageSource.d.ts","sourceRoot":"","sources":["../../src/utils/imageSource.ts"],"names":[],"mappings":"AAeA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,GAAG,SAAS,CAUrB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIhE"}
@@ -8,6 +8,7 @@ export declare const W: {
8
8
  readonly CHART_MULTI_SERIES: "CHART_MULTI_SERIES";
9
9
  readonly IMAGE_NO_SOURCE: "IMAGE_NO_SOURCE";
10
10
  readonly IMAGE_PROBE_FAILED: "IMAGE_PROBE_FAILED";
11
+ readonly IMAGE_PATH_OUTSIDE_ROOTS: "IMAGE_PATH_OUTSIDE_ROOTS";
11
12
  readonly MISSING_TEMPLATE: "MISSING_TEMPLATE";
12
13
  readonly UNKNOWN_PLACEHOLDER: "UNKNOWN_PLACEHOLDER";
13
14
  readonly PLACEHOLDER_NO_POSITION: "PLACEHOLDER_NO_POSITION";
@@ -1 +1 @@
1
- {"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/utils/warn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;CAoBJ,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;AAErD,wBAAgB,IAAI,CAClB,QAAQ,EAAE,eAAe,EAAE,GAAG,SAAS,EACvC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAC/B,IAAI,CAMN"}
1
+ {"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/utils/warn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBJ,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;AAErD,wBAAgB,IAAI,CAClB,QAAQ,EAAE,eAAe,EAAE,GAAG,SAAS,EACvC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAC/B,IAAI,CAMN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-to-office/core-pptx",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "Core PPTX presentation generation engine",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,8 +22,8 @@
22
22
  "jszip": "3.10.1",
23
23
  "pptxgenjs": "^3.12.0",
24
24
  "probe-image-size": "7.2.3",
25
- "@json-to-office/shared": "^0.25.0",
26
- "@json-to-office/shared-pptx": "^0.25.0"
25
+ "@json-to-office/shared": "^0.28.0",
26
+ "@json-to-office/shared-pptx": "^0.28.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "20.11.0",