Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Port to TypeScript, closes #762 #763

Merged
merged 34 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3d7bca6
chore: rename *.js -> *.ts
broofa Jun 10, 2024
1b933c9
chore: add tsconfig file
broofa Jun 10, 2024
694cd50
chore: port parse, stringify, v1 to TS
broofa Jun 10, 2024
a69cbd1
chore: port v1ToV6, v6ToV1 to TS
broofa Jun 10, 2024
c6d8008
chore: port v4, v6ToV1 to TS
broofa Jun 10, 2024
d910db9
chore: more TS porting
broofa Jun 10, 2024
3e3abe9
chore: more TS porting
broofa Jun 10, 2024
c248e47
chore: more TS porting
broofa Jun 11, 2024
17675e8
chore: more TS porting
broofa Jun 11, 2024
95f9d5e
chore: add tsconfig and update build script
broofa Jun 11, 2024
651a959
fix: crypto imports
broofa Jun 12, 2024
fcf627d
chore: restore browser builds
broofa Jun 12, 2024
323f598
chore: move tests to src dir
broofa Jun 14, 2024
629b3df
chore: switch to node test runner
broofa Jun 17, 2024
c2da22f
chore: update test names
broofa Jun 17, 2024
1ff5491
chore: unit tests pass, switch to node test runner
broofa Jun 17, 2024
9c1f639
chore: eslint for typescript
broofa Jun 17, 2024
4d2ffa8
chore: inline source maps
broofa Jun 18, 2024
5ea99d6
chore: update imports
broofa Jun 18, 2024
20b0864
Merge branch 'main' into ts_port
broofa Jun 18, 2024
27c15df
Merge branch 'main' into ts_port
broofa Jun 18, 2024
4b7f9e1
Merge branch 'main' into ts_port
broofa Jun 18, 2024
0b4bb1a
chore: update optionalDevDependencies
broofa Jun 19, 2024
8e287d5
chore: node:crypto -> crypto
broofa Jun 19, 2024
e5a95ef
chore: update esm-browser example
broofa Jun 19, 2024
45e0d06
chore: rm unused eslint directive
broofa Jun 28, 2024
4b2af31
chore: fix browser tests
broofa Jun 28, 2024
d659b0a
chore: rm .vscode
broofa Jun 30, 2024
1d5f7c1
chore: switch eslint config to ESM
broofa Jun 30, 2024
6c0af42
chore: add vscode configuration
broofa Jun 30, 2024
8ba0686
chore: update build comment
broofa Jun 30, 2024
9be7e05
chore: rm comment from types
broofa Jun 30, 2024
574a6be
chore: update package-lock
broofa Jun 30, 2024
f8b253a
Merge branch 'main' into ts_port
broofa Jul 15, 2024
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
browserstack.err
dist/
local.log
logs/
node_modules/
vscode/
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode",
"stkb.rewrap"
]
}
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build watcher",
"group": "build",
"type": "shell",
"command": "npm run build:watch",
"runOptions": {
"runOn": "folderOpen"
}
},
{
"label": "Test watcher",
"group": "build",
"type": "shell",
"command": "npm run test:watch",
"windows": {
"command": "npm run test:watch"
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
22 changes: 14 additions & 8 deletions eslint.config.cjs → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
const babelParser = require('@babel/eslint-parser');
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
const globals = require('globals');
const js = require('@eslint/js');
const neostandard = require('neostandard')({ semi: true, noStyle: true });
import js from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import neostandard from 'neostandard';
import tseslint from 'typescript-eslint';

module.exports = [
const neostandardConfig = neostandard({ semi: true, noStyle: true });

export default [
js.configs.recommended,
...neostandard,
...tseslint.configs.recommended,
...neostandardConfig,
eslintPluginPrettierRecommended,
{
languageOptions: {
Expand All @@ -19,17 +22,20 @@ module.exports = [
...globals.node,
msCrypto: true,
},
parser: babelParser,
},
},
{
rules: {
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/no-require-imports': 'off',
'no-redeclare': 'off',
'no-var': ['error'],
curly: ['error', 'all'],
},
},
{
ignores: [
'eslint.config.cjs',
'!.babelrc.js',
'.local/',
'**/dist/',
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function benchmark(uuid, Benchmark) {
.add('uuid.v1() fill existing array', function () {
try {
uuid.v1(null, array, 0);
} catch (err) {
} catch {
// The spec (https://datatracker.ietf.org/doc/html/rfc9562#name-timestamp-considerations) defines that only 10M/s v1
// UUIDs can be generated on a single node. This library throws an error if we hit that limit
// (which can happen on modern hardware and modern Node.js versions).
Expand Down
92 changes: 48 additions & 44 deletions examples/benchmark/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion examples/browser-esmodules/example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pkg from 'uuid/package.json';
import * as uuid from './node_modules/uuid/dist/esm-browser/index.js';
import {
MAX as MAX_UUID,
Expand All @@ -16,6 +15,9 @@ import {
v6ToV1 as uuidv6ToV1,
v7 as uuidv7,
} from './node_modules/uuid/dist/esm-browser/index.js';
import pkg from './node_modules/uuid/package.json' with { type: 'json' };

console.log('pkg', pkg);

console.log('uuidv1()', uuidv1());

Expand Down
102 changes: 54 additions & 48 deletions examples/browser-esmodules/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading