diff --git a/docs/PUBLICATION_CHECKLIST.md b/docs/PUBLICATION_CHECKLIST.md index 8897a90..18e1475 100644 --- a/docs/PUBLICATION_CHECKLIST.md +++ b/docs/PUBLICATION_CHECKLIST.md @@ -5,7 +5,7 @@ Verified as part of JSUI-WP-0002 (2026-07-08). ## Build outputs - [x] `npm run build` / `npm run build:prod` produces `dist/` bundles -- [x] `dist/testdrive-jsui.cjs.js` — CommonJS entry (`package.json` `main`) +- [x] `dist/testdrive-jsui.cjs` — CommonJS entry (`package.json` `main`) - [x] `dist/testdrive-jsui.esm.js` — ESM entry (`module`) - [x] `dist/testdrive-jsui.min.js` — UMD/browser (`browser`, `unpkg`, `jsdelivr`) - [x] `dist/testdrive-jsui.css` — packaged styles (`style` field) diff --git a/js/controls/contents-control.js b/js/controls/contents-control.js index 680dbc3..19bd709 100644 --- a/js/controls/contents-control.js +++ b/js/controls/contents-control.js @@ -282,6 +282,8 @@ class ContentsControl extends ControlBase { // Export for module systems or attach to global for direct usage if (typeof module !== 'undefined' && module.exports) { module.exports = ContentsControl; -} else { +} +// Also expose globally: bundlers shim `module`, so the else-branch never ran in dist builds +if (typeof window !== 'undefined') { window.ContentsControl = ContentsControl; } \ No newline at end of file diff --git a/js/controls/control-base.js b/js/controls/control-base.js index f37d52c..fa2f0f9 100644 --- a/js/controls/control-base.js +++ b/js/controls/control-base.js @@ -847,6 +847,8 @@ class ControlBase { // Export for module systems or attach to global for direct usage if (typeof module !== 'undefined' && module.exports) { module.exports = ControlBase; -} else { +} +// Also expose globally: bundlers shim `module`, so the else-branch never ran in dist builds +if (typeof window !== 'undefined') { window.ControlBase = ControlBase; } \ No newline at end of file diff --git a/js/controls/debug-control.js b/js/controls/debug-control.js index 431659e..0c8a886 100644 --- a/js/controls/debug-control.js +++ b/js/controls/debug-control.js @@ -478,6 +478,8 @@ class DebugControl extends ControlBase { // Export for module systems or attach to global for direct usage if (typeof module !== 'undefined' && module.exports) { module.exports = DebugControl; -} else { +} +// Also expose globally: bundlers shim `module`, so the else-branch never ran in dist builds +if (typeof window !== 'undefined') { window.DebugControl = DebugControl; } \ No newline at end of file diff --git a/js/controls/edit-control.js b/js/controls/edit-control.js index 1f36891..889b768 100644 --- a/js/controls/edit-control.js +++ b/js/controls/edit-control.js @@ -568,6 +568,8 @@ class EditControl extends ControlBase { // Export for module systems or attach to global for direct usage if (typeof module !== 'undefined' && module.exports) { module.exports = EditControl; -} else { +} +// Also expose globally: bundlers shim `module`, so the else-branch never ran in dist builds +if (typeof window !== 'undefined') { window.EditControl = EditControl; } \ No newline at end of file diff --git a/js/controls/status-control.js b/js/controls/status-control.js index 4f1ae60..e08f4db 100644 --- a/js/controls/status-control.js +++ b/js/controls/status-control.js @@ -366,6 +366,8 @@ class StatusControl extends ControlBase { // Export for module systems or attach to global for direct usage if (typeof module !== 'undefined' && module.exports) { module.exports = StatusControl; -} else { +} +// Also expose globally: bundlers shim `module`, so the else-branch never ran in dist builds +if (typeof window !== 'undefined') { window.StatusControl = StatusControl; } \ No newline at end of file diff --git a/package.json b/package.json index 1bd40d5..cb6bfac 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,25 @@ "version": "1.0.0", "description": "JavaScript-first markdown editor library with interactive UI", "type": "module", - "main": "dist/testdrive-jsui.cjs.js", + "main": "dist/testdrive-jsui.cjs", "module": "dist/testdrive-jsui.esm.js", "browser": "dist/testdrive-jsui.min.js", "style": "dist/testdrive-jsui.css", "unpkg": "dist/testdrive-jsui.min.js", "jsdelivr": "dist/testdrive-jsui.min.js", + "exports": { + ".": { + "types": "./types/index.d.ts", + "import": "./dist/testdrive-jsui.esm.js", + "require": "./dist/testdrive-jsui.cjs", + "browser": "./dist/testdrive-jsui.min.js", + "default": "./dist/testdrive-jsui.esm.js" + }, + "./style.css": "./dist/testdrive-jsui.css", + "./dist/testdrive-jsui.css": "./dist/testdrive-jsui.css", + "./dist/*": "./dist/*", + "./package.json": "./package.json" + }, "types": "types/index.d.ts", "files": [ "dist/", @@ -34,7 +47,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/markitect/testdrive-jsui.git" + "url": "git+https://github.com/markitect/testdrive-jsui.git" }, "keywords": [ "markdown", @@ -145,8 +158,17 @@ "jest" ], "rules": { - "semi": ["error", "always"], - "indent": ["error", 4, { "SwitchCase": 1 }], + "semi": [ + "error", + "always" + ], + "indent": [ + "error", + 4, + { + "SwitchCase": 1 + } + ], "space-before-function-paren": "off", "no-console": "warn", "no-debugger": "error" diff --git a/rollup.config.js b/rollup.config.js index 0b6ac63..7ba89a7 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -112,7 +112,7 @@ export default [ { input: 'src/index.js', output: { - file: 'dist/testdrive-jsui.cjs.js', + file: 'dist/testdrive-jsui.cjs', format: 'cjs', sourcemap: true, exports: 'named'