Skip to content

Commit 7a5a60d

Browse files
authored
Output ESM for all packages (#736)
1 parent 0f063d9 commit 7a5a60d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+188
-377
lines changed

.changeset/tricky-paws-hear.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@tus/azure-store": major
3+
"@tus/file-store": major
4+
"@tus/gcs-store": major
5+
"@tus/s3-store": major
6+
"@tus/server": major
7+
"@tus/utils": minor
8+
---
9+
10+
Make this package ESM-only instead of CommonJS. Since Node.js >= 20.19.0 you can `require(esm)` so you can consume this package even if you don't ESM yourself yet.

biome.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
33
"organizeImports": {
44
"enabled": true
55
},

package-lock.json

+3-156
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
33
"private": true,
4-
"workspaces": ["packages/*", "test"],
4+
"workspaces": [
5+
"packages/*",
6+
"test"
7+
],
58
"scripts": {
69
"build": "tsc --build",
710
"lint": "biome lint --write .",

packages/azure-store/package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@
33
"name": "@tus/azure-store",
44
"version": "1.0.0",
55
"description": "Azure blob storage for @tus/server",
6-
"main": "dist/index.js",
6+
"main": "./dist/index.js",
7+
"exports": "./dist/index.js",
8+
"type": "module",
79
"homepage": "https://github.com/tus/tus-node-server#readme",
810
"bugs": "https://github.com/tus/tus-node-server/issues",
911
"repository": "tus/tus-node-server",
1012
"files": [
11-
"README.md",
12-
"LICENSE",
1313
"dist",
14-
"src"
14+
"src",
15+
"!test*"
1516
],
1617
"license": "MIT",
1718
"scripts": {
1819
"build": "tsc --build",
19-
"test": "mocha --exit --extension ts --require ts-node/register"
20+
"pretest": "tsc --build",
21+
"test": "mocha './dist/test/*.js' --exit"
2022
},
2123
"dependencies": {
2224
"@tus/utils": "^0.5.0",

packages/azure-store/test/index.ts packages/azure-store/src/test/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'should'
22
import path from 'node:path'
3-
import {AzureStore} from '../src'
4-
import * as shared from 'test/stores.test'
3+
import {AzureStore} from '@tus/azure-store'
4+
import * as shared from '../../../utils/dist/test/stores.js'
55

66
const fixturesPath = path.resolve('../', '../', 'test', 'fixtures')
77
const storePath = path.resolve('../', '../', 'test', 'output', 'azure-store')

packages/azure-store/tsconfig.build.json

-10
This file was deleted.

packages/azure-store/tsconfig.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{
22
"$schema": "https://json.schemastore.org/tsconfig.json",
3-
"references": [
4-
{ "path": "./tsconfig.build.json" },
5-
{ "path": "../../test/tsconfig.json" }
6-
],
73
"extends": "../../tsconfig.base.json",
8-
"exclude": ["src"],
4+
"references": [{ "path": "../utils/tsconfig.json" }],
5+
"include": ["src"],
96
"compilerOptions": {
10-
"noEmit": true
7+
"rootDir": "src",
8+
"outDir": "dist",
119
}
1210
}

packages/file-store/package.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@
33
"name": "@tus/file-store",
44
"version": "1.5.1",
55
"description": "Local file storage for @tus/server",
6-
"main": "dist/index.js",
6+
"main": "./dist/index.js",
7+
"exports": "./dist/index.js",
8+
"type": "module",
79
"homepage": "https://github.com/tus/tus-node-server#readme",
810
"bugs": "https://github.com/tus/tus-node-server/issues",
911
"repository": "tus/tus-node-server",
10-
"files": ["README.md", "LICENSE", "dist", "src"],
12+
"files": [
13+
"dist",
14+
"src",
15+
"!test*"
16+
],
1117
"license": "MIT",
1218
"scripts": {
1319
"build": "tsc --build",
14-
"test": "mocha --exit --extension ts --require ts-node/register"
20+
"pretest": "tsc --build",
21+
"test": "mocha './dist/test/*.js' --exit"
1522
},
1623
"dependencies": {
1724
"@tus/utils": "^0.5.0",

packages/file-store/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import type http from 'node:http'
77

88
import debug from 'debug'
99

10-
import {type Configstore, FileConfigstore} from './configstores'
10+
import {type Configstore, FileConfigstore} from './configstores/index.js'
1111
import {DataStore, Upload, ERRORS} from '@tus/utils'
1212

13-
export * from './configstores'
13+
export * from './configstores/index.js'
1414

1515
type Options = {
1616
directory: string

packages/file-store/test/index.ts packages/file-store/src/test/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import path from 'node:path'
77

88
import sinon from 'sinon'
99

10-
import {FileStore, FileConfigstore} from '../src'
10+
import {FileStore, FileConfigstore} from '@tus/file-store'
1111
import {Upload} from '@tus/utils'
1212

13-
import * as shared from 'test/stores.test'
13+
import * as shared from '../../../utils/dist/test/stores.js'
1414

1515
const fixturesPath = path.resolve('../', '../', 'test', 'fixtures')
1616
const storePath = path.resolve('../', '../', 'test', 'output', 'file-store')

0 commit comments

Comments
 (0)