-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support mark any underscore module as private (#618)
- Loading branch information
Showing
11 changed files
with
86 additions
and
12 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
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
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,35 @@ | ||
import { | ||
assertFilesContent, | ||
createIntegrationTest, | ||
getFileNamesFromDirectory, | ||
} from '../utils' | ||
|
||
describe('integration shared-module', () => { | ||
it('should split all shared module into different chunks', async () => { | ||
await createIntegrationTest( | ||
{ | ||
directory: __dirname, | ||
}, | ||
async ({ distDir, stdout }) => { | ||
const jsFiles = await getFileNamesFromDirectory(distDir) | ||
expect(jsFiles).toEqual([ | ||
'_internal/util-a.cjs', | ||
'_internal/util-a.js', | ||
'_internal/util-b.cjs', | ||
'_internal/util-b.js', | ||
'export-a.js', | ||
'export-b.js', | ||
'export-c.js', | ||
'private/_nested/util-c.cjs', | ||
'private/_nested/util-c.js', | ||
]) | ||
|
||
await assertFilesContent(distDir, { | ||
'export-a.js': `'./_internal/util-a.js'`, | ||
'export-b.js': `'./_internal/util-b.js'`, | ||
'export-c.js': `'./private/_nested/util-c.js'`, | ||
}) | ||
}, | ||
) | ||
}) | ||
}) |
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,12 @@ | ||
{ | ||
"name": "shared-module", | ||
"type": "module", | ||
"exports": { | ||
"./export-a": "./dist/export-a.js", | ||
"./export-b": "./dist/export-b.js", | ||
"./export-c": "./dist/export-c.js" | ||
}, | ||
"dependencies": { | ||
"react": "*" | ||
} | ||
} |
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 @@ | ||
export const utilA = 'utilA' |
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 @@ | ||
export const utilB = 'utilB' |
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,6 @@ | ||
import { utilA } from './_internal/util-a' | ||
import { utilB } from './_internal/util-b' | ||
|
||
export const getName = () => { | ||
return 'export-a' + utilA + utilB | ||
} |
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,6 @@ | ||
import { utilB } from './_internal/util-b' | ||
import { utilC } from './private/_nested/util-c' | ||
|
||
export const getName = () => { | ||
return 'export-b' + utilB + utilC | ||
} |
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,6 @@ | ||
import { utilA } from './_internal/util-a' | ||
import { utilC } from './private/_nested/util-c' | ||
|
||
export const getName = () => { | ||
return 'export-c' + utilA + utilC | ||
} |
1 change: 1 addition & 0 deletions
1
test/integration/shared-any-module/src/private/_nested/util-c.js
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 @@ | ||
export const utilC = 'utilC' |