Files
driver.js/package.json
T
Kamran Ahmed 630adda553 Ship hints as the driver.js/hints entry
Two separate vite runs rather than one multi-entry build. Multi-entry
splits the shared popover primitive into a chunk, which would make the
tour bundle depend on a second file and cost every existing user bytes
for a feature they may never use; it also merged both stylesheets into
driver.css. Standing the entries alone keeps driver.css byte-identical
to master and the tour bundle within ~120 bytes of it, and lets hints be
used without the tour. Importing both duplicates the primitive (~2KB
gzip), which is safe because the copies only handle their own popovers.

The hints run writes to dist-hints/ and the postbuild folds it into
dist/. That indirection is not incidental: vite-plugin-dts takes its
entry from package.json's `types` field when bundling, not from the lib
entry, so pointing it at hints emits the tour's API under the hints name
and overwrites dist/driver.js.d.ts. api-extractor rolls up the hints
declarations from an explicit entry instead.

hints/package.json is a resolution shim for legacy node10, which predates
`exports`; attw is green across node10, node16 ESM/CJS and bundler for
both entries. sideEffects marks only CSS, so bundlers can drop unused
code from either entry.

Sizes (gzip): tour 6.7KB unchanged in CSS and ~6.8KB in JS, hints 4.2KB
JS + 0.4KB CSS standalone.
2026-07-15 04:27:53 +01:00

109 lines
2.8 KiB
JSON

{
"name": "driver.js",
"license": "MIT",
"private": false,
"version": "1.7.0",
"packageManager": "pnpm@11.9.0",
"main": "./dist/driver.js.cjs",
"module": "./dist/driver.js.mjs",
"types": "./dist/driver.js.d.ts",
"homepage": "https://driverjs.com",
"repository": {
"type": "git",
"url": "git+https://github.com/nilbuild/driver.js.git"
},
"author": "Kamran Ahmed <kamranahmed.se@gmail.com>",
"bugs": {
"url": "https://github.com/nilbuild/driver.js/issues"
},
"sideEffects": [
"**/*.css"
],
"exports": {
".": {
"import": {
"types": "./dist/driver.js.d.mts",
"default": "./dist/driver.js.mjs"
},
"require": {
"types": "./dist/driver.js.d.cts",
"default": "./dist/driver.js.cjs"
}
},
"./hints": {
"import": {
"types": "./dist/hints.d.mts",
"default": "./dist/hints.mjs"
},
"require": {
"types": "./dist/hints.d.cts",
"default": "./dist/hints.cjs"
}
},
"./dist/driver.css": {
"import": "./dist/driver.css",
"require": "./dist/driver.css",
"default": "./dist/driver.css"
},
"./dist/hints.css": {
"import": "./dist/hints.css",
"require": "./dist/hints.css",
"default": "./dist/hints.css"
}
},
"scripts": {
"dev": "pnpm --dir playground dev",
"playground:install": "pnpm --dir playground install",
"build": "tsc && vite build && vite build --config vite.hints.config.ts && node scripts/postbuild.mjs",
"test": "vitest",
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
"lint:package": "publint && attw --pack . --exclude-entrypoints ./dist/driver.css ./dist/hints.css",
"format": "prettier . --write",
"release": "GITHUB_TOKEN=$(gh auth token) release-it",
"prepublishOnly": "pnpm build && pnpm lint:package"
},
"files": [
"!tests/**/*",
"!docs/**/*",
"dist/**/*",
"hints/package.json",
"!dist/**/*.js.map"
],
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.3",
"@microsoft/api-extractor": "^7.58.9",
"@release-it/keep-a-changelog": "^7.1.0",
"@types/jsdom": "^28.0.3",
"@types/node": "^26.0.0",
"@vitest/coverage-v8": "^4.1.9",
"jsdom": "^29.1.1",
"postcss": "^8.5.15",
"postcss-scss": "^4.0.9",
"prettier": "^3.8.4",
"publint": "^0.3.21",
"release-it": "^20.2.0",
"terser": "^5.48.0",
"typescript": "^6.0.3",
"vite": "^8.0.16",
"vite-plugin-dts": "^5.0.2",
"vitest": "^4.1.9"
},
"keywords": [
"driver.js",
"driver",
"tour",
"guide",
"overlay",
"tooltip",
"walkthrough",
"product tour",
"product walkthrough",
"product guide",
"product tutorial",
"product demo",
"modal",
"lightbox"
]
}