CodeVetter · Repo Unpack · System map
iamkun/dayjs
The runtime is a callable factory backed by one Dayjs class and shared locale state. Core date operations use native Date, constants, and a small utility module; plugins extend the same class and factory. Packaging separates the core from optional plugins and locales and supplies declarations for JavaScript consumers using TypeScript. GitHub Actions defines development checks and a separate master release pipeline.
- The package publishes dayjs.min.js as its main entry and index.d.ts as its declaration entry; the source factory is exported from src/index.js.
- src/index.js imports constants, English locale data, and utilities; module initialization registers English in Ls and selects it as the global locale.
- Dayjs owns a native Date in $d, cached year/month/day/time fields, a locale name in $L, and extension metadata in $x; construction invokes overridable parse and init methods.
- extend(plugin, option) passes the Dayjs class and factory to plugins and marks the plugin function with $i after installation; Ls and p expose shared locale and capability state.
- The timezone integration obtains offsets and names through host Intl.DateTimeFormat, while its implementation calls the separately supplied UTC API.
- build/index.js discovers locale files and plugin directories, emits separate bundles, builds the core, copies types to the package root, and creates locale.json; Rollup emits compact UMD with dayjs external.
- The babel script transpiles src into esm, then build/esm.js adjusts locale imports and relocates plugin declarations; .npmignore excludes source, tests, tooling, and original types from publication.
- Development pushes and PRs invoke reusable lint/test CI; master pushes gate release on that workflow, then build UMD/ESM, audit signatures, and invoke semantic-release.