@reekon-tools/react-native-pdf-canvas 0.1.0 → 0.1.1

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.
@@ -17,5 +17,10 @@
17
17
  * synchronously by RN Skia's own import-time side effect, so importing the
18
18
  * barrel here is both correct and free of the web ordering hazard. `index.web.ts`
19
19
  * installs the CanvasKit-backed resolver instead. See `./skia/skia-api.ts`.
20
+ *
21
+ * Both entries are named in `package.json#sideEffects`; a re-export-only
22
+ * module is otherwise never executed by a tree-shaking bundler and the install
23
+ * goes with it. Metro does not tree-shake today, so native has never lost it,
24
+ * but the listing is what makes that a guarantee. See `index.web.ts`.
20
25
  */
21
26
  export * from './index.js';
@@ -17,6 +17,11 @@
17
17
  * synchronously by RN Skia's own import-time side effect, so importing the
18
18
  * barrel here is both correct and free of the web ordering hazard. `index.web.ts`
19
19
  * installs the CanvasKit-backed resolver instead. See `./skia/skia-api.ts`.
20
+ *
21
+ * Both entries are named in `package.json#sideEffects`; a re-export-only
22
+ * module is otherwise never executed by a tree-shaking bundler and the install
23
+ * goes with it. Metro does not tree-shake today, so native has never lost it,
24
+ * but the listing is what makes that a guarantee. See `index.web.ts`.
20
25
  */
21
26
  import { installNativeSkiaResolver } from './skia/resolve.native.js';
22
27
  export * from './index.js';
@@ -20,5 +20,15 @@
20
20
  * `globalThis.CanvasKit`) still gets a working `skiaApi()` without knowing this
21
21
  * package has a `./web-init` subpath. `loadPdfCanvasSkiaWeb()` remains the
22
22
  * explicit, awaitable route and is what the README points at.
23
+ *
24
+ * AND IT ONLY SURVIVES A BUNDLER BECAUSE THIS FILE IS NAMED IN
25
+ * `package.json#sideEffects`. This module declares no binding of its own —
26
+ * everything it exports is owned by another module — so under
27
+ * `"sideEffects": false` Rollup never marked it executed, dropped the call,
28
+ * and then eliminated the resolver slot it would have filled; every PDF canvas
29
+ * on the production web build threw `unsupported` on its first raster while
30
+ * dev (esbuild, which always keeps an entry's top-level code) stayed green.
31
+ * `__tests__/tree-shaking.test.ts` bundles a consumer of this file and asserts
32
+ * the install is kept.
23
33
  */
24
34
  export * from './index.js';
package/dist/index.web.js CHANGED
@@ -20,6 +20,16 @@
20
20
  * `globalThis.CanvasKit`) still gets a working `skiaApi()` without knowing this
21
21
  * package has a `./web-init` subpath. `loadPdfCanvasSkiaWeb()` remains the
22
22
  * explicit, awaitable route and is what the README points at.
