
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@cortexapps/js-block-libraries
Advanced tools
A collection of bundled JavaScript libraries (Lodash, YAML, HCL) optimized for use in CortexApps custom JavaScript execution environments. This package provides both runtime bundles for backend execution and TypeScript declarations for frontend code edito
A collection of bundled JavaScript libraries (Lodash, YAML, HCL) optimized for use in CortexApps custom JavaScript execution environments. This package provides both runtime bundles for backend execution and TypeScript declarations for frontend code editors.
The frontend integration provides TypeScript declarations for the code editor to enable autocomplete and type checking.
yarn add @cortexapps/js-block-libraries
import { librariesDeclarationsZipFile } from '@cortexapps/js-block-libraries/declarations';
// In your editor configuration
languageProvider.setGlobalOptions('typescript', {
extraLibsZip: librariesDeclarationsZipFile
});
This will enable IntelliSense for all bundled libraries in the code editor:
// Users will get autocomplete for:
import _ from 'lodash';
import yaml from 'yaml';
import { parse as parseHCL } from 'hcl2-parser';
// Example usage with full type support
const chunked = _.chunk(['a', 'b', 'c', 'd'], 2);
const yamlString = yaml.stringify({ hello: 'world' });
const hclConfig = parseHCL('variable "example" { default = "value" }');
The backend requires the actual JavaScript bundles to execute user code with these libraries available.
Download the Release Archive
js-block-libraries-X.Y.Z.tar.gz fileCopy Library Files
libraries/ directory to:
web/src/main/resources/javascriptLibraries/
javascriptLibraries/lodash.jsjavascriptLibraries/yaml.jsjavascriptLibraries/hcl.jsConfigure the JavaScript Mixin
web/src/main/kotlin/com/brainera/web/workflows/actions/JavascriptMixin.kt// Example configuration (adjust based on your implementation)
val libraries =
listOf(
JSLibrary(
moduleName = "lodash",
filename = "lodash.js",
importStatement = "import {_} from 'lodash';",
),
JSLibrary(
moduleName = "hcl",
filename = "hcl.js",
importStatement = "import {hcl} from 'hcl';",
),
JSLibrary(
moduleName = "yaml",
filename = "yaml.js",
importStatement = "import {YAML} from 'yaml'",
),
)
# Install dependencies
yarn install
# Build libraries and declarations
yarn build
This will create:
/dist/libraries/ - JavaScript bundles for backend/dist/declarations/ - TypeScript declarations (zipped and base64 encoded)To add a new JavaScript library to the bundle:
Install the library:
yarn add your-new-library
Create the library entry point:
Create a new file /src/libraries/your-library-name.ts:
// src/libraries/your-library-name.ts
export * from 'your-new-library';
// or
import yourLibrary from 'your-new-library';
export default yourLibrary;
Build and test:
yarn build
The build system will automatically detect the new file and create your-library-name.js in the output.
For libraries that already include TypeScript definitions (like YAML or HCL):
Update the rslib configuration:
Edit /rslib.config.ts and add the library to the typesToUse array:
const typesToUse = [
{ from: 'yaml/**/*.d.ts', to: removeDistFromPath, context: "node_modules" },
{ from: 'hcl2-parser/**/*.d.ts', to: removeDistFromPath, context: "node_modules" },
{ from: 'your-library/**/*.d.ts', to: removeDistFromPath, context: "node_modules" }, // Add this line
{ from: '**/*.d.ts', to: removeDistFromPath, context: "src/definitions" },
];
Build to verify:
yarn build
The TypeScript definitions will be automatically copied and included in the declarations archive.
For libraries that don't have built-in TypeScript support or need custom definitions (like Lodash or Fetch):
Create the definitions directory:
mkdir -p src/definitions/your-library-name
Create the definition file:
Create /src/definitions/your-library-name/index.d.ts:
// src/definitions/your-library-name/index.d.ts
// For a simple library
declare module 'your-library-name' {
export function someFunction(param: string): number;
export const someConstant: string;
}
// For a default export library
declare module 'your-library-name' {
interface YourLibrary {
method(param: string): void;
}
const yourLibrary: YourLibrary;
export default yourLibrary;
}
Build to verify:
yarn build
The custom definitions will be automatically included in the declarations archive.
Complete example of adding a new library:
Install Moment.js:
yarn add moment
yarn add -D @types/moment # If types exist
Create library entry:
// src/libraries/moment.ts
import moment from 'moment';
export default moment;
export * from 'moment';
Add to rslib config (if using @types/moment):
const typesToUse = [
// ... existing entries
{ from: 'moment/**/*.d.ts', to: removeDistFromPath, context: "node_modules" },
{ from: '**/*.d.ts', to: removeDistFromPath, context: "src/definitions" },
];
Build:
yarn build
You'll now have moment.js in /dist/libraries/ and TypeScript support in the editor.
js-block-libraries/
├── src/
│ ├── libraries/ # Library entry points
│ │ ├── lodash.ts # Lodash exports
│ │ ├── yaml.ts # YAML exports
│ │ └── hcl.ts # HCL exports
│ └── definitions/ # Custom TypeScript definitions
├── scripts/
│ └── generate-declarations.js # Builds declarations archive
├── dist/ # Build output (git ignored)
│ ├── libraries/ # Backend bundles
│ └── declarations/ # Frontend TypeScript declarations
└── rslib.config.ts # Build configuration (auto-discovers libraries)
Releases are automated via GitHub Actions when a semver tag is pushed:
git tag v1.2.3
git push origin v1.2.3
This will:
require is set to null)yarn build to test the buildSee the individual library licenses:
FAQs
A collection of bundled JavaScript libraries (Lodash, YAML, HCL) optimized for use in CortexApps custom JavaScript execution environments. This package provides both runtime bundles for backend execution and TypeScript declarations for frontend code edito
We found that @cortexapps/js-block-libraries demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.