Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .configs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /.configs/eslint.config.mjs
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:42 -08:00 (1772687022)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
22 changes: 11 additions & 11 deletions .configs/tsconfig.dts.jsonc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* @Project: @cldmv/uuid
* @Filename: /.configs/tsconfig.dts.jsonc
* @Date: 2026-03-04 20:21:33 -08:00 (1772684493)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:19:45 -08:00 (1772687985)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
/**
* @Project: @cldmv/uuid
* @Filename: /.configs/tsconfig.dts.jsonc
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Shinrai <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/

{
Expand Down
8 changes: 4 additions & 4 deletions .configs/vitest.ci.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* @Project: @cldmv/fix-headers
* @Project: @cldmv/uuid
* @Filename: /.configs/vitest.ci.config.mjs
* @Date: 2026-02-25 17:34:15 -08:00 (1772069655)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-01T17:59:32-08:00 (1772416772)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2026-2026 Catalyzed Motivation Inc. All rights reserved.
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/

import base from "./vitest.config.mjs";
Expand Down
6 changes: 3 additions & 3 deletions .configs/vitest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /.configs/vitest.config.mjs
* @Date: 2025-09-09 13:22:38 -07:00 (1757449358)
* @Author: Nate Hyson <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
84 changes: 60 additions & 24 deletions devcheck.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /devcheck.mjs
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand All @@ -21,41 +21,77 @@ const srcPath = path.join(__dirname, "src");

// Detect if we're running in a CI environment
const isCI = !!(
(
process.env.CI || // Generic CI flag
process.env.GITHUB_ACTIONS || // GitHub Actions
process.env.TRAVIS || // Travis CI
process.env.CIRCLECI || // CircleCI
process.env.GITLAB_CI || // GitLab CI
process.env.BUILDKITE || // Buildkite
process.env.JENKINS_URL || // Jenkins
process.env.TF_BUILD
) // Azure DevOps
process.env.CI || // Generic CI flag
process.env.GITHUB_ACTIONS || // GitHub Actions
process.env.TRAVIS || // Travis CI
process.env.CIRCLECI || // CircleCI
process.env.GITLAB_CI || // GitLab CI
process.env.BUILDKITE || // Buildkite
process.env.JENKINS_URL || // Jenkins
process.env.TF_BUILD // Azure DevOps
);

if (existsSync(srcPath) && !isCI) {
const nodeEnv = process.env.NODE_ENV?.toLowerCase();
const hasUUIDDev = process.env.NODE_OPTIONS?.includes("--conditions=uuid-dev");
// Skip when installed as a dependency (a `node_modules` segment anywhere above this
// file - covers scoped `node_modules/@cldmv/uuid` and unscoped installs). The
// npm-published package ships neither `src/` nor this file, so this branch is already
// moot there; but a git/tarball install DOES include them, and without this guard
// devcheck would `process.exit(1)` inside a consumer's app. A "parent dir ===
// node_modules" check would miss scoped packages (parent is the scope dir).
const isInstalledPackage = __dirname.split(path.sep).includes("node_modules");

if (!nodeEnv || (!["", "development"].includes(nodeEnv) && !hasUUIDDev)) {
// Only meaningful in a source checkout. When `src/` is present the developer should be
// loading from it via the `uuid-dev` condition; if that condition isn't set they are
// silently running the built `dist/` copy instead, so warn - even after a build, since
// a built checkout has BOTH src/ and dist/ and the condition is the only thing that
// selects src/.
if (existsSync(srcPath) && !isCI && !isInstalledPackage) {
// The condition selects src/ (see the `./main` export in package.json). It can be
// supplied via NODE_OPTIONS (`NODE_OPTIONS=--conditions=uuid-dev`) OR directly on the
// node CLI (`node --conditions=uuid-dev` / `-C uuid-dev`), which lands in execArgv -
// this is how vitest passes it to workers - so scan both. Each `--conditions`
// occurrence is ONE literal condition value: Node does not split it on `,` or `|`
// (verified - `--conditions=uuid-dev,x` and `--conditions=uuid-dev|x` do NOT enable
// `uuid-dev`), and multiple conditions are passed as repeated flags. So collect each
// value whole and match EXACTLY - no substring, no splitting - so `not-uuid-dev`,
// `uuid-dev,x`, and `uuid-dev|production` all correctly fail to count. Namespaced
// (not the generic `development`) so a consuming app's own `--conditions=development`
// can't flip this package to a source tree it doesn't ship. NODE_ENV is deliberately
// NOT consulted: it does not affect which tree resolves.
const conditions = [];
const scan = (tokens) => {
for (let i = 0; i < tokens.length; i++) {
if (tokens[i] === "--conditions" || tokens[i] === "-C") {
if (tokens[i + 1] !== undefined) conditions.push(tokens[i + 1]);
} else if (tokens[i].startsWith("--conditions=")) {
conditions.push(tokens[i].slice("--conditions=".length));
} else if (tokens[i].startsWith("-C=")) {
conditions.push(tokens[i].slice("-C=".length));
}
}
};
scan(process.execArgv);
scan((process.env.NODE_OPTIONS || "").split(/\s+/).filter(Boolean));
const hasUUIDDev = conditions.includes("uuid-dev");

if (!hasUUIDDev) {
console.error("❌ Development environment not properly configured!");
console.error("πŸ“ Source folder detected but NODE_ENV/NODE_OPTIONS not set for uuid development.");
console.error("πŸ“ Source folder detected but the 'uuid-dev' condition is not set,");
console.error(" so UUID is loading from dist/ instead of src/.");
console.error("");
console.error("πŸ”§ To fix this, run one of these commands:");
console.error("πŸ”§ To load from src/ for development, set the condition:");
console.error(" Windows (cmd):");
console.error(" set NODE_ENV=development");
console.error(" set NODE_OPTIONS=--conditions=uuid-dev");
console.error("");
console.error(" Windows (PowerShell):");
console.error(" $env:NODE_ENV='development'");
console.error(" $env:NODE_OPTIONS='--conditions=uuid-dev'");
console.error("");
console.error(" Unix/Linux/macOS:");
console.error(" export NODE_ENV=development");
console.error(" export NODE_OPTIONS=--conditions=uuid-dev");
console.error("");
console.error("πŸ’‘ This ensures UUID module loads from src/ instead of dist/ for development.");
console.error("πŸ”§ Using 'uuid-dev' prevents conflicts with consumer development settings.");
console.error(" ...or pass it directly: node --conditions=uuid-dev <file>");
console.error("");
console.error("πŸ’‘ 'uuid-dev' is namespaced so it can't conflict with a consumer's own");
console.error(" development conditions.");
console.error("πŸš€ CI environments automatically skip this check.");
process.exit(1);
}
Expand Down
6 changes: 3 additions & 3 deletions index.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /index.cjs
* @Date: 2025-12-15 16:18:10 -08:00 (1765844290)
* @Author: Nate Hyson <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /index.mjs
* @Date: 2025-12-15 16:18:10 -08:00 (1765844290)
* @Author: Nate Hyson <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
"import": "./index.mjs",
"require": "./index.cjs"
},
"./devcheck": {
"types": "./types/devcheck.d.mts",
"import": "./devcheck.mjs"
},
"./main": {
"uuid-dev": {
"import": "./src/uuid.mjs"
Expand Down
6 changes: 3 additions & 3 deletions scripts/debug-timestamp.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /scripts/debug-timestamp.mjs
* @Date: 2025-12-19T20:14:21-08:00 (1766204061)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions scripts/demo-custom-uuids.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /scripts/demo-custom-uuids.mjs
* @Date: 2025-12-19 19:38:49 -08:00 (1766201929)
* @Author: Nate Hyson <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions scripts/demo-default-string.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /scripts/demo-default-string.mjs
* @Date: 2025-12-22T16:59:18-08:00 (1766451558)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions scripts/test-timestamp.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /scripts/test-timestamp.mjs
* @Date: 2025-12-19T20:14:21-08:00 (1766204061)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions scripts/test-version-files.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /scripts/test-version-files.mjs
* @Date: 2025-12-30T17:00:08-08:00 (1767142808)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/bit-utils.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /src/lib/bit-utils.mjs
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/constants.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /src/lib/constants.mjs
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/entropy-sources.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /src/lib/entropy-sources.mjs
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/issuer-registry.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /src/lib/issuer-registry.mjs
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:43 -08:00 (1772687023)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/validators.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @Project: @cldmv/slothlet
* @Project: @cldmv/uuid
* @Filename: /src/lib/validators.mjs
* @Date: 2025-12-15T20:33:49-08:00 (1765859629)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-03-04 21:03:44 -08:00 (1772687024)
* @Last modified by: Shinrai <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-08-08 17:13:20 -07:00 (1786234400)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*/
Expand Down
Loading
Loading