Skip to content

Commit a8a8be9

Browse files
chore(enhanced): sync enhanced + .gitignore from feat/apps-react-query-singleton-3000-3001
1 parent 42f090d commit a8a8be9

File tree

114 files changed

+4589
-1035
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4589
-1035
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ apps/**/dist
5555
**/cypress/downloads
5656

5757
# test cases
58-
!packages/enhanced/test/configCases/**/**/node_modules
5958
packages/enhanced/test/js
6059
.ignored
6160
**/.mf
@@ -77,6 +76,8 @@ packages/enhanced/test/js
7776
# Federation
7877
**/.federation
7978
*.ts.timestamp*
79+
*.tsbuildinfo
80+
**/tsconfig.tsbuildinfo
8081

8182
vite.config.*.timestamp*
8283
vitest.config.*.timestamp*
@@ -90,4 +91,12 @@ ssg
9091
.claude
9192
# Native binary files
9293
*.node
94+
__mocks__/
95+
96+
# test mock modules
97+
!packages/enhanced/test/configCases/**/**/node_modules
98+
!packages/enhanced/test/configCases/sharing/share-with-aliases/node_modules/next/dist
99+
!packages/enhanced/test/configCases/sharing/share-with-aliases-provide-only/node_modules/next/dist
93100

101+
!packages/enhanced/test/configCases/**/node_modules/**/dist
102+
!packages/enhanced/test/configCases/**/node_modules/**/dist/**

packages/enhanced/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"ignorePatterns": ["!**/*", "**/*.d.ts"],
44
"overrides": [
55
{
6-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx", ".cjs"],
77
"rules": {
88
"@typescript-eslint/no-explicit-any": "off",
99
"@typescript-eslint/ban-ts-comment": "warn",

packages/enhanced/jest.config.cjs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* eslint-disable */
2+
var { readFileSync } = require('fs');
3+
var path = require('path');
4+
var os = require('os');
5+
var rimraf = require('rimraf');
6+
7+
// Reading the SWC compilation config and remove the "exclude"
8+
// for the test files to be compiled by SWC
9+
var swcJestConfig = JSON.parse(
10+
readFileSync(path.join(__dirname, '.swcrc'), 'utf-8'),
11+
);
12+
13+
rimraf.sync(path.join(__dirname, 'test/js'));
14+
15+
// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig
16+
// ourselves. If we do not disable this, SWC Core will read .swcrc and won't
17+
// transform our test files due to "exclude".
18+
if (swcJestConfig && typeof swcJestConfig.exclude !== 'undefined') {
19+
delete swcJestConfig.exclude;
20+
}
21+
22+
if (swcJestConfig.swcrc === undefined) {
23+
swcJestConfig.swcrc = false;
24+
}
25+
26+
/** @type {import('jest').Config} */
27+
var config = {
28+
displayName: 'enhanced',
29+
preset: '../../jest.preset.js',
30+
cacheDirectory: path.join(os.tmpdir(), 'enhanced'),
31+
transform: {
32+
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
33+
},
34+
moduleFileExtensions: ['ts', 'js', 'html'],
35+
coverageDirectory: '../../coverage/packages/enhanced',
36+
rootDir: __dirname,
37+
testMatch: [
38+
'<rootDir>/test/*.basictest.js',
39+
'<rootDir>/test/unit/**/*.test.ts',
40+
],
41+
silent: true,
42+
verbose: false,
43+
testEnvironment: path.resolve(__dirname, './test/patch-node-env.js'),
44+
setupFilesAfterEnv: ['<rootDir>/test/setupTestFramework.js'],
45+
};
46+
47+
module.exports = config;

packages/enhanced/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"@types/btoa": "^1.2.5",
8888
"ajv": "^8.17.1",
8989
"enhanced-resolve": "^5.0.0",
90+
"memfs": "^4.36.0",
9091
"terser": "^5.37.0"
9192
},
9293
"dependencies": {

packages/enhanced/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"parallel": false,
5050
"commands": [
5151
{
52-
"command": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation ./node_modules/jest-cli/bin/jest --logHeapUsage --config packages/enhanced/jest.config.ts --silent",
52+
"command": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation ./node_modules/jest-cli/bin/jest --logHeapUsage --config packages/enhanced/jest.config.cjs --silent",
5353
"forwardAllArgs": false
5454
}
5555
]

packages/enhanced/src/declarations/plugins/sharing/ConsumeSharedModule.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ export type ConsumeOptions = {
8585
*/
8686
include?: ConsumeSharedModuleIncludeOptions;
8787
/**
88-
* Enable reconstructed lookup for node_modules paths for this share item
88+
* Allow matching against path suffix after node_modules for this share item
8989
*/
90-
nodeModulesReconstructedLookup?: boolean;
90+
allowNodeModulesSuffixMatch?: boolean;
9191
};
9292
const TYPES = new Set(['consume-shared']);

packages/enhanced/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export interface ConsumeSharedPluginOptions {
2525
* Share scope name used for all consumed modules (defaults to 'default').
2626
*/
2727
shareScope?: string | string[];
28+
/**
29+
* Experimental features configuration.
30+
*/
31+
experiments?: {
32+
/** Enable alias-aware consuming via NormalModuleFactory.afterResolve (experimental). */
33+
aliasConsumption?: boolean;
34+
};
2835
}
2936
/**
3037
* Modules that should be consumed from share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.
@@ -92,5 +99,5 @@ export interface ConsumesConfig {
9299
request?: string;
93100
exclude?: IncludeExcludeOptions;
94101
include?: IncludeExcludeOptions;
95-
nodeModulesReconstructedLookup?: boolean;
102+
allowNodeModulesSuffixMatch?: boolean;
96103
}

packages/enhanced/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ export interface ProvidesConfig {
9797
*/
9898
include?: IncludeExcludeOptions;
9999
/**
100-
* Node modules reconstructed lookup.
100+
* Allow matching against path suffix after node_modules.
101101
*/
102-
nodeModulesReconstructedLookup?: any;
102+
allowNodeModulesSuffixMatch?: any;
103103
/**
104104
* Original prefix for prefix matches (internal use).
105105
*/

packages/enhanced/src/declarations/plugins/sharing/SharePlugin.d.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export interface SharePluginOptions {
2525
* Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.
2626
*/
2727
shared: Shared;
28+
/**
29+
* Experimental features configuration.
30+
*/
31+
experiments?: {
32+
/** Enable alias-aware consuming via NormalModuleFactory.afterResolve (experimental). */
33+
aliasConsumption?: boolean;
34+
};
2835
}
2936
/**
3037
* Modules that should be shared in the share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.
@@ -96,9 +103,9 @@ export interface SharedConfig {
96103
*/
97104
include?: IncludeExcludeOptions;
98105
/**
99-
* Node modules reconstructed lookup.
106+
* Allow matching against path suffix after node_modules.
100107
*/
101-
nodeModulesReconstructedLookup?: boolean;
108+
allowNodeModulesSuffixMatch?: boolean;
102109
}
103110

104111
export interface IncludeExcludeOptions {

packages/enhanced/src/lib/container/ContainerEntryModule.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export type ExposeOptions = {
5757
* custom chunk name for the exposed module
5858
*/
5959
name: string;
60+
/**
61+
* optional webpack layer to assign to the exposed module
62+
*/
63+
layer?: string;
6064
};
6165

6266
class ContainerEntryModule extends Module {
@@ -187,6 +191,10 @@ class ContainerEntryModule extends Module {
187191
let idx = 0;
188192
for (const request of options.import) {
189193
const dep = new ContainerExposedDependency(name, request);
194+
// apply per-expose module layer if provided
195+
if (options.layer) {
196+
dep.layer = options.layer;
197+
}
190198
dep.loc = {
191199
name,
192200
index: idx++,

0 commit comments

Comments
 (0)