23
+ *
24
+ * AND IT ONLY SURVIVES A BUNDLER BECAUSE THIS FILE IS NAMED IN
25
+ * `package.json#sideEffects`. This module declares no binding of its own —
26
+ * everything it exports is owned by another module — so under
27
+ * `"sideEffects": false` Rollup never marked it executed, dropped the call,
28
+ * and then eliminated the resolver slot it would have filled; every PDF canvas
29
+ * on the production web build threw `unsupported` on its first raster while
30
+ * dev (esbuild, which always keeps an entry's top-level code) stayed green.
31
+ * `__tests__/tree-shaking.test.ts` bundles a consumer of this file and asserts
32
+ * the install is kept.
23
33
  */
24
34
  import { installWebSkiaResolver } from './skia/resolve.web.js';
25
35
  export * from './index.js';
@@ -7,8 +7,12 @@
7
7
  *
8
8
  * The one thing it adds over the shared barrel is installing the native
9
9
  * resolver, so a consumer who imports ONLY this subpath still gets a working
10
- * `skiaApi()`. The call is a statement using an imported binding, not a bare
11
- * `import './x.js'` — this package declares `sideEffects: false`, and a bare
12
- * side-effect import is exactly what that flag licenses a bundler to delete.
10
+ * `skiaApi()`. The call only survives a bundler because this file is NAMED in
11
+ * `package.json#sideEffects`: a module that declares no used binding of its
12
+ * own (this one only re-exports) is otherwise never marked executed by
13
+ * Rollup, and its top-level statements go with it — a call on an imported
14
+ * binding is no safer than a bare `import './x.js'`. That is exactly how the
15
+ * web twin's install was dropped from the production web build once; see
16
+ * `__tests__/tree-shaking.test.ts`.
13
17
  */
14
18
  export * from './index.js';
@@ -7,9 +7,13 @@
7
7
  *
8
8
  * The one thing it adds over the shared barrel is installing the native
9
9
  * resolver, so a consumer who imports ONLY this subpath still gets a working
10
- * `skiaApi()`. The call is a statement using an imported binding, not a bare
11
- * `import './x.js'` — this package declares `sideEffects: false`, and a bare
12
- * side-effect import is exactly what that flag licenses a bundler to delete.
10
+ * `skiaApi()`. The call only survives a bundler because this file is NAMED in
11
+ * `package.json#sideEffects`: a module that declares no used binding of its
12
+ * own (this one only re-exports) is otherwise never marked executed by
13
+ * Rollup, and its top-level statements go with it — a call on an imported
14
+ * binding is no safer than a bare `import './x.js'`. That is exactly how the
15
+ * web twin's install was dropped from the production web build once; see
16
+ * `__tests__/tree-shaking.test.ts`.
13
17
  */
14
18
  import { installNativeSkiaResolver } from './resolve.native.js';
15
19
  export * from './index.js';
@@ -6,7 +6,9 @@
6
6
  * install itself decides nothing: it stores a closure, and
7
7
  * `globalThis.CanvasKit` is not read until the first raster.
8
8
  *
9
- * See `index.native.ts` for why this is a statement and not a bare
10
- * `import './resolve.web.js'`.
9
+ * This file is named in `package.json#sideEffects`, and must stay there: it
10
+ * declares no binding of its own, so without the listing Rollup never marks it
11
+ * executed and the install below is dropped. See `index.native.ts` and
12
+ * `__tests__/tree-shaking.test.ts`.
11
13
  */
12
14
  export * from './index.js';
@@ -6,8 +6,10 @@
6
6
  * install itself decides nothing: it stores a closure, and
7
7
  * `globalThis.CanvasKit` is not read until the first raster.
8
8
  *
9
- * See `index.native.ts` for why this is a statement and not a bare
10
- * `import './resolve.web.js'`.
9
+ * This file is named in `package.json#sideEffects`, and must stay there: it
10
+ * declares no binding of its own, so without the listing Rollup never marks it
11
+ * executed and the install below is dropped. See `index.native.ts` and
12
+ * `__tests__/tree-shaking.test.ts`.
11
13
  */
12
14
  import { installWebSkiaResolver } from './resolve.web.js';
13
15
  export * from './index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reekon-tools/react-native-pdf-canvas",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "PDF pages as Skia images, drawn at exact doc-space rects inside somebody else's transform. Owns no canvas, no gestures, no viewport state.",
5
5
  "author": "REEKON Tools",
6
6
  "license": "MIT",
@@ -12,7 +12,17 @@
12
12
  "access": "public"
13
13
  },
14
14
  "type": "module",
15
- "sideEffects": false,
15
+ "//sideEffects": "NOT `false`. The four entry files below are `export *` re-exports plus a top-level resolver install, and a bundler applies `sideEffects` to the IMPORTED module: with `false`, Rollup never marks a module that declares no used binding as executed and drops the call (that is what broke every PDF canvas on the production web build while dev — esbuild, entry-point code always kept — stayed green). `src/**` is listed so the property is testable against source; see `__tests__/tree-shaking.test.ts`. `web-init` is not listed: its install is inside an exported function.",
16
+ "sideEffects": [
17
+ "./dist/index.web.js",
18
+ "./dist/index.native.js",
19
+ "./dist/skia/index.web.js",
20
+ "./dist/skia/index.native.js",
21
+ "./src/index.web.ts",
22
+ "./src/index.native.ts",
23
+ "./src/skia/index.web.ts",
24
+ "./src/skia/index.native.ts"
25
+ ],
16
26
  "//files-scripts": "`scripts` ships because the peer-floor check runs from a CONSUMER'S postinstall, before/without any build of `dist`.",
17
27
  "//files": "`*.podspec` SHIPS OR iOS IS SILENTLY ABSENT. Autolinking reads the podspec out of the INSTALLED package, so a podspec that is not in this list means `pod install` finds nothing, `PdfCanvas` never appears in Podfile.lock, and `NativeModules.PdfCanvas` is undefined at runtime with no build error anywhere. `ios/Package.swift` and `ios/Tests` ship as part of `ios` and cost a few KB; they are what lets a consumer run the core's host tests against the exact version they installed.",
18
28
  "files": [