@mlightcad/cad-pdf-plugin 1.5.5 → 1.5.6

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 mlight-lee
3
+ Copyright (c) 2026 mlightcad
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # @mlightcad/cad-pdf-plugin
2
2
 
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![npm version](https://img.shields.io/npm/v/@mlightcad/cad-pdf-plugin.svg)](https://www.npmjs.com/package/@mlightcad/cad-pdf-plugin)
5
+
3
6
  PDF **export** and **import** plugin for [`@mlightcad/cad-simple-viewer`](../cad-simple-viewer). Registers two system commands:
4
7
 
5
8
  | Command | Description |
@@ -36,6 +39,8 @@ Runtime dependencies (bundled with this package):
36
39
 
37
40
  ## Build
38
41
 
42
+ Produces `dist/index.js` (main library) and `dist/register.js` (lazy-registration entry).
43
+
39
44
  ```bash
40
45
  pnpm --filter @mlightcad/cad-pdf-plugin build
41
46
  ```
@@ -44,15 +49,17 @@ pnpm --filter @mlightcad/cad-pdf-plugin build
44
49
 
45
50
  ### Lazy registration (recommended)
46
51
 
47
- Register the plugin with the document manager's plugin manager. The module chunk loads on first use of `cpdf` or `ipdf`:
52
+ Register the plugin with the document manager's plugin manager. Import from the `/register` subpath so only the registration stub enters your initial bundle; the main plugin chunk loads on first use of `cpdf` or `ipdf`:
48
53
 
49
54
  ```typescript
50
55
  import { AcApDocManager } from '@mlightcad/cad-simple-viewer'
51
- import { registerLazyPdfPlugin } from '@mlightcad/cad-pdf-plugin'
56
+ import { registerLazyPdfPlugin } from '@mlightcad/cad-pdf-plugin/register'
52
57
 
53
58
  registerLazyPdfPlugin(AcApDocManager.instance.pluginManager)
54
59
  ```
55
60
 
61
+ Do **not** import `registerLazyPdfPlugin` from the package root in application code — that resolves to the full library build and defeats lazy loading.
62
+
56
63
  Equivalent manual registration:
57
64
 
58
65
  ```typescript
@@ -128,9 +135,9 @@ Import is **vector-only**; raster/scanned PDF pages produce no entities. Only th
128
135
 
129
136
  | Export | Role |
130
137
  |--------|------|
131
- | `registerLazyPdfPlugin` | One-line lazy registration helper |
132
138
  | `createPdfPlugin` | Async factory used by lazy loader |
133
139
  | `PDF_PLUGIN_NAME`, `PDF_PLUGIN_TRIGGERS` | Plugin id and command triggers |
140
+ | `@mlightcad/cad-pdf-plugin/register` | `registerLazyPdfPlugin` and registration constants |
134
141
  | `AcApPdfPlugin` | `AcApPlugin` implementation |
135
142
  | `AcApConvertToPdfCmd` | `cpdf` command class |
136
143
  | `AcApImportPdfCmd` | `ipdf` command class |
@@ -141,7 +148,7 @@ Import is **vector-only**; raster/scanned PDF pages produce no entities. Only th
141
148
 
142
149
  | Path | Role |
143
150
  |------|------|
144
- | `src/registerLazyPdfPlugin.ts` | Lazy plugin registration API |
151
+ | `src/register.ts` | Lazy plugin registration (`/register` entry) and `createPdfPlugin` |
145
152
  | `src/AcApPdfPlugin.ts` | Plugin lifecycle (`onLoad` / `onUnload`) |
146
153
  | `src/AcApConvertToPdfCmd.ts` | `cpdf` command |
147
154
  | `src/AcApImportPdfCmd.ts` | `ipdf` command |
@@ -0,0 +1,16 @@
1
+ const t = "PdfPlugin", e = ["cpdf", "ipdf"];
2
+ function i(n) {
3
+ n.registerLazyPlugin({
4
+ name: t,
5
+ triggers: [...e],
6
+ loader: async () => {
7
+ const { createPdfPlugin: r } = await import("@mlightcad/cad-pdf-plugin");
8
+ return r();
9
+ }
10
+ });
11
+ }
12
+ export {
13
+ t as PDF_PLUGIN_NAME,
14
+ e as PDF_PLUGIN_TRIGGERS,
15
+ i as registerLazyPdfPlugin
16
+ };
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.create;var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var l=(e,t,P,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of u(t))!d.call(e,r)&&r!==P&&n(e,r,{get:()=>t[r],enumerable:!(i=s(t,r))||i.enumerable});return e};var f=(e,t,P)=>(P=e!=null?o(c(e)):{},l(t||!e||!e.__esModule?n(P,"default",{value:e,enumerable:!0}):P,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g="PdfPlugin",a=["cpdf","ipdf"];function G(e){e.registerLazyPlugin({name:g,triggers:[...a],loader:async()=>{const{createPdfPlugin:t}=await import("@mlightcad/cad-pdf-plugin");return t()}})}exports.PDF_PLUGIN_NAME=g;exports.PDF_PLUGIN_TRIGGERS=a;exports.registerLazyPdfPlugin=G;