Gathering detailed insights and metrics for babel-plugin-debug-macros
Gathering detailed insights and metrics for babel-plugin-debug-macros
Gathering detailed insights and metrics for babel-plugin-debug-macros
Gathering detailed insights and metrics for babel-plugin-debug-macros
npm install babel-plugin-debug-macros
v1.0.2-babel-plugin-debug-macros
Published on 11 Jul 2024
v1.0.1-babel-plugin-debug-macros
Published on 11 Jul 2024
Release 1.0.0
Published on 27 Apr 2024
Release 1.0.0-alpha.2
Published on 17 Apr 2024
Release 1.0.0-alpha.1
Published on 11 Apr 2024
Release 1.0.0-alpha.0
Published on 11 Apr 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
13 Stars
271 Commits
14 Forks
8 Watching
11 Branches
26 Contributors
Updated on 11 Jul 2024
Minified
Minified + Gzipped
TypeScript (75.21%)
JavaScript (24.79%)
Cumulative downloads
Total Downloads
Last day
-11.1%
62,011
Compared to previous day
Last week
-9.4%
329,286
Compared to previous week
Last month
21.9%
1,521,556
Compared to previous month
Last year
5.5%
19,708,468
Compared to previous year
2
1
This provides debug macros and feature flagging.
The plugin takes 4 types options: flags
, svelte
, debugTools
, and
externalizeHelpers
. The importSpecifier
is used as a hint to this plugin as
to where macros are being imported and completely configurable by the host.
Like Babel you can supply your own helpers using the externalizeHelpers
options.
1{ 2 plugins: [ 3 ['babel-plugin-debug-macros', { 4 // @optional 5 debugTools: { 6 isDebug: true, 7 source: 'debug-tools', 8 // @optional 9 assertPredicateIndex: 0 10 }, 11 12 flags: [ 13 { source: '@ember/env-flags', flags: { DEBUG: true } }, 14 { 15 name: 'ember-source', 16 source: '@ember/features', 17 flags: { 18 FEATURE_A: false, 19 FEATURE_B: true, 20 DEPRECATED_CONTROLLERS: "2.12.0" 21 } 22 } 23 ], 24 25 // @optional 26 svelte: { 27 'ember-source': "2.15.0" 28 }, 29 30 // @optional 31 externalizeHelpers: { 32 module: true, 33 // global: '__my_global_ns__' 34 } 35 }] 36 ] 37}
Flags and features are inlined into the consuming module so that something like UglifyJS will DCE them when they are unreachable.
1import { DEBUG } from '@ember/env-flags'; 2import { FEATURE_A, FEATURE_B } from '@ember/features'; 3 4if (DEBUG) { 5 console.log('Hello from debug'); 6} 7 8let woot; 9if (FEATURE_A) { 10 woot = () => 'woot'; 11} else if (FEATURE_B) { 12 woot = () => 'toow'; 13} 14 15woot();
Transforms to:
1if (true /* DEBUG */) { 2 console.log('Hello from debug'); 3} 4 5let woot; 6if (false /* FEATURE_A */) { 7 woot = () => 'woot'; 8} else if (true) { 9 woot = () => 'toow'; 10} 11 12woot();
warn
macro expansion1import { warn } from 'debug-tools'; 2 3warn('this is a warning');
Expands into:
1(true && console.warn('this is a warning'));
assert
macro expansionThe assert
macro can expand in a more intelligent way with the correct
configuration. When babel-plugin-debug-macros
is provided with the
assertPredicateIndex
the predicate is injected in front of the assertion
in order to avoid costly assertion message generation when not needed.
1import { assert } from 'debug-tools'; 2 3assert((() => { 4 return 1 === 1; 5})(), 'You bad!');
With the debugTools: { assertPredicateIndex: 0 }
configuration the following expansion is done:
1(true && !((() => { return 1 === 1;})()) && console.assert(false, 'this is a warning'));
When assertPredicateIndex
is not specified, the following expansion is done:
1(true && console.assert((() => { return 1 === 1;})(), 'this is a warning'));
deprecate
macro expansion1import { deprecate } from 'debug-tools'; 2 3let foo = 2; 4 5deprecate('This is deprecated.', foo % 2);
Expands into:
1let foo = 2; 2 3(true && !(foo % 2) && console.warn('This is deprecated.'));
When you externalize helpers you must provide runtime implementations for the above macros. An expansion will still occur, however we will emit references to those runtime helpers.
A global expansion looks like the following:
1import { warn } from 'debug-tools'; 2 3warn('this is a warning');
Expands into:
1(true && Ember.warn('this is a warning'));
While externalizing the helpers to a module looks like the following:
1import { warn } from 'debug-tools'; 2 3warn('this is a warning');
Expands into:
1(true && warn('this is a warning'));
Svelte allows for consumers to opt into stripping deprecated code from your dependecies. By adding a package name and minimum version that contains no deprecations, that code will be compiled away.
For example, consider you are on ember-source@2.10.0
and you have no
deprecations. All deprecated code in ember-source
that is <=2.10.0
will be
removed.
svelte: {
"ember-source": "2.10.0"
}
Now if you bump to ember-source@2.11.0
you may encounter new deprecations.
The workflow would then be to clear out all deprecations and then bump the
version in the svelte
options.
svelte: {
"ember-source": "2.11.0"
}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
packaging workflow detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/14 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn Morebabel-plugin-macros
Allows you to build compile-time libraries
ember-cli-babel
Ember CLI addon for Babel
vite-plugin-babel-macros
Use babel macros with vite
babel-plugin-twin
<a href="https://www.npmjs.com/package/babel-plugin-twin"><img src="https://img.shields.io/npm/dt/babel-plugin-twin.svg" alt="Total Downloads"></a> <a href="https://www.npmjs.com/package/babel-plugin-twin"><img src="https://img.shields.io/npm/v/babel-plug