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
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "3e11b6f", "specHash": "ad08e8c", "version": "10.3.0" }
{ "engineHash": "697b72d", "specHash": "ad08e8c", "version": "10.3.0" }
230 changes: 115 additions & 115 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"types": "./lib/index.d.ts",
"browser": {
"./src/internal/utilsNode.ts": "./src/internal/utilsBrowser.ts",
"./lib/internal/utilsNode.js": "./lib/internal/utilsBrowser.js",
"./src/box/eventStream.ts": "./src/box/eventStreamBrowser.ts",
"./lib/internal/utilsNode.js": "./lib/internal/utilsBrowser.js",
"./lib/box/eventStream.js": "./lib/box/eventStreamBrowser.js",
"./lib-esm/box/eventStream.js": "./lib-esm/box/eventStreamBrowser.js",
"./lib-esm/internal/utilsNode.js": "./lib-esm/internal/utilsBrowser.js"
},
Expand Down Expand Up @@ -126,6 +127,7 @@
"build:cjs": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
"build:esm": "tsc --project tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
"postbuild": "rollup -c",
"postbuild:esm": "node ./scripts/update-esm.mjs",
"start": "echo \"Error: no start specified\" && exit 1",
"test": "jest"
},
Expand Down
20 changes: 20 additions & 0 deletions scripts/update-esm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This scripts will create a package.json for the ESM build in lib-esm directory
// to patch following properties:
// - type: 'module'
// - browser:
// "./box/eventStream.js": "./box/eventStreamBrowser.js",
// "./internal/utilsNode.js": "./internal/utilsBrowser.js"

import fs from 'fs';
import path from 'path';

const packageJsonPath = path.join(process.cwd(), 'lib-esm', 'package.json');
const packageJson = {
type: 'module',
browser: {
'./box/eventStream.js': './box/eventStreamBrowser.js',
'./internal/utilsNode.js': './internal/utilsBrowser.js',
},
};

fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
2 changes: 1 addition & 1 deletion test-node/test-esm-1/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BoxSDK from 'sdk';
import * as BoxSDK from 'sdk';
import { BoxClient, BoxDeveloperTokenAuth } from 'sdk';
import { FileFull } from 'sdk/schemas';
import { File } from 'sdk/schemas/file';
Expand Down
2 changes: 1 addition & 1 deletion test-node/test-esm-2/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BoxSDK from 'sdk';
import * as BoxSDK from 'sdk';
import { BoxClient, BoxDeveloperTokenAuth } from 'sdk';
import { FileFull } from 'sdk/lib/schemas/index';
import { File } from 'sdk/lib/schemas/file';
Expand Down
2 changes: 1 addition & 1 deletion test-node/test-esm-3/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BoxSDK from 'sdk';
import * as BoxSDK from 'sdk';
import { BoxClient, BoxDeveloperTokenAuth } from 'sdk';
import { FileFull } from 'sdk/lib/schemas/index';
import { File } from 'sdk/lib/schemas/file';
Expand Down
2 changes: 1 addition & 1 deletion test-node/test-esm-4/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BoxSDK from 'sdk';
import * as BoxSDK from 'sdk';
import { BoxClient, BoxDeveloperTokenAuth } from 'sdk';
import { FileFull } from 'sdk/lib/schemas/index';
import { File } from 'sdk/lib/schemas/file';
Expand Down
2 changes: 1 addition & 1 deletion test-node/test-esm-5/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BoxSDK from 'sdk';
import * as BoxSDK from 'sdk';
import { BoxClient, BoxDeveloperTokenAuth } from 'sdk';
import { FileFull } from 'sdk/lib/schemas/index';
import { File } from 'sdk/lib/schemas/file';
Expand Down
7 changes: 5 additions & 2 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"module": "ES2022",
"moduleResolution": "Bundler",
"declaration": true,
"sourceMap": true,
"outDir": "lib-esm",
Expand All @@ -15,6 +15,9 @@
"@/*": ["./src/*"]
}
},
"tsc-alias": {
"resolveFullPaths": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "src/__tests__"]
}
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"@/*": ["./src/*"]
}
},
"tsc-alias": {
"resolveFullPaths": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "src/__tests__"]
}
Loading