New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rnx-kit/config

Package Overview
Dependencies
Maintainers
7
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rnx-kit/config - npm Package Compare versions

Comparing version 0.4.23 to 0.4.24

6

CHANGELOG.md
# Change Log - @rnx-kit/config
## 0.4.24
### Patch Changes
- e352f4c: Transition tree shaking from experimental to production. Deprecate experimental config/cmdline props, while still supporting them for this major version. They will be removed on the next major version bump. Update documentation and tests.
## 0.4.23

@@ -4,0 +10,0 @@

2

coverage/coverage-final.json

@@ -1,2 +0,2 @@

{"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getBundleDefinition.ts": {"path":"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getBundleDefinition.ts","statementMap":{"0":{"start":{"line":26,"column":54},"end":{"line":35,"column":3}},"1":{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},"2":{"start":{"line":37,"column":4},"end":{"line":37,"column":29}},"3":{"start":{"line":40,"column":18},"end":{"line":40,"column":35}},"4":{"start":{"line":41,"column":2},"end":{"line":44,"column":3}},"5":{"start":{"line":42,"column":19},"end":{"line":42,"column":57}},"6":{"start":{"line":42,"column":39},"end":{"line":42,"column":50}},"7":{"start":{"line":43,"column":4},"end":{"line":43,"column":47}},"8":{"start":{"line":46,"column":2},"end":{"line":46,"column":49}},"9":{"start":{"line":60,"column":25},"end":{"line":60,"column":71}},"10":{"start":{"line":61,"column":2},"end":{"line":61,"column":68}}},"fnMap":{"0":{"name":"getBundleDefinition","decl":{"start":{"line":22,"column":16},"end":{"line":22,"column":35}},"loc":{"start":{"line":25,"column":42},"end":{"line":47,"column":1}},"line":25},"1":{"name":"(anonymous_1)","decl":{"start":{"line":42,"column":32},"end":{"line":42,"column":33}},"loc":{"start":{"line":42,"column":39},"end":{"line":42,"column":50}},"line":42},"2":{"name":"getBundlePlatformDefinition","decl":{"start":{"line":56,"column":16},"end":{"line":56,"column":43}},"loc":{"start":{"line":59,"column":42},"end":{"line":62,"column":1}},"line":59}},"branchMap":{"0":{"loc":{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},"type":"if","locations":[{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},{"start":{},"end":{}}],"line":36},"1":{"loc":{"start":{"line":41,"column":2},"end":{"line":44,"column":3}},"type":"if","locations":[{"start":{"line":41,"column":2},"end":{"line":44,"column":3}},{"start":{},"end":{}}],"line":41},"2":{"loc":{"start":{"line":42,"column":19},"end":{"line":42,"column":57}},"type":"binary-expr","locations":[{"start":{"line":42,"column":19},"end":{"line":42,"column":51}},{"start":{"line":42,"column":55},"end":{"line":42,"column":57}}],"line":42},"3":{"loc":{"start":{"line":60,"column":25},"end":{"line":60,"column":71}},"type":"binary-expr","locations":[{"start":{"line":60,"column":25},"end":{"line":60,"column":41}},{"start":{"line":60,"column":45},"end":{"line":60,"column":71}}],"line":60},"4":{"loc":{"start":{"line":61,"column":9},"end":{"line":61,"column":67}},"type":"cond-expr","locations":[{"start":{"line":61,"column":26},"end":{"line":61,"column":58}},{"start":{"line":61,"column":61},"end":{"line":61,"column":67}}],"line":61}},"s":{"0":4,"1":4,"2":1,"3":3,"4":3,"5":2,"6":4,"7":2,"8":1,"9":3,"10":3},"f":{"0":4,"1":4,"2":3},"b":{"0":[1,3],"1":[2,1],"2":[2,1],"3":[3,2],"4":[1,2]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"30d07eb3e1724ebcdf1a09547ba2744203fd87e6"}
{"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getBundleDefinition.ts": {"path":"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getBundleDefinition.ts","statementMap":{"0":{"start":{"line":16,"column":4},"end":{"line":16,"column":10}},"1":{"start":{"line":17,"column":2},"end":{"line":27,"column":3}},"2":{"start":{"line":18,"column":4},"end":{"line":20,"column":6}},"3":{"start":{"line":21,"column":17},"end":{"line":21,"column":35}},"4":{"start":{"line":22,"column":4},"end":{"line":24,"column":5}},"5":{"start":{"line":23,"column":6},"end":{"line":23,"column":51}},"6":{"start":{"line":25,"column":4},"end":{"line":25,"column":39}},"7":{"start":{"line":26,"column":4},"end":{"line":26,"column":16}},"8":{"start":{"line":28,"column":2},"end":{"line":28,"column":16}},"9":{"start":{"line":45,"column":54},"end":{"line":54,"column":3}},"10":{"start":{"line":55,"column":2},"end":{"line":57,"column":3}},"11":{"start":{"line":56,"column":4},"end":{"line":56,"column":29}},"12":{"start":{"line":59,"column":18},"end":{"line":59,"column":35}},"13":{"start":{"line":60,"column":2},"end":{"line":66,"column":3}},"14":{"start":{"line":61,"column":19},"end":{"line":61,"column":57}},"15":{"start":{"line":61,"column":39},"end":{"line":61,"column":50}},"16":{"start":{"line":62,"column":4},"end":{"line":65,"column":6}},"17":{"start":{"line":68,"column":2},"end":{"line":71,"column":4}},"18":{"start":{"line":85,"column":25},"end":{"line":85,"column":71}},"19":{"start":{"line":86,"column":2},"end":{"line":86,"column":68}}},"fnMap":{"0":{"name":"collapseDeprecatedExperimentalTreeShake","decl":{"start":{"line":12,"column":9},"end":{"line":12,"column":48}},"loc":{"start":{"line":14,"column":20},"end":{"line":29,"column":1}},"line":14},"1":{"name":"getBundleDefinition","decl":{"start":{"line":41,"column":16},"end":{"line":41,"column":35}},"loc":{"start":{"line":44,"column":42},"end":{"line":72,"column":1}},"line":44},"2":{"name":"(anonymous_2)","decl":{"start":{"line":61,"column":32},"end":{"line":61,"column":33}},"loc":{"start":{"line":61,"column":39},"end":{"line":61,"column":50}},"line":61},"3":{"name":"getBundlePlatformDefinition","decl":{"start":{"line":81,"column":16},"end":{"line":81,"column":43}},"loc":{"start":{"line":84,"column":42},"end":{"line":87,"column":1}},"line":84}},"branchMap":{"0":{"loc":{"start":{"line":17,"column":2},"end":{"line":27,"column":3}},"type":"if","locations":[{"start":{"line":17,"column":2},"end":{"line":27,"column":3}},{"start":{},"end":{}}],"line":17},"1":{"loc":{"start":{"line":22,"column":4},"end":{"line":24,"column":5}},"type":"if","locations":[{"start":{"line":22,"column":4},"end":{"line":24,"column":5}},{"start":{},"end":{}}],"line":22},"2":{"loc":{"start":{"line":55,"column":2},"end":{"line":57,"column":3}},"type":"if","locations":[{"start":{"line":55,"column":2},"end":{"line":57,"column":3}},{"start":{},"end":{}}],"line":55},"3":{"loc":{"start":{"line":60,"column":2},"end":{"line":66,"column":3}},"type":"if","locations":[{"start":{"line":60,"column":2},"end":{"line":66,"column":3}},{"start":{},"end":{}}],"line":60},"4":{"loc":{"start":{"line":61,"column":19},"end":{"line":61,"column":57}},"type":"binary-expr","locations":[{"start":{"line":61,"column":19},"end":{"line":61,"column":51}},{"start":{"line":61,"column":55},"end":{"line":61,"column":57}}],"line":61},"5":{"loc":{"start":{"line":85,"column":25},"end":{"line":85,"column":71}},"type":"binary-expr","locations":[{"start":{"line":85,"column":25},"end":{"line":85,"column":41}},{"start":{"line":85,"column":45},"end":{"line":85,"column":71}}],"line":85},"6":{"loc":{"start":{"line":86,"column":9},"end":{"line":86,"column":67}},"type":"cond-expr","locations":[{"start":{"line":86,"column":26},"end":{"line":86,"column":58}},{"start":{"line":86,"column":61},"end":{"line":86,"column":67}}],"line":86}},"s":{"0":4,"1":4,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":3,"9":5,"10":5,"11":1,"12":4,"13":4,"14":2,"15":4,"16":2,"17":2,"18":3,"19":3},"f":{"0":4,"1":5,"2":4,"3":3},"b":{"0":[1,3],"1":[1,0],"2":[1,4],"3":[2,2],"4":[2,1],"5":[3,2],"6":[1,2]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"eb03dfefc5718a34e99415fd1c46ed2836e2cb21"}
,"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getKitCapabilities.ts": {"path":"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getKitCapabilities.ts","statementMap":{"0":{"start":{"line":23,"column":2},"end":{"line":29,"column":3}},"1":{"start":{"line":28,"column":4},"end":{"line":28,"column":76}},"2":{"start":{"line":31,"column":2},"end":{"line":33,"column":3}},"3":{"start":{"line":32,"column":4},"end":{"line":32,"column":72}},"4":{"start":{"line":36,"column":4},"end":{"line":36,"column":67}},"5":{"start":{"line":38,"column":2},"end":{"line":45,"column":3}},"6":{"start":{"line":42,"column":4},"end":{"line":44,"column":6}},"7":{"start":{"line":47,"column":2},"end":{"line":53,"column":4}}},"fnMap":{"0":{"name":"getKitCapabilities","decl":{"start":{"line":16,"column":16},"end":{"line":16,"column":34}},"loc":{"start":{"line":22,"column":31},"end":{"line":54,"column":1}},"line":22}},"branchMap":{"0":{"loc":{"start":{"line":17,"column":2},"end":{"line":17,"column":19}},"type":"default-arg","locations":[{"start":{"line":17,"column":17},"end":{"line":17,"column":19}}],"line":17},"1":{"loc":{"start":{"line":18,"column":2},"end":{"line":18,"column":21}},"type":"default-arg","locations":[{"start":{"line":18,"column":12},"end":{"line":18,"column":21}}],"line":18},"2":{"loc":{"start":{"line":23,"column":2},"end":{"line":29,"column":3}},"type":"if","locations":[{"start":{"line":23,"column":2},"end":{"line":29,"column":3}},{"start":{},"end":{}}],"line":23},"3":{"loc":{"start":{"line":24,"column":4},"end":{"line":26,"column":45}},"type":"binary-expr","locations":[{"start":{"line":24,"column":4},"end":{"line":24,"column":23}},{"start":{"line":25,"column":5},"end":{"line":25,"column":38}},{"start":{"line":26,"column":6},"end":{"line":26,"column":44}}],"line":24},"4":{"loc":{"start":{"line":31,"column":2},"end":{"line":33,"column":3}},"type":"if","locations":[{"start":{"line":31,"column":2},"end":{"line":33,"column":3}},{"start":{},"end":{}}],"line":31},"5":{"loc":{"start":{"line":31,"column":6},"end":{"line":31,"column":40}},"type":"binary-expr","locations":[{"start":{"line":31,"column":6},"end":{"line":31,"column":23}},{"start":{"line":31,"column":27},"end":{"line":31,"column":40}}],"line":31},"6":{"loc":{"start":{"line":36,"column":4},"end":{"line":36,"column":67}},"type":"binary-expr","locations":[{"start":{"line":36,"column":4},"end":{"line":36,"column":17}},{"start":{"line":36,"column":21},"end":{"line":36,"column":67}}],"line":36},"7":{"loc":{"start":{"line":38,"column":2},"end":{"line":45,"column":3}},"type":"if","locations":[{"start":{"line":38,"column":2},"end":{"line":45,"column":3}},{"start":{},"end":{}}],"line":38},"8":{"loc":{"start":{"line":39,"column":4},"end":{"line":40,"column":61}},"type":"binary-expr","locations":[{"start":{"line":39,"column":4},"end":{"line":39,"column":26}},{"start":{"line":40,"column":4},"end":{"line":40,"column":61}}],"line":39}},"s":{"0":21,"1":2,"2":19,"3":1,"4":19,"5":19,"6":3,"7":16},"f":{"0":21},"b":{"0":[19],"1":[18],"2":[2,19],"3":[21,19,9],"4":[1,18],"5":[19,2],"6":[19,11],"7":[3,16],"8":[19,19]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"1e94e0a47bdefec5b9484694472c3272d678f0cb"}

@@ -3,0 +3,0 @@ ,"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getKitConfig.ts": {"path":"/home/runner/work/rnx-kit/rnx-kit/packages/config/src/getKitConfig.ts","statementMap":{"0":{"start":{"line":24,"column":14},"end":{"line":26,"column":34}},"1":{"start":{"line":29,"column":23},"end":{"line":29,"column":67}},"2":{"start":{"line":30,"column":17},"end":{"line":30,"column":41}},"3":{"start":{"line":31,"column":2},"end":{"line":31,"column":32}}},"fnMap":{"0":{"name":"getKitConfig","decl":{"start":{"line":20,"column":16},"end":{"line":20,"column":28}},"loc":{"start":{"line":22,"column":20},"end":{"line":32,"column":1}},"line":22}},"branchMap":{"0":{"loc":{"start":{"line":21,"column":2},"end":{"line":21,"column":35}},"type":"default-arg","locations":[{"start":{"line":21,"column":33},"end":{"line":21,"column":35}}],"line":21},"1":{"loc":{"start":{"line":24,"column":14},"end":{"line":26,"column":34}},"type":"cond-expr","locations":[{"start":{"line":25,"column":6},"end":{"line":25,"column":69}},{"start":{"line":26,"column":6},"end":{"line":26,"column":34}}],"line":24},"2":{"loc":{"start":{"line":26,"column":6},"end":{"line":26,"column":34}},"type":"binary-expr","locations":[{"start":{"line":26,"column":6},"end":{"line":26,"column":17}},{"start":{"line":26,"column":21},"end":{"line":26,"column":34}}],"line":26},"3":{"loc":{"start":{"line":31,"column":9},"end":{"line":31,"column":31}},"type":"binary-expr","locations":[{"start":{"line":31,"column":9},"end":{"line":31,"column":23}},{"start":{"line":31,"column":27},"end":{"line":31,"column":31}}],"line":31}},"s":{"0":4,"1":4,"2":4,"3":4},"f":{"0":4},"b":{"0":[3],"1":[0,4],"2":[4,3],"3":[4,1]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"f57db9dc1e666ea22e39aadff1a98a1d3f1f957f"}

@@ -39,7 +39,5 @@ import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";

*
* ⚠️ **THIS FEATURE IS HIGHLY EXPERIMENTAL** ⚠️
*
* @default false
*/
experimental_treeShake: boolean;
treeShake: boolean;
};

@@ -46,0 +44,0 @@ /**

@@ -8,2 +8,15 @@ "use strict";

const castArray_1 = __importDefault(require("lodash/castArray"));
function collapseDeprecatedExperimentalTreeShake(bundle) {
const bundleLocal = bundle;
if (bundleLocal.experimental_treeShake !== undefined) {
console.warn("Warning: The bundle configuration property 'experimental_treeShake' is deprecated. Use `treeShake` instead.");
const copy = Object.assign({}, bundleLocal);
if (bundle.treeShake === undefined) {
copy.treeShake = copy.experimental_treeShake;
}
delete copy.experimental_treeShake;
return copy;
}
return bundle;
}
/**

@@ -28,3 +41,3 @@ * Get a bundle definition from the kit config.

typescriptValidation: true,
experimental_treeShake: false,
treeShake: false,
};

@@ -37,5 +50,5 @@ if (typeof config === "boolean") {

const bundle = bundles.find((b) => b.id === id) || {};
return Object.assign(Object.assign({}, defaultDefinition), bundle);
return Object.assign(Object.assign({}, defaultDefinition), collapseDeprecatedExperimentalTreeShake(bundle));
}
return Object.assign(Object.assign({}, defaultDefinition), bundles[0]);
return Object.assign(Object.assign({}, defaultDefinition), collapseDeprecatedExperimentalTreeShake(bundles[0]));
}

@@ -42,0 +55,0 @@ exports.getBundleDefinition = getBundleDefinition;

@@ -16,3 +16,3 @@ "use strict";

typescriptValidation: true,
experimental_treeShake: false,
treeShake: false,
};

@@ -19,0 +19,0 @@ return Object.assign(Object.assign({}, defaultConfig), ((_a = config.server) !== null && _a !== void 0 ? _a : {}));

{
"name": "@rnx-kit/config",
"version": "0.4.23",
"version": "0.4.24",
"description": "Define and query information about a kit package",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -0,1 +1,3 @@

<!--remove-block start-->
# @rnx-kit/config

@@ -6,2 +8,4 @@

<!--remove-block end-->
Query for a package's configuration.

@@ -60,3 +64,3 @@

| typescriptValidation | boolean, undefined | true | Choose whether to type-check the application during bundling and serving. |
| experimental_treeShake | boolean, undefined | false | **EXPERIMENTAL** -- Choose whether to enable tree-shaking. |
| treeShake | boolean, undefined | false | Choose whether to enable tree shaking. |

@@ -63,0 +67,0 @@ ### `CyclicDetectorOptions`

@@ -87,3 +87,3 @@ {

},
"experimental_treeShake": {
"treeShake": {
"description": "Choose whether to enable tree shaking.",

@@ -90,0 +90,0 @@ "type": "boolean",

@@ -43,7 +43,5 @@ import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";

*
* ⚠️ **THIS FEATURE IS HIGHLY EXPERIMENTAL** ⚠️
*
* @default false
*/
experimental_treeShake: boolean;
treeShake: boolean;
};

@@ -50,0 +48,0 @@

@@ -12,2 +12,21 @@ import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";

function collapseDeprecatedExperimentalTreeShake(
bundle: BundleDefinition
): BundleDefinition {
const bundleLocal: BundleDefinition & { experimental_treeShake?: boolean } =
bundle;
if (bundleLocal.experimental_treeShake !== undefined) {
console.warn(
"Warning: The bundle configuration property 'experimental_treeShake' is deprecated. Use `treeShake` instead."
);
const copy = { ...bundleLocal };
if (bundle.treeShake === undefined) {
copy.treeShake = copy.experimental_treeShake;
}
delete copy.experimental_treeShake;
return copy;
}
return bundle;
}
/**

@@ -35,3 +54,3 @@ * Get a bundle definition from the kit config.

typescriptValidation: true,
experimental_treeShake: false,
treeShake: false,
};

@@ -45,6 +64,12 @@ if (typeof config === "boolean") {

const bundle = bundles.find((b) => b.id === id) || {};
return { ...defaultDefinition, ...bundle };
return {
...defaultDefinition,
...collapseDeprecatedExperimentalTreeShake(bundle),
};
}
return { ...defaultDefinition, ...bundles[0] };
return {
...defaultDefinition,
...collapseDeprecatedExperimentalTreeShake(bundles[0]),
};
}

@@ -51,0 +76,0 @@

@@ -20,3 +20,3 @@ import type { KitConfig } from "./kitConfig";

typescriptValidation: true,
experimental_treeShake: false,
treeShake: false,
};

@@ -23,0 +23,0 @@

@@ -9,2 +9,4 @@ import "jest-extended";

const consoleWarnSpy = jest.spyOn(global.console, "warn");
const bundleConfig: BundleConfig = [

@@ -30,3 +32,3 @@ {

"typescriptValidation",
"experimental_treeShake",
"treeShake",
]);

@@ -40,6 +42,10 @@ expect(d.entryPath).toEqual("lib/index.js");

expect(d.typescriptValidation).toBeTruthy();
expect(d.experimental_treeShake).toBeFalsy();
expect(d.treeShake).toBeFalsy();
}
describe("getBundleDefinition()", () => {
beforeEach(() => {
consoleWarnSpy.mockReset();
});
test("returns defaults when bundle config is a boolean", () => {

@@ -68,2 +74,21 @@ const d = getBundleDefinition(true);

});
test("returns the value for experimental_treeShake in property treeShake", () => {
const bundleConfigCopy = [...bundleConfig];
(bundleConfigCopy[0] as Record<string, unknown>).experimental_treeShake =
true;
const d = getBundleDefinition(bundleConfigCopy);
expect(d.id).toEqual("8");
expect(d).toContainKey("treeShake");
expect(d).not.toContainKey("experimental_treeShake");
expect(d.treeShake).toEqual(true);
expect(consoleWarnSpy).toBeCalledTimes(1);
expect(consoleWarnSpy).toBeCalledWith(
expect.stringContaining("deprecated")
);
expect(consoleWarnSpy).toBeCalledWith(
expect.stringContaining("experimental_treeShake")
);
});
});

@@ -80,3 +105,3 @@

typescriptValidation: true,
experimental_treeShake: true,
treeShake: true,
};

@@ -83,0 +108,0 @@

@@ -18,3 +18,3 @@ import "jest-extended";

typescriptValidation: true,
experimental_treeShake: false,
treeShake: false,
assetPlugins: ["asset-plugin-package"],

@@ -30,3 +30,3 @@ sourceExts: ["json", "jsrc"],

"typescriptValidation",
"experimental_treeShake",
"treeShake",
]);

@@ -37,3 +37,3 @@ expect(c.projectRoot).toBeUndefined();

expect(c.typescriptValidation).toBeTrue();
expect(c.experimental_treeShake).toBeFalse();
expect(c.treeShake).toBeFalse();
}

@@ -58,3 +58,3 @@

expect(c.typescriptValidation).toBeTrue();
expect(c.experimental_treeShake).toBeFalse();
expect(c.treeShake).toBeFalse();
expect(c.assetPlugins).toBeArrayOfSize(1);

@@ -61,0 +61,0 @@ expect(c.assetPlugins).toIncludeSameMembers(["asset-plugin-package"]);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc