Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ilib-assemble
Advanced tools
Utility to assemble locale data and resource files into single files for webpack to include
Tool to assemble ilib locale data from various ilib packages into single locale files so that all of the data for a single locale can be loaded quickly and efficiently. The single files are also useful for webpack, and replace the functionality previously provided by the old ilib-webpack-loader and ilib-webpack-plugin extensions to webpack.
npm install ilib-assemble
or
yarn add ilib-assemble
Then, in your package.json, add a script:
"scripts": {
"assemble": "ilib-assemble ./locale"
}
Please note: nodejs version 16 or above is required to run this tool, as it is written with ESM modules.
The purpose of the ilib-assemble tool is to find out which ilib packages your application uses, and then assemble together the locale data from those ilib packages for the requested list of locales into single files so that they can be loaded quickly or so that they can be included into webpack bundles easily.
The idea is that your build system should run this tool each time you build your product so that it has the correct locale data each time. This way, if you start using a new ilib package, it will automatically include the locale data for that package into your files, and from there in your webpack bundles. (See ilib-loader and ilib-localedata)
N.B. Currently, this tool only works with the independent ilib-* packages, not the monolithic "ilib" package itself. To include the locale data for the ilib package into webpack, you have to use the ilib-webpack-loader and ilib-webpack-plugin extensions to webpack.
(Update) Since the version v1.3.0, this tool has a ability to assemble the monolithic "ilib" package. We decided to call it as 'legacy' version ilib. It works to use legacyilib flag. Some of additional options are added to support it. Please refer to the option description of usage ("ilibPath", "ilibincPath", "outjsFileName").
The basic operation of the tool is this:
assemble.mjs
file. If so, load it, and find the default function it exports. Call
that function with the list of locales as a parameter, and it should return all of the
locale data required for the given locales. The data returned should look like this:
{
"en-US": {
"package-basename": { American locale data here }
},
"ko-KR": {
"package-basename": { Korean locale data here }
},
[etc]
}
The idea is that the assemble.mjs
module that comes with each ilib-* package contains
the know-how of assembling the locale data for that package so that the ilib-assemble
tool doesn't need deep knowledge of each ilib-* package.{
"en-US": {
"localeinfo": { American locale info },
"datefmt": { American date formats },
"numfmt": { American number formats }
},
"ko-KR": {
"localeinfo": { Korean locale info },
"datefmt": { Korean date formats },
"numfmt": { Korean number formats }
}
}
The data can then be loaded by the ilib-localedata package for use in the various ilib-* packages.
inc
file to specify which files to assemble.
If not, the default file ./src/ilib-all-inc.js
will be used which assembles all ilib classes and data together.output-dir
.ilib-all.js
. and another file is for the locale data per [locale].js
.ilib.data_[feature]_locale = { [data] }
ilib.data.localeinfo_ko = { [data] }
ilib.data.localeinfo_ko_KR = { [data] }
ilib.data.localeinfo_und_KR = { [data] }
ilib-assemble [options] output-dir [input-dir-or-file ...]
The ilib-assemble tool takes the following options:
locales
property which is an array of BCP-47 style locale tags. No default../src/ilib-all-inc.js
)file will be used.ilib-all.js
The output-dir is required and specifies the directory where the output is written. If it does not exist, it will be created first.
The input directories are optional. If not specified, the ilib-assemble tool will start in the current directory and recursively search the directory tree from there. If individual files are specified, only those files are searched.
If you would like to use the output from ilib-assemble with webpack, you can do so by first running the tool and putting the output into a subdirectory of your app. The suggested directory is "locale" but you can name it anything you like.
Then, you will have to modify your webpack configuration to point the
webpack locale data loader within ilib at your directory. You do this by
creating a resolve alias in your webpack.config.js
file:
"resolve": {
"alias": {
"calling-module": "./locale"
}
}
The "calling-module" alias should point to the path where the directory full of locale files are located which were created using ilib-assemble.
Additionally, the ilib-* packages depend on a package called ilib-loader
which knows how to load files on various platforms. Under webpack, most of
those loader subclasses are not useful and do not need to be included in
the webpack bundles. In order to exclude them, add the following to your
webpack.config.js
:
"externals": {
"./NodeLoader": "NodeLoader",
"./QtLoader": "QtLoader",
"./RhinoLoader": "RhinoLoader",
"./NashornLoader": "NashornLoader",
"./RingoLoader": "RingoLoader"
},
See the documentation for ilib-loader for more details.
Copyright © 2022, 2024 JEDLSoft
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
See CHANGELOG.md
FAQs
Utility to assemble locale data and resource files into single files for webpack to include
We found that ilib-assemble demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.