Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oracle/oraclejet-tooling

Package Overview
Dependencies
Maintainers
8
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oracle/oraclejet-tooling - npm Package Compare versions

Comparing version 13.0.0 to 13.0.1

207

lib/buildCommon/stripLocalComponentJson.js

@@ -19,35 +19,33 @@ /**

function stripLocalComponentJson(context) {
return new Promise((resolve) => {
const componentsCache = util.getComponentsCache();
util.getLocalCompositeComponents().forEach((_component) => {
let pathToComponentJSON;
let modifiedComponentJSON;
let jsonFileContent;
const { builtPath, componentJson } = componentsCache[_component];
// Modify the component.json in staging by stripping the unwanted attributes and
// sub-properties during run-time. This stripped json file is then included in
// the web/../min/loader.js file. The original contents of the json file are restored in
// restoreLocalCcaComponentJson after minification. Also, if the passed component is a
// pack, we will need to iterate through its component dependencies. Failure to do so
// will result in having non-stripped metadata in the component's min/loader.js file:
if (util.isJETPack({ pack: _component, componentJson })) {
const dependenciesFromCache = Object.getOwnPropertyNames(componentJson.dependencies);
dependenciesFromCache.forEach((component) => {
const componentData = componentsCache[component];
pathToComponentJSON = path.join(componentData.builtPath, CONSTANTS.JET_COMPONENT_JSON);
if (fs.readdirSync(componentData.builtPath).includes('loader.js')) {
jsonFileContent = fs.readJSONSync(pathToComponentJSON);
modifiedComponentJSON = getStrippedComponentJson(jsonFileContent);
fs.writeJsonSync(pathToComponentJSON, modifiedComponentJSON);
}
});
} else {
pathToComponentJSON = path.join(builtPath, CONSTANTS.JET_COMPONENT_JSON);
jsonFileContent = fs.readJSONSync(pathToComponentJSON);
modifiedComponentJSON = getStrippedComponentJson(jsonFileContent);
fs.writeJsonSync(pathToComponentJSON, modifiedComponentJSON);
}
});
resolve(context);
const componentsCache = util.getComponentsCache();
util.getLocalCompositeComponents().forEach((_component) => {
let pathToComponentJSON;
let modifiedComponentJSON;
let jsonFileContent;
const { builtPath, componentJson } = componentsCache[_component];
// Modify the component.json in staging by stripping the unwanted attributes and
// sub-properties during run-time. This stripped json file is then included in
// the web/../min/loader.js file. The original contents of the json file are restored in
// restoreLocalCcaComponentJson after minification. Also, if the passed component is a
// pack, we will need to iterate through its component dependencies. Failure to do so
// will result in having non-stripped metadata in the component's min/loader.js file:
if (util.isJETPack({ pack: _component, componentJson })) {
const dependenciesFromCache = Object.getOwnPropertyNames(componentJson.dependencies);
dependenciesFromCache.forEach((component) => {
const componentData = componentsCache[component];
pathToComponentJSON = path.join(componentData.builtPath, CONSTANTS.JET_COMPONENT_JSON);
if (fs.readdirSync(componentData.builtPath).includes('loader.js')) {
jsonFileContent = fs.readJSONSync(pathToComponentJSON);
modifiedComponentJSON = getStrippedComponentJson(jsonFileContent);
fs.writeJsonSync(pathToComponentJSON, modifiedComponentJSON);
}
});
} else {
pathToComponentJSON = path.join(builtPath, CONSTANTS.JET_COMPONENT_JSON);
jsonFileContent = fs.readJSONSync(pathToComponentJSON);
modifiedComponentJSON = getStrippedComponentJson(jsonFileContent);
fs.writeJsonSync(pathToComponentJSON, modifiedComponentJSON);
}
});
return Promise.resolve(context);
}

@@ -96,4 +94,8 @@

if (!requiredAttributes.has(attribute)) {
// eslint-disable-next-line no-param-reassign
delete json[attribute];
if (attribute === 'extension') {
stripExtensionSubAttribute(json[attribute], json, attribute);
} else {
// eslint-disable-next-line no-param-reassign
delete json[attribute];
}
}

@@ -145,4 +147,3 @@ });

subAttributes.forEach((subAttribute) => {
const subAttributeObject = componentJSON[topLevelAttribute][subAttribute];
stripSubAttribute(subAttributeObject, componentJSON[topLevelAttribute], subAttribute);
stripSubAttributes(componentJSON[topLevelAttribute][subAttribute]);
});

@@ -161,8 +162,22 @@ // Delete the resulting object if empty:

*
* @param {object} attributeObject
*
* Strip the sub-attributes from the top level componentJson
* properties. Go through the passed object recursively and
* remove the unrequired sub-attributes.
*/
function stripSubAttributes(attributeObject) {
const attributes = getAttributes(attributeObject);
attributes.forEach((attribute) => {
stripSubAttribute(attributeObject[attribute], attributeObject, attribute);
});
}
/**
*
* @param {string} attributeName
* @param {object} attributeObject
* @param {object} subAttributeObject -- attributeObject[attributeName]
* @returns {Boolean}
*
* Strip the sub-attributes. Go throught the passed object recursively and
* Strip the sub-attributes. Go through the passed object recursively and
* remove the unrequired sub-attributes.

@@ -176,2 +191,12 @@ */

}
if (attributeName === 'extension') {
stripExtensionSubAttribute(subAttributeObject, attributeObject, attributeName);
if (isEmpty(subAttributeObject)) {
// eslint-disable-next-line no-param-reassign
delete attributeObject[attributeName];
}
return;
}
const attributes = getAttributes(subAttributeObject);

