-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[glob-modules] Add support for resolving parent and nested modules
- Loading branch information
1 parent
9607735
commit 273d76a
Showing
4 changed files
with
113 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'glob-modules': patch | ||
--- | ||
|
||
Added support for resolving parent and nested modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import * as path from 'node:path' | ||
import * as url from 'node:url' | ||
import { globModules as globModulesRaw } from '../../dist/esm/index.mjs' | ||
|
||
/** @type {import('../../dist/types/index.js').globModules} */ | ||
// @ts-ignore | ||
const globModules = globModulesRaw | ||
|
||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url)) | ||
|
||
const modules = await globModules('../modules/*.mjs', { | ||
importMeta: import.meta, | ||
}) | ||
console.log('modules:', modules) | ||
/* { | ||
modules: { | ||
one: { default: 1, one: 'one' }, | ||
two: { default: 2 }, | ||
four: { default: 4 }, | ||
}, | ||
} */ | ||
|
||
const nestedModules = await globModules('../modules/nested-modules/*.mjs', { | ||
importMeta: import.meta, | ||
}) | ||
console.log('nestedModules:', nestedModules) | ||
/* { | ||
modules: { | ||
'nested-modules': { | ||
five: 5, | ||
six: 6, | ||
eight: 8, | ||
}, | ||
}, | ||
} */ | ||
|
||
const allModules = await globModules('../modules/**/*.mjs', { | ||
cwd: __dirname, | ||
}) | ||
console.log('allModules:', allModules) | ||
/* { | ||
modules: { | ||
one: { default: 1 }, | ||
two: { default: 2 }, | ||
four: { default: 4 }, | ||
'nested-modules': { | ||
five: 5, | ||
six: 6, | ||
eight: 8, | ||
}, | ||
}, | ||
} */ | ||
|
||
const cjsModules = await globModules('../modules/**/*.js', { | ||
cwd: __dirname, | ||
}) | ||
console.log('cjsModules:', cjsModules) | ||
/* { | ||
modules: { | ||
three: { default: 3 }, | ||
'nested-modules': { | ||
seven: 8, | ||
}, | ||
}, | ||
} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
273d76a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
aacc-next-ts – ./recipes/next-ts
aacc-next-ts-aaronccasanova.vercel.app
aacc-next-ts-git-main-aaronccasanova.vercel.app
aacc-next-ts.vercel.app
273d76a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
aacc-scales – ./apps/scales
aacc-scales-git-main-aaronccasanova.vercel.app
aacc-scales.vercel.app
aacc-scales-aaronccasanova.vercel.app
273d76a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
aacc-next-ts-styled-comps – ./recipes/next-ts-styled-comps
aacc-next-ts-styled-comps-git-main-aaronccasanova.vercel.app
aacc-next-ts-styled-comps-aaronccasanova.vercel.app
aacc-next-ts-styled-comps.vercel.app