
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
> **E**SMC is **S**mart **M**odules **C**ompiler. The Power of Intelligence. > **E**SM are **S**weet **M**odules. The Power of Intelligence. > **E**SMJS, **S**weet **M**odules **J**ava**S**cript. The Power of Intelligence.
ESMC is Smart Modules Compiler. The Power of Intelligence. ESM are Sweet Modules. The Power of Intelligence. ESMJS, Sweet Modules JavaScript. The Power of Intelligence.
esm loader, creating ESM <-> CJS bridgedist/nodejs with .mjs files>=1%, not ie query in dist/browsers with .js filesdist/typings files, ready for the types field in package.jsondist/nodejs/index.js which is esm bridgeesm initesm watch, esm build and esm bundle.mjs source files.ts and .tsx source filesIf you love and want static typing, just write .ts or .tsx files. Here should be noted
that TypeScript forces us to use different extension if we want to write some JSX (the .tsx extension).
We don't use the TypeScript compiler tsc binary. We transform
the source files in src/ directory with Babel 7 using the @babel/preset-typescript.
This gives us the full power of Babel such as Preset Env, Stage 3 and React. And the
Stage 3 preset isn't scary - we just use it because the Class Properties proposal
(in the case when we not transpiling typescript), Dynamic Import and import.meta syntax plugins.
The @babel/preset-env is used just because we want to have ability to transpile for
specific browsers/nodejs versions. Here for browsers we use the >=1%, not ie query of
Browserlist.
So, what's the execution order?
tsc without emitting type declaration files, just type checking.eslint --fix over the source files, which does the fixing and formatting with Prettier.tsc only emitting declaration files, which creates dist/typings directory..ts/.tsx files into .js files to dist/nodejs and dist/browsers folders.prettier 'dist/**/*' --write to only prettify the output of Babel..js files from dist/nodejs folder to have .mjs extension.dist/nodejs/index.js file which in turn uses the esm package to load the .mjs files.In case you don't love static typing and TypeScript/FlowType, you can just write awesome
modern JavaScript/JSX into .mjs files in your src/ directory and we will disable the typescript preset.
It will allow you to use everything that Node 8/10 supports plus the Class Properties & Dynamic Import.
The rest is the same - we compiles these files to dist/nodejs and dist/browsers folders, using the
same Browserlist query for the browsers.
So, what's the execution order?
eslint --fix over the source files, which does the fixing and formatting with Prettier..mjs files into .mjs files at dist/nodejs (with Babel's --keep-file-extension).mjs files into .js files at dist/browsersprettier 'dist/**/*' --write to only prettify the output of Babel.dist/nodejs/index.js file which in turn uses the esm package to load the .mjs files.And so, the only thing that left to be done is bundling, but that's optional only if you need
to have browser bundles. You can use either Rollup or Webpack to bundle the dist/browsers/index.js entry.
Notice that you don't need to transpile, but only need to resolve all deps and make single bundle file
which will be used in the browsers (or multiple bundle chunks, using Code Splitting).
We use very well fine-tuned ESLint config which integrates AirBnB preset (including their React and JSX configs)
and the Prettier plugin. There are things that are handled by TypeScript/TSLint defaults,
so they are disabled from the ESLint. There are other things that are disabled from AirBnB,
so they won't conflict with the Prettier or TypeScript. But we intentionally don't use the eslint-config-prettier,
instead we disabled one by one rules that are not okey with the Prettier formatting.
We also use the typescript, import, node, promise ESLint plugins with few eslint-import resolvers, such
as the eslint-import-resolver-typescript and eslint-import-resolver-node.
FAQs
> **E**SMC is **S**mart **M**odules **C**ompiler. The Power of Intelligence. > **E**SM are **S**weet **M**odules. The Power of Intelligence. > **E**SMJS, **S**weet **M**odules **J**ava**S**cript. The Power of Intelligence.
We found that esmjs demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.