A tool to simplify importing JS modules
MIT License
Bot releases are hidden (Show)
Full Changelog: https://github.com/Galooshi/import-js/compare/v5.1.0...v6.0.0
Published by lencioni 9 months ago
The main breaking change in this release is that we no longer officially support Node v6 and v7. We've also updated @babel
dependencies, which could also cause different behavior (plus fix a few bugs).
New feature:
If you don't have a package.json
file in your project, you can drop an .importjs-root
file in the root of the project to indicate to import-js where to resolve imports from. (#547 by @mikabytes)
Published by trotzig about 6 years ago
Adds support for isRoot
in package.json files. From the README:
ImportJS looks for the package.json
file in the closest ancestor directory for the file you're editing to find node modules to import. However, sometimes it might pull dependencies from a directory further up the chain. For example, your directory structure might look like this:
.
|-- package.json
|-- components
| |-- button.js
| |-- icon.js
|-- node_modules
| |-- react
|-- subpackage
| |-- package.json
| |-- components
| |-- bulletin.js
If you were to use ImportJS on subpackage/components/bulletin.js
which imports React, ImportJS would not know that react
is a valid dependency.
To tell ImportJS to skip a directory and keep searching upwards to find the root package directory, specify "importjs": { "isRoot": false }
in the package.json
of the directory to ignore. In this case, you would want something like this:
{
"name": "subpackage",
...
"importjs": {
"isRoot": false
}
}
Published by trotzig about 6 years ago
This patch release should fix issues people have been seeing related to a 'decorators'
plugin.
Published by trotzig about 6 years ago
This version adds support for Typescript files. As a result of that, we're now also on Babel 7. Even though this is a big change for the project, we believe it should be backwards compatible. That's why this version is a minor version bump and not a major.
Published by trotzig over 6 years ago
Breaking changes:
(hopefully) Non-breaking changes:
util
to node environment's namedExports
Bug fixes:
Published by trotzig over 6 years ago
Thanks to @kahless for helping out in getting this patch release ready.
namedExports
config option. It has become clear that it's hard to make every usecase detected automatically. Instead of confusing people with a useful config option being removed soon, we should just keep supporting it. I don't see it going away any time soon anyway.Published by trotzig almost 7 years ago
danglingCommas
optionemptyLinesBetweenGroups
optionPublished by trotzig almost 7 years ago
mergableOptions
configuration property. (thanks to @coagmano)Published by trotzig almost 7 years ago
Published by trotzig about 7 years ago
goto
more robustPublished by trotzig about 7 years ago
Changes:
sortImports
to known configuration options (@dabbott)Published by lencioni over 7 years ago
sortImports
option to enable or disable import sortingexport * from './foo'
export * as ns from './foo'
(uses babylon exportExtensions
plugin)export { foo, bar as default }
export const { foo, bar: baz } = someObject
export const { foo, bar = {a:1, b:2} } = someObject
export const {
foo,
bar: baz = {a: 1, b: 2}
} = someObject
export const { foo, ...bar } = someObject
export const [ foo, bar ] = someObject
export const [ foo, ...bar ] = someObject
Big thanks to @dabbott and @coagmano for their work that went into this release!
Published by lencioni over 7 years ago
function foo(bar = 123) {}
) and array destructuring (e.g. const [foo] = bar;
) when finding undefined identifiers.import foo from 'foo';
instead of the module name and full absolute path (e.g. foo /Users/someone/path/to/repo/node_modules/foo
).excludes
configuration can now be used to exclude packages in the node_modules directory.Thanks to @dabbott for most of the work that went into this release!
Published by trotzig over 7 years ago
module.exports a ? require('b') : require('c');
).Because the schema was changed for the exports storage, you'll see a message (once) after installing this version:
ImportJS is initializing for /path/to/project. Results will be more accurate in a few moments.
The storage will then be re-initialized, but you'll be good to go soon after.
Published by trotzig over 7 years ago
import { a as b } from 'c';
became import { b } from 'c';
)