@human-synthesis/norns 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/auto-import.js +3 -24
package/package.json
CHANGED
package/src/auto-import.js
CHANGED
|
@@ -653,12 +653,6 @@ function renderImports(entries) {
|
|
|
653
653
|
* and excluded from auto-import — forcing an explicit import to disambiguate.
|
|
654
654
|
*
|
|
655
655
|
* Default `[]` (off; explicit imports for service-layer code).
|
|
656
|
-
* @param {string[] | false} [options.exportDirs]
|
|
657
|
-
* DEPRECATED. Equivalent to `exportGlobs: dirs.map(d => '${d}/**\/*.{c,civet,js}')`,
|
|
658
|
-
* which scans every file under those dirs. Path-scoping is still applied,
|
|
659
|
-
* so server exports won't leak into client files — but the broad scan
|
|
660
|
-
* surfaces every internal export as a potential auto-import. Migrate to
|
|
661
|
-
* `exportGlobs: ['src/lib/**\/public.c']` for an intentional API surface.
|
|
662
656
|
* @param {string[]} [options.exportExtensions]
|
|
663
657
|
* File extensions accepted for exports (defence-in-depth on top of the
|
|
664
658
|
* glob). Default `['.c', '.civet', '.js']` — `.ts` excluded because
|
|
@@ -667,8 +661,8 @@ function renderImports(entries) {
|
|
|
667
661
|
* @param {string} [options.libAlias] Default `'$lib'`.
|
|
668
662
|
* @param {string} [options.root] Default `process.cwd()`.
|
|
669
663
|
* @param {(msg: string) => void} [options.log]
|
|
670
|
-
* Channel for conflict
|
|
671
|
-
*
|
|
664
|
+
* Channel for conflict warnings. Default `console.warn`. Tests pass a
|
|
665
|
+
* stub to assert behavior without polluting output.
|
|
672
666
|
*/
|
|
673
667
|
export function nornsAutoImport(options = {}) {
|
|
674
668
|
const root = options.root ?? process.cwd();
|
|
@@ -682,23 +676,8 @@ export function nornsAutoImport(options = {}) {
|
|
|
682
676
|
const componentSpecs = options.components ?? null;
|
|
683
677
|
const log = options.log ?? console.warn;
|
|
684
678
|
|
|
685
|
-
|
|
686
|
-
// `exportDirs` is shimmed in for backward compatibility with a one-time
|
|
687
|
-
// deprecation notice per init.
|
|
688
|
-
const explicitGlobs =
|
|
679
|
+
const effectiveGlobs =
|
|
689
680
|
options.exportGlobs === false || options.exportGlobs == null ? [] : options.exportGlobs;
|
|
690
|
-
const legacyDirs =
|
|
691
|
-
options.exportDirs === false || options.exportDirs == null ? [] : options.exportDirs;
|
|
692
|
-
let effectiveGlobs = [...explicitGlobs];
|
|
693
|
-
if (legacyDirs.length > 0) {
|
|
694
|
-
log(
|
|
695
|
-
'[norns-auto-import] `exportDirs` is deprecated. Migrate to `exportGlobs`, e.g. ' +
|
|
696
|
-
"`exportGlobs: ['src/lib/**/public.c']` — barrel-file scope is the safe default."
|
|
697
|
-
);
|
|
698
|
-
effectiveGlobs = effectiveGlobs.concat(
|
|
699
|
-
legacyDirs.map((d) => `${d.replace(/\\/g, '/').replace(/\/+$/, '')}/**/*.{c,civet,js}`)
|
|
700
|
-
);
|
|
701
|
-
}
|
|
702
681
|
|
|
703
682
|
const components =
|
|
704
683
|
componentDirs.length === 0
|