@@ -181,2 +206,3 @@ if (!attributes) {

}
attributes.forEach((attribute) => {

@@ -204,3 +230,9 @@ stripSubAttribute(subAttributeObject[attribute], subAttributeObject, attribute);

'writeback',
'internalName'
'internalName',
'consume',
'provide',
'name',
'default',
'transform',
'extension'
]);

@@ -215,2 +247,69 @@ if (requiredSubAttributes.has(subAttribute)) {

*
* @param {string} subAttribute
* @returns {Boolean}
*
* Checks if the passed attribute is a needed non-required sub-attribute.
*/
function isNeededExtensionSubAttribute(subAttribute) {
const nonRequiredSubAttributes = new Set([
'description',
'displayName',
'tags',
'coverImage',
'screenshots',
'jet',
'vbdt',
'audits',
'package',
'docUrl',
'itemProperties',
'webelement',
'readme',
'unsupportedBrowsers',
'businessApprovals',
'uxSpecs',
'unsupportedThemes',
'defaultColumns',
'minColumns',
'itemProperties',
'slotData',
'exceptionStatus',
'catalog',
'oracle',
'themes'
]);
if (nonRequiredSubAttributes.has(subAttribute)) {
return false;
}
return true;
}
/**
*
* @param {string} attributeName
* @param {object} attributeObject
* @param {object} subAttributeObject -- attributeObject[attributeName]
*
* Strip the extension sub-attributes. Go through the passed object recursively and
* remove the unrequired sub-attributes.
*/
function stripExtensionSubAttribute(subAttributeObject, attributeObject, attributeName) {
if (!isNeededExtensionSubAttribute(attributeName)) {
// eslint-disable-next-line no-param-reassign
delete attributeObject[attributeName];
return;
}
const attributes = getAttributes(subAttributeObject);
if (!attributes) {
return;
}
attributes.forEach((attribute) => {
stripExtensionSubAttribute(subAttributeObject[attribute], subAttributeObject, attribute);
});
deleteExtensionSubAttribute(subAttributeObject, attributeObject, attributeName);
}
/**
*
* @param {string} parentAttributeName

@@ -245,2 +344,32 @@ * @param {object} parentAttributeObject

*
* @param {string} parentAttributeName
* @param {object} parentAttributeObject
* @param {object} childAttributeObject -- parentAttributeObject[parentAttributeName]
* @returns {Boolean}
*
* Deletes the unrequired attribute at RT:
*/
// eslint-disable-next-line max-len
function deleteExtensionSubAttribute(childAttributeObject, parentAttributeObject, parentAttributeName) {
const attributes = getAttributes(childAttributeObject);
if (attributes) {
attributes.forEach((attribute) => {
if (!isNeededExtensionSubAttribute(attribute) && !isObject(childAttributeObject[attribute])) {
// eslint-disable-next-line no-param-reassign
delete childAttributeObject[attribute];
}
if (isEmpty(childAttributeObject)) {
// eslint-disable-next-line no-param-reassign
delete parentAttributeObject[parentAttributeName];
}
});
if (isEmpty(childAttributeObject)) {
// eslint-disable-next-line no-param-reassign
delete parentAttributeObject[parentAttributeName];
}
}
}
/**
*
* @param {object} json

@@ -247,0 +376,0 @@ * @returns {Boolean}

2

lib/templates/pack/component.json
{
"name": "@pack@",
"version": "1.0.0",
"jetVersion": "13.0.0",
"jetVersion": "13.0.1",
"type": "pack",

@@ -6,0 +6,0 @@ "displayName": "A user friendly, translatable name of the pack.",

{
"name": "@oracle/oraclejet-tooling",
"version": "13.0.0",
"version": "13.0.1",
"license": "UPL-1.0",

@@ -5,0 +5,0 @@ "description": "Programmatic API to build and serve Oracle JET web and mobile applications",

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

# @oracle/oraclejet-tooling 13.0.0
# @oracle/oraclejet-tooling 13.0.1

@@ -9,3 +9,3 @@ ## About the tooling API

## Installation
This module will be automatically installed when you scaffold a web or hybrid mobile app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1300&id=homepage).
This module will be automatically installed when you scaffold a web or hybrid mobile app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1301&id=homepage).

@@ -12,0 +12,0 @@ ## [Contributing](https://github.com/oracle/oraclejet-tooling/blob/master/CONTRIBUTING.md)

## Release Notes for oraclejet-tooling ##
### 13.0.0
### 13.0.1

@@ -5,0 +5,0 @@ ### 11.0.0

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