Skip to content

Commit d558052

Browse files
LaunchDarklyReleaseBoteli-darklybwoskow-ldgwhelanLDLaunchDarklyCI
authored
prepare 2.23.0 release (#257)
* add new JS SDK test/demo page * misc doc edits * fixing merge error * fixing merge error * fix broken links on npmjs.com (#193) * update lockfiles for new packages * fix changelog formatting error that messes up the release script * Specify unpkg default target file in package.json for launchdarkly-js-client-sdk and launchdarkly-js-sdk-common. * Correct requestor call to fetch flags on a received ping event. * Implement Hooks API (#196) * Initial commit reusing withLDProvider * Added sitenav. Cleaned up filenames. * Updated readme with hooks api docs. Fixed linting errors. * Fixed linting errors. * Update README.md * bumping our lerna version to resolve transitive dependency vulnerabilities with fstream and tar (#198) * fix goals query logic for Electron, also fix handling of invalid content type * add ability to alter URL in events * Update browserPlatform definition to detect when an EventSource polyfill is available and has published that it supports setting the method used for the stream. When this is the case, the platform publishes that it supports using REPORT with EventSource and will provide the polyfill implementation if the SDK attempts a EventSource connection with the method set to REPORT. * Fix initial linter warnings. * Fix another linter warning. * fix a broken readme link (#202) * removing a stray character in the readme * fix stream reconnect logic and add stream connection logging * linter * assume logger always exists, as we do in other components * fix and simplify how the logger object is passed around * make it so eventUrlTransformer actually does something * linter * copy flags object to prevent subtle update problem in Electron * additional fix + test * make bootstrapped flags available immediately * Refactor some of the EventSource constructor selection logic. * Change browserPlatform.js to check config options when determining EventSource implementation to use. Added tests for EventSource factory in browserPlatform.js * Deal with linter. * change how supported options are detected in EventSource polyfill * fix broken homepage attributes (#209) * improve bad initialization messages (#210) * improve bad initialization messages * remove the spaces * fixing a broken link in a logged message (#212) * add jsdelivr attribute to js packages (#213) * adding an option to disable the camel-casing of flag keys (#214) * adding an option disabling the camel-casing of flag keys * update comment * update comment * fix linter errors * address pr feedback * updated readme * [ch45487] useCamelCaseFlagKeys option (#215) * Initial commit * Update initLDClient.ts * PR fixes. Added prettier. * Update withLDProvider.test.tsx * Fixed lint errors. Added test for useCamelCase false on server changes. * Removed prettier. * Re-added prettier * Update yarn.lock * Update prettier and lock files. * Fixed more linting issues. * fix a typo * use persistent anonymous user logic by default in react sdk (#216) * use persistent anonymous user logic by default in react sdk * added a comment * minor test change * missed a line * remove React package from monorepo * make link text match link * improve log format and add configurable prefix * fix test * linter * deprecate samplingInterval * linter * improve log message for stream connection failures (#221) * improve log message for stream connection failures * update the reconnection warning so that it only displays for the first set of each reconnection attempts * also test that the original put is getting called * updating tests * updating tests * Revert "updating tests" This reverts commit 84163cdf8b5af6a6e969d777b946a8a2973919ed. * better abstraction * minor change * updating the js-common readme to mention client-side node (#222) * remove common package, no more monorepo * add Releaser metadata * npm audit fix * unify Rollup config * migrate new demo code to new package structure * moved example folder * syntax fix in demo * fix directory name * fix linting * use spread operator instead of Object.assign * don't close client on beforeunload, but do flush events * typo * clarify test postconditions * misc test app improvements for testing beforeunload handler * rm unused yarn.lock * rm typedoc dependency, don't commit installation of it during release * fix paths * fix file copying logic * pr template * revert * fix programmatically reported version string * upgrade Typescript to avoid Typedoc incompatibility * Revert "upgrade Typescript to avoid Typedoc incompatibility" This reverts commit 34d9a0f. * update Babel, Jest, Rollup * remove old releaser (#229) * remove unused Rollup plugins, update dependencies * use new config validation mechanism in js-sdk-common 3.x * add image-loading event delivery logic factored out of js-sdk-common * enable diagnostic events in JS SDK * lint * fix tests * use common 3.0.0-beta2 * use 3.1.0-beta3, fix property name * lint * use js-sdk-common 3.1.0 * use js-sdk-common 3.1.1 for event payload ID fix * use js-sdk-common 3.1.2 and loosen our other dependency * fix license * use js-sdk-common 3.2.0-beta1 * SDK name should be js-client-sdk * misc fixes * use js-sdk-common 3.2.0 * use js-sdk-common 3.2.0 * standardize linting * use js-sdk-common 3.2.1 * use js-sdk-common 3.2.2 * update package-lock * update js-sdk-common dependency for initialization error bugfix * update js-sdk-common for content type bugfix; update some dev dependencies * remove unsafe usage of hasOwnProperty * use js-sdk-common 3.2.5 * resolve security vulnerability in acorn dependency (#240) * update js-sdk-common to get console logging IE bugfix * update js-sdk-common for duplicate diagnostic event fix * update js-sdk-common for TS decl fix, improve TS compilation test (#243) * bump to 3.2.9 to get startsWith fix (#244) * add option to disable sync event flush (#245) * update js-sdk-common + some dev dependencies * No longer remove non-section hash in substring and regex matching * linting * the linting target to run in CI is "lint:all", not "lint" * new js-common-sdk version (#249) * resolve node-notifier vulnerability by updating jest dep (#250) * adding contextKind to goal events, bumping js-common to get alias function (#251) * pin typedoc to unblock our releases (#252) * Removed the guides link * add inlineUsersToEvents to TypeScript defs by updating js-sdk-common * Update common JS SDK library to use fixes for debug event generation issues. * Update package lock. * use Releaser v2 config + newer CI image (#256) * Updated readme headers (#258) * don't log a warning about custom goal being unknown * lint + comment * Release js-client-sdk with the header transformation change * Updates docs link * bump js-sdk-common version for better localstorage error handling * Update launchdarkly-js-sdk-common for JSON error handling fix (sc-142333) * update lockfile * add basicLogger export * Update common for application tags support. (#265) * Re-remove package-lock.json and add it to the .gitignore. (#266) * Use a combination of dependencies that is compatible. (#269) (#270) * Update js-sdk-common to 3.7.0 (#271) Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Ben Woskow <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Yusinto Ngadiman <[email protected]> Co-authored-by: Zach Davis <[email protected]> Co-authored-by: Elliot <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Louis Chan <[email protected]> Co-authored-by: Louis Chan <[email protected]> Co-authored-by: Ember Stevens <[email protected]> Co-authored-by: ember-stevens <[email protected]> Co-authored-by: Ryan Lamb <[email protected]>
1 parent 8fc0e31 commit d558052

14 files changed

+65
-72
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: cimg/node:12.22
5+
- image: cimg/node:14.20
66
steps:
77
- checkout
88

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
parser: babel-eslint
2+
parser: "@babel/eslint-parser"
33
root: true
44
extends:
55
- prettier

jest.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ module.exports = {
77
setupFiles: ['jest-localstorage-mock', './jest.setup.js'],
88
testMatch: ['**/__tests__/**/*-test.js'],
99
transform: {
10-
'^.+\\.js$': 'babel-jest',
10+
'^.+\\.js$': ['babel-jest', { rootMode: 'upward' }],
1111
},
1212
globals: {
1313
window: true,
1414
VERSION: version,
1515
},
16-
testURL: 'https://mydomain.com/some/path',
16+
testEnvironmentOptions: {
17+
url: 'https://mydomain.com/some/path',
18+
},
19+
testEnvironment: 'jsdom',
1720
};

package.json

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,43 @@
4141
"prepublishOnly": "npm run build:min"
4242
},
4343
"devDependencies": {
44-
"@babel/cli": "^7.11.6",
45-
"@babel/core": "^7.11.6",
46-
"@babel/plugin-transform-regenerator": "7.10.4",
47-
"@babel/plugin-transform-runtime": "7.11.5",
48-
"@babel/preset-env": "^7.11.5",
49-
"@babel/runtime": "^7.11.2",
50-
"@rollup/plugin-node-resolve": "^6.0.0",
51-
"@rollup/plugin-replace": "^2.2.0",
52-
"babel-eslint": "^10.1.0",
53-
"babel-jest": "^26.3.0",
54-
"chai": "^4.1.2",
55-
"cross-env": "^5.1.4",
56-
"eslint": "^6.8.0",
57-
"eslint-config-prettier": "^2.9.0",
58-
"eslint-config-xo": "^0.20.1",
59-
"eslint-formatter-pretty": "^1.3.0",
60-
"eslint-plugin-babel": "^5.0.0",
61-
"eslint-plugin-prettier": "^2.6.0",
62-
"jest": "^26.6.3",
63-
"jest-junit": "^11.1.0",
64-
"jest-localstorage-mock": "^2.4.3",
65-
"jsdom": "^11.12.0",
66-
"prettier": "1.11.1",
67-
"readline-sync": "1.4.9",
44+
"@babel/cli": "^7.19.3",
45+
"@babel/core": "^7.19.3",
46+
"@babel/eslint-parser": "7.19.1",
47+
"@babel/plugin-transform-regenerator": "7.18.6",
48+
"@babel/plugin-transform-runtime": "7.19.1",
49+
"@babel/preset-env": "^7.19.3",
50+
"@babel/runtime": "^7.19.0",
51+
"@rollup/plugin-node-resolve": "^14.1.0",
52+
"@rollup/plugin-replace": "^4.0.0",
53+
"babel-jest": "^29.1.0",
54+
"cross-env": "^7.0.3",
55+
"eslint": "^8.24.0",
56+
"eslint-config-prettier": "^8.5.0",
57+
"eslint-config-xo": "^0.42.0",
58+
"eslint-formatter-pretty": "^4.1.0",
59+
"eslint-plugin-babel": "^5.3.1",
60+
"eslint-plugin-prettier": "^4.2.1",
61+
"jest": "^29.1.1",
62+
"jest-environment-jsdom": "^29.1.1",
63+
"jest-junit": "^14.0.1",
64+
"jest-localstorage-mock": "^2.4.22",
65+
"jsdom": "^20.0.0",
66+
"prettier": "2.7.1",
6867
"rimraf": "^3.0.2",
69-
"rollup": "^1.26.0",
70-
"rollup-plugin-babel": "^4.3.3",
68+
"rollup": "^2.79.1",
69+
"rollup-plugin-babel": "^4.4.0",
7170
"rollup-plugin-commonjs": "^10.1.0",
72-
"rollup-plugin-filesize": "^6.2.1",
71+
"rollup-plugin-filesize": "^9.1.2",
7372
"rollup-plugin-node-globals": "^1.4.0",
7473
"rollup-plugin-terser": "^7.0.2",
75-
"rollup-plugin-uglify": "^6.0.4",
76-
"semver": "^7.1.3",
77-
"semver-compare": "^1.0.0",
78-
"sinon": "7.2.7",
79-
"typescript": "^3.7.5"
74+
"sinon": "^14.0.0",
75+
"typescript": "^4.8.4",
76+
"@types/estree": "^1.0.0"
8077
},
8178
"dependencies": {
82-
"escape-string-regexp": "^1.0.5",
83-
"launchdarkly-js-sdk-common": "3.6.0"
79+
"escape-string-regexp": "^4.0.0",
80+
"launchdarkly-js-sdk-common": "3.7.0"
8481
},
8582
"repository": {
8683
"type": "git",

rollup.config.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const pkg = require('./package.json');
2-
const resolve = require('@rollup/plugin-node-resolve');
2+
const { nodeResolve } = require('@rollup/plugin-node-resolve');
33
const commonjs = require('rollup-plugin-commonjs');
44
const babel = require('rollup-plugin-babel');
55
const replace = require('@rollup/plugin-replace');
66
const { terser } = require('rollup-plugin-terser');
7-
const { uglify } = require('rollup-plugin-uglify');
87
const filesize = require('rollup-plugin-filesize');
98

109
const env = process.env.NODE_ENV || 'development';
@@ -17,7 +16,7 @@ const basePlugins = [
1716
'process.env.NODE_ENV': JSON.stringify(env),
1817
VERSION: JSON.stringify(version),
1918
}),
20-
resolve({
19+
nodeResolve({
2120
mainFields: ['browser', 'module', 'main'],
2221
preferBuiltins: true,
2322
}),
@@ -29,12 +28,6 @@ const basePlugins = [
2928
];
3029

3130
const plugins = env === 'production' ?
32-
basePlugins.concat(
33-
uglify()
34-
) :
35-
basePlugins;
36-
37-
const esPlugins = env === 'production' ?
3831
basePlugins.concat(
3932
terser()
4033
) : basePlugins;
@@ -66,7 +59,7 @@ const configs = [
6659
format: 'es',
6760
sourcemap: true,
6861
},
69-
plugins: esPlugins,
62+
plugins: plugins,
7063
},
7164
];
7265

src/GoalManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ export default function GoalManager(clientVars, readyCallback) {
7575

7676
clientVars.requestor
7777
.fetchJSON(getGoalsPath())
78-
.then(g => {
78+
.then((g) => {
7979
if (g && g.length > 0) {
8080
goals = g;
8181
goalTracker = GoalTracker(goals, sendGoalEvent);
8282
watchLocation(locationWatcherInterval, refreshGoalTracker);
8383
}
8484
readyCallback();
8585
})
86-
.catch(err => {
86+
.catch((err) => {
8787
clientVars.emitter.maybeReportError(
8888
new common.errors.LDUnexpectedResponseError('Error fetching goals: ' + (err && err.message) ? err.message : err)
8989
);

src/GoalTracker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default function GoalTracker(goals, onEvent) {
7575
}
7676

7777
if (clickGoals.length > 0) {
78-
listenerFn = function(event) {
78+
listenerFn = function (event) {
7979
const goals = findGoalsForClick(event, clickGoals);
8080
for (let i = 0; i < goals.length; i++) {
8181
onEvent('click', goals[i]);
@@ -85,7 +85,7 @@ export default function GoalTracker(goals, onEvent) {
8585
document.addEventListener('click', listenerFn);
8686
}
8787

88-
tracker.dispose = function() {
88+
tracker.dispose = function () {
8989
document.removeEventListener('click', listenerFn);
9090
};
9191

src/__tests__/LDClient-events-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ describe('LDClient', () => {
1717
describe('event generation', () => {
1818
function stubEventProcessor() {
1919
const ep = { events: [] };
20-
ep.start = function() {};
21-
ep.flush = function() {};
22-
ep.stop = function() {};
23-
ep.enqueue = function(e) {
20+
ep.start = function () {};
21+
ep.flush = function () {};
22+
ep.stop = function () {};
23+
ep.enqueue = function (e) {
2424
ep.events.push(e);
2525
};
2626
return ep;
@@ -65,7 +65,7 @@ describe('LDClient', () => {
6565
const client = LDClient.initialize(envName, user, {
6666
eventProcessor: ep,
6767
bootstrap: {},
68-
eventUrlTransformer: url => url + suffix,
68+
eventUrlTransformer: (url) => url + suffix,
6969
});
7070
await client.waitForInitialization();
7171
client.track('eventkey');

src/__tests__/LDClient-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('LDClient', () => {
116116
expect(server.requests[0].url).toMatch(/sdk\/eval/);
117117
});
118118

119-
it('should resolve waitUntilGoalsReady when goals are loaded', done => {
119+
it('should resolve waitUntilGoalsReady when goals are loaded', (done) => {
120120
const handleGoalsReady = jest.fn();
121121
const client = LDClient.initialize(envName, user, { bootstrap: {}, sendEvents: false });
122122

src/__tests__/browserPlatform-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('browserPlatform', () => {
9595
});
9696

9797
it('calls URL transformer if specified', () => {
98-
const p = browserPlatform({ eventUrlTransformer: url => url + '/x' });
98+
const p = browserPlatform({ eventUrlTransformer: (url) => url + '/x' });
9999
expect(p.getCurrentUrl()).toEqual(expectedUrl + '/x');
100100
});
101101
});

src/__tests__/internal-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { doesUrlMatch } from '../GoalTracker';
22

33
describe('url matching', () => {
4-
const getHash = url => {
4+
const getHash = (url) => {
55
const idx = url.indexOf('#');
66
return idx === -1 ? '' : url.substring(idx, url.length);
77
};
88

9-
const getSearch = url => {
9+
const getSearch = (url) => {
1010
const idx = url.indexOf('?');
1111
return idx === -1 ? '' : url.substring(idx, url.length);
1212
};
@@ -208,9 +208,9 @@ describe('url matching', () => {
208208
},
209209
];
210210

211-
tests.forEach(method => {
211+
tests.forEach((method) => {
212212
describe(method.type + ' matching', () => {
213-
method.tests.forEach(each => {
213+
method.tests.forEach((each) => {
214214
it(`expects \`${each.goal}\` to ${each.match ? 'match' : 'not match'} \`${each.path}\``, async () => {
215215
method.matcher(each.path, each.goal).toEqual(each.match);
216216
});

src/browserPlatform.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function makeBrowserPlatform(options) {
2525
};
2626

2727
// Image-based mechanism for sending events if POST isn't available
28-
ret.httpFallbackPing = url => {
28+
ret.httpFallbackPing = (url) => {
2929
const img = new window.Image();
3030
img.src = url;
3131
};
@@ -48,17 +48,17 @@ export default function makeBrowserPlatform(options) {
4848
try {
4949
if (window.localStorage) {
5050
ret.localStorage = {
51-
get: key =>
52-
new Promise(resolve => {
51+
get: (key) =>
52+
new Promise((resolve) => {
5353
resolve(window.localStorage.getItem(key));
5454
}),
5555
set: (key, value) =>
56-
new Promise(resolve => {
56+
new Promise((resolve) => {
5757
window.localStorage.setItem(key, value);
5858
resolve();
5959
}),
60-
clear: key =>
61-
new Promise(resolve => {
60+
clear: (key) =>
61+
new Promise((resolve) => {
6262
window.localStorage.removeItem(key);
6363
resolve();
6464
}),
@@ -116,7 +116,7 @@ export default function makeBrowserPlatform(options) {
116116
return new eventSourceConstructor(url, esOptions);
117117
};
118118

119-
ret.eventSourceIsActive = es =>
119+
ret.eventSourceIsActive = (es) =>
120120
es.readyState === window.EventSource.OPEN || es.readyState === window.EventSource.CONNECTING;
121121
}
122122

src/httpRequest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function newHttpRequest(method, url, headers, body, pageIsClosing
4343
}
4444
resolve({
4545
status: xhr.status,
46-
header: key => xhr.getResponseHeader(key),
46+
header: (key) => xhr.getResponseHeader(key),
4747
body: xhr.responseText,
4848
});
4949
});

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function initialize(env, user, options = {}) {
2121
const validatedOptions = clientVars.options;
2222
const emitter = clientVars.emitter;
2323

24-
const goalsPromise = new Promise(resolve => {
24+
const goalsPromise = new Promise((resolve) => {
2525
const onGoals = emitter.on(goalsEvent, () => {
2626
emitter.off(goalsEvent, onGoals);
2727
resolve();

0 commit comments

Comments
 (0)