Skip to content

Commit

Permalink
Updated tests, changed info after transform
Browse files Browse the repository at this point in the history
  • Loading branch information
Amareis committed Oct 30, 2020
1 parent f3234f6 commit 2e2fa6b
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 25 deletions.
3 changes: 2 additions & 1 deletion src/ExternalModule.ts
Expand Up @@ -58,7 +58,8 @@ export default class ExternalModule {
},
isEntry: false,
isExternal: true,
meta
meta,
syntheticNamedExports: false
};
}

Expand Down
1 change: 1 addition & 0 deletions src/Module.ts
Expand Up @@ -805,6 +805,7 @@ export default class Module {
}
if (syntheticNamedExports != null) {
this.syntheticNamedExports = syntheticNamedExports;
this.info.syntheticNamedExports = syntheticNamedExports;
}
if (meta != null) {
this.info.meta = { ...this.info.meta, ...meta };
Expand Down
Expand Up @@ -80,7 +80,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
assert.deepStrictEqual(JSON.parse(JSON.stringify(this.getModuleInfo(ID_DEP))), {
ast: {
Expand Down Expand Up @@ -138,7 +139,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
},
generateBundle(options, bundle) {
Expand Down
Expand Up @@ -76,7 +76,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
assert.deepStrictEqual(JSON.parse(JSON.stringify(this.getModuleInfo(ID_DEP))), {
ast: {
Expand Down Expand Up @@ -134,7 +135,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
},
generateBundle(options, bundle) {
Expand Down
Expand Up @@ -125,7 +125,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
assert.deepStrictEqual(JSON.parse(JSON.stringify(this.getModuleInfo(ID_MAIN2))), {
ast: {
Expand Down Expand Up @@ -219,7 +220,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
assert.deepStrictEqual(JSON.parse(JSON.stringify(this.getModuleInfo(ID_DEP))), {
ast: {
Expand Down Expand Up @@ -312,7 +314,8 @@ module.exports = {
importers: [],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
}
}
Expand Down
Expand Up @@ -75,7 +75,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
assert.deepStrictEqual(JSON.parse(JSON.stringify(this.getModuleInfo(ID_DEP))), {
ast: {
Expand Down Expand Up @@ -133,7 +134,8 @@ module.exports = {
importers: [],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
},
generateBundle(options, bundle) {
Expand Down
12 changes: 8 additions & 4 deletions test/function/samples/deprecated/manual-chunks-info/_config.js
Expand Up @@ -111,7 +111,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: null,
Expand All @@ -126,7 +127,8 @@ module.exports = {
importers: [getId('main')],
isEntry: false,
isExternal: true,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: {
Expand Down Expand Up @@ -154,7 +156,8 @@ module.exports = {
importers: [getId('dynamic'), getId('main')],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: {
Expand Down Expand Up @@ -226,7 +229,8 @@ module.exports = {
importers: [],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
}
]
);
Expand Down
12 changes: 8 additions & 4 deletions test/function/samples/manual-chunks-info/_config.js
Expand Up @@ -110,7 +110,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: null,
Expand All @@ -125,7 +126,8 @@ module.exports = {
importers: [getId('main')],
isEntry: false,
isExternal: true,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: {
Expand Down Expand Up @@ -153,7 +155,8 @@ module.exports = {
importers: [getId('dynamic'), getId('main')],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: {
Expand Down Expand Up @@ -225,7 +228,8 @@ module.exports = {
importers: [],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
}
]
);
Expand Down
6 changes: 4 additions & 2 deletions test/function/samples/module-parsed-hook/_config.js
Expand Up @@ -58,7 +58,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: {
Expand Down Expand Up @@ -102,7 +103,8 @@ module.exports = {
importers: [ID_MAIN],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
}
]);
}
Expand Down
15 changes: 10 additions & 5 deletions test/function/samples/plugin-module-information/_config.js
Expand Up @@ -27,7 +27,8 @@ module.exports = {
importers: [],
isEntry: id === ID_MAIN,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
});
},
renderStart() {
Expand Down Expand Up @@ -172,7 +173,8 @@ module.exports = {
importers: [],
isEntry: true,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: {
Expand Down Expand Up @@ -247,7 +249,8 @@ module.exports = {
importers: [ID_MAIN, ID_NESTED],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: null,
Expand All @@ -262,7 +265,8 @@ module.exports = {
importers: [ID_FOO],
isEntry: false,
isExternal: true,
meta: {}
meta: {},
syntheticNamedExports: false
},
{
ast: {
Expand Down Expand Up @@ -340,7 +344,8 @@ module.exports = {
importers: [],
isEntry: false,
isExternal: false,
meta: {}
meta: {},
syntheticNamedExports: false
}
]
);
Expand Down
Expand Up @@ -9,6 +9,11 @@ module.exports = {
if (id.endsWith('dep.js')) {
return { code, syntheticNamedExports: '__synthetic' };
}
},
moduleParsed({id, syntheticNamedExports}) {
if (id.endsWith('dep.js')) {
assert.strictEqual(syntheticNamedExports, '__synthetic');
}
}
}
]
Expand Down

0 comments on commit 2e2fa6b

Please sign in to comment.