Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package-lock.json
spackage-lock.json
yarn.lock
dist/
node_modules/
Expand All @@ -21,3 +21,4 @@ yarn-error.log
.vscode
dump.rdb
.wrangler
stats.html
3 changes: 0 additions & 3 deletions packages/sdk/browser/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ export default {
verbose: true,
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'jest-environment-jsdom',
transform: {
'^.+\\.tsx?$': ['ts-jest', { useESM: true, tsconfig: 'tsconfig.json' }],
},
testPathIgnorePatterns: ['./dist', './src'],
testMatch: ['**.test.ts'],
};
3 changes: 2 additions & 1 deletion packages/sdk/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
},
"dependencies": {
"@launchdarkly/js-client-sdk-common": "1.8.0",
"escape-string-regexp": "^5.0.0"
"escape-string-regexp": "^5.0.0",
"rollup-plugin-visualizer": "^5.12.0"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk/browser/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { visualizer } from "rollup-plugin-visualizer";

const getSharedConfig = (format, file) => ({
input: 'src/index.ts',
Expand Down Expand Up @@ -34,6 +35,8 @@ export default [
resolve(),
terser(),
json(),
// The 'sourcemap' option allows using the minified size, not the size before minification.
visualizer({sourcemap: true}),
],
},
{
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationMap": true,
"jsx": "react-jsx",
"lib": ["ES2017", "dom"],
"module": "ES6",
"module": "ESNext",
"moduleResolution": "node",
"noImplicitOverride": true,
"resolveJsonModule": true,
Expand Down
23 changes: 18 additions & 5 deletions packages/shared/common/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@launchdarkly/js-sdk-common",
"version": "2.9.0",
"type": "commonjs",
"main": "./dist/index.js",
"type": "module",
"main": "./dist/index.es.js",
"types": "./dist/index.d.ts",
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/common",
"repository": {
Expand All @@ -18,18 +18,27 @@
"analytics",
"client"
],
"exports": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs.js",
"import": "./dist/index.es.js"
},
"scripts": {
"test": "npx jest --ci",
"build-types": "npx tsc --declaration true --emitDeclarationOnly true --declarationDir dist",
"build": "npx tsc",
"clean": "npx tsc --build --clean",
"build": "npx tsc --noEmit && rollup -c rollup.config.js",
"clean": "rimraf dist",
"lint": "npx eslint . --ext .ts",
"lint:fix": "yarn run lint --fix",
"prettier": "prettier --write 'src/*.@(js|ts|tsx|json)'",
"check": "yarn && yarn prettier && yarn lint && tsc && yarn test"
},
"license": "Apache-2.0",
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/jest": "^29.4.0",
"@typescript-eslint/eslint-plugin": "^6.20.0",
Expand All @@ -44,7 +53,11 @@
"jest": "^29.5.0",
"launchdarkly-js-test-helpers": "^2.2.0",
"prettier": "^3.0.0",
"rimraf": "6.0.1",
"rollup": "^3.23.0",
"rollup-plugin-visualizer": "^5.12.0",
"ts-jest": "^29.0.5",
"tslib": "^2.7.0",
"typedoc": "0.25.0",
"typescript": "5.1.6"
}
Expand Down
20 changes: 15 additions & 5 deletions packages/shared/common/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import common from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { visualizer } from "rollup-plugin-visualizer";


// The common library does not have a dependency resolution plugin as it should not have any
// dependencies.

// This library is not minified as the final SDK package is responsible for minification.

const getSharedConfig = (format, file) => ({
input: 'src/index.ts',
// Intermediate modules don't bundle all dependencies. We leave that to leaf-node
// SDK implementations.
external: [/node_modules/],
output: [
{
format: format,
Expand All @@ -26,18 +34,20 @@ export default [
plugins: [
typescript({
module: 'esnext',
tsconfig: './tsconfig.json',
outputToFilesystem: true,
}),
common({
transformMixedEsModules: true,
esmExternals: true,
}),
resolve(),
terser(),
json(),
// The 'sourcemap' option allows using the minified size, not the size before minification.
visualizer({ sourcemap: true }),
],
},
{
...getSharedConfig('cjs', 'dist/index.cjs.js'),
plugins: [typescript(), common(), resolve(), terser(), json()],
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), json()],
},
];
4 changes: 3 additions & 1 deletion packages/shared/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"outDir": "dist",
"target": "ES2017",
"lib": ["es6"],
"module": "commonjs",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
"noImplicitOverride": true,
// Needed for CommonJS modules: markdown-it, fs-extra
Expand All @@ -15,5 +16,6 @@
"stripInternal": true,
"composite": true
},
"include": ["src"],
"exclude": ["**/*.test.ts", "dist", "node_modules", "__tests__"]
}
21 changes: 17 additions & 4 deletions packages/shared/sdk-client/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@launchdarkly/js-client-sdk-common",
"version": "1.8.0",
"type": "commonjs",
"main": "./dist/index.js",
"type": "module",
"main": "./dist/index.es.js",
"types": "./dist/index.d.ts",
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/shared/sdk-client",
"repository": {
Expand All @@ -18,11 +18,16 @@
"analytics",
"client"
],
"exports": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs.js",
"import": "./dist/index.es.js"
},
"scripts": {
"doc": "../../../scripts/build-doc.sh .",
"test": "npx jest --ci",
"build": "npx tsc",
"clean": "npx tsc --build --clean",
"build": "tsc --noEmit && rollup -c rollup.config.js",
"clean": "rimraf dist",
"lint": "npx eslint . --ext .ts",
"lint:fix": "yarn run lint -- --fix",
"prettier": "prettier --write 'src/*.@(js|ts|tsx|json)'",
Expand All @@ -33,6 +38,11 @@
"@launchdarkly/js-sdk-common": "2.9.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.16.5",
"@types/jest": "^29.5.3",
Expand All @@ -51,6 +61,9 @@
"jest-environment-jsdom": "^29.6.1",
"launchdarkly-js-test-helpers": "^2.2.0",
"prettier": "^3.0.0",
"rimraf": "6.0.1",
"rollup": "^3.23.0",
"rollup-plugin-visualizer": "^5.12.0",
"ts-jest": "^29.1.1",
"typedoc": "0.25.0",
"typescript": "5.1.6"
Expand Down
14 changes: 11 additions & 3 deletions packages/shared/sdk-client/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import common from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { visualizer } from "rollup-plugin-visualizer";

// This library is not minified as the final SDK package is responsible for minification.

const getSharedConfig = (format, file) => ({
input: 'src/index.ts',
// Intermediate modules don't bundle all dependencies. We leave that to leaf-node
// SDK implementations.
external: ['@launchdarkly/js-sdk-common'],
output: [
{
format: format,
Expand All @@ -26,18 +31,21 @@ export default [
plugins: [
typescript({
module: 'esnext',
tsconfig: './tsconfig.json',
outputToFilesystem: true,
}),
common({
transformMixedEsModules: true,
esmExternals: true,
}),
resolve(),
terser(),
json(),
// The 'sourcemap' option allows using the minified size, not the size before minification.
visualizer({ sourcemap: true }),
],
},
{
...getSharedConfig('cjs', 'dist/index.cjs.js'),
plugins: [typescript(), common(), resolve(), terser(), json()],
plugins: [typescript({ tsconfig: './tsconfig.json' }), common(), resolve(), json()],
},
];
3 changes: 2 additions & 1 deletion packages/shared/sdk-client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"outDir": "dist",
"target": "ES2017",
"lib": ["es6", "DOM"],
"module": "commonjs",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
"noImplicitOverride": true,
// Needed for CommonJS modules: markdown-it, fs-extra
Expand Down
Loading