Skip to content

feat(typedoc-parsetr): python script implementation #1248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/out-tsc
/build
/@mf-types
/docs

# dependencies
node_modules
Expand Down
16 changes: 6 additions & 10 deletions apps/docs/src/en/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@
* xref:component-level-ownership.adoc[Component Level Ownership]
* xref:brown-green.adoc[]











.Packages
* xref:module-federation-node.adoc[@module-federation/node]
* xref:module-federation-typescript.adoc[@module-federation/typescript - v2.4.2]
* xref:module-federation-utilities.adoc[@module-federation/utilities]
* xref:module-federation-native-federation-typescript.adoc[@module-federation/native-federation-typescript - v0.2.6]
* xref:module-federation-native-federation-tests.adoc[@module-federation/native-federation-tests - v0.2.1]

Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
= @module-federation/native-federation-tests - v0.2.1

= native-federation-tests

Bundler agnostic plugins to share federated components for testing purposes.

It aims to work for both https://vitest.dev/[vitest] and https://vitest.dev/[vitest] https://jestjs.io/[jest] .

== Install

[source, javascript]
----
npm i -D @module-federation/native-federation-tests

----

This module provides two plugins:

=== NativeFederationTestsRemote

This plugin is used to concat the components that will be used in tests.

==== Configuration

[source, javascript]
----
{
moduleFederationConfig: any; // the same configuration provided to the module federation plugin, it is MANDATORY
additionalBundlerConfig?: TsupOptions; // additional `tsup` build options that will be merged with the one generated by the plugin, default is {}
distFolder?: string; // folder used to store the dist, default is './dist'
testsFolder?: string; // folder where all the files will be stored, default is '@mf-tests'
deleteTestsFolder?: boolean; // indicate if the concatenated components folder will be deleted when the job completes, default is 'true'
}

----

==== Additional configuration

Note that, for Webpack, the plugin automatically inject the `devServer.static.directory` configuration.For the other bundlers, you should configure it by yourself.

=== NativeFederationTestsHost

This plugin is used to download the concatenated components mock that will be used for tests.

=== Configuration

[source, javascript]
----
{
moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
testsFolder?: string; // folder where all the files have been stored, default is '@mf-tests',
mocksFolder?: string; // folder where the concatenated files will be stored, default is './ mocks ',
deleteTestsFolder?: boolean; // indicate if the tests mock folder will be deleted before the job starts, default is 'true'
}

----

== Bundler configuration

[source, javascript]
----
// vite.config.ts
import {NativeFederationTestsHost, NativeFederationTestsRemote} from '@module-federation/native-federation-tests/vite'
export default defineConfig({
plugins: [
NativeFederationTestsRemote({ /* options */ }),
NativeFederationTestsHost({ /* options */ }),
],
/* ... */
server: { // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
/* ... */
proxy: {
'/@mf-types.zip': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`
}
},
fs: {
/* ... */
allow: ['./dist']
/* ... */
}
}
})

----

[source, javascript]
----
// rollup.config.js
import {NativeFederationTestsHost, NativeFederationTestsRemote} from '@module-federation/native-federation-tests/rollup'
export default {
plugins: [
NativeFederationTestsRemote({ /* options */ }),
NativeFederationTestsHost({ /* options */ }),
],
}

----

[source, javascript]
----
// webpack.config.js
const {NativeFederationTestsHost, NativeFederationTestsRemote} = require('@module-federation/native-federation-tests/webpack')
module.exports = {
/* ... */
plugins: [
NativeFederationTestsRemote({ /* options */ }),
NativeFederationTestsHost({ /* options */ })
]
}

----

[source, javascript]
----
// esbuild.config.js
import { build } from 'esbuild'
import {NativeFederationTestsHost, NativeFederationTestsRemote} from '@module-federation/native-federation-tests/esbuild'
build({
plugins: [
NativeFederationTestsRemote({ /* options */ }),
NativeFederationTestsHost({ /* options */ })
],
})

----

[source, javascript]
----
// rspack.config.js
const {NativeFederationTestsHost, NativeFederationTestsRemote} = require('@module-federation/native-federation-tests/rspack')
module.exports = {
/* ... */
plugins: [
NativeFederationTestsRemote({ /* options */ }),
NativeFederationTestsHost({ /* options */ })
]
}

----

== Examples

To use it in a `host` module, refer to https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/host[this example] .To use it in a `remote` module, refer to https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/host[this example] https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/remote[this example] .

Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
= @module-federation/native-federation-typescript - v0.2.6

= native-federation-typescript

Bundler agnostic plugins to share federated types.

== Install

[source, javascript]
----
npm i -D @module-federation/native-federation-typescript

----

This module provides two plugins:

=== NativeFederationTypeScriptRemote

This plugin is used to build the federated types.

==== Configuration

[source, javascript]
----
{
moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
tsConfigPath?: string; // path where the tsconfig file is located, default is ''./tsconfig.json'
typesFolder?: string; // folder where all the files will be stored, default is '@mf-types',
compiledTypesFolder?: string; // folder where the federated modules types will be stored, default is 'compiled-types'
deleteTypesFolder?: boolean; // indicate if the types folder will be deleted when the job completes, default is 'true'
additionalFilesToCompile?: string[] // The path of each additional file which should be emitted
compilerInstance?: 'tsc' | 'vue-tsc' // The compiler to use to emit files, default is 'tsc'
}

----

==== Additional configuration

Note that, for Webpack, the plugin automatically inject the `devServer.static.directory` configuration.For the other bundlers, you should configure it by yourself.

=== NativeFederationTypeScriptHost

This plugin is used to download the federated types.

=== Configuration

[source, javascript]
----
{
moduleFederationConfig: any; // the configuration same configuration provided to the module federation plugin, it is MANDATORY
typesFolder?: string; // folder where all the files will be stored, default is '@mf-types',
deleteTypesFolder?: boolean; // indicate if the types folder will be deleted before the job starts, default is 'true'
}

----

== Bundler configuration

[source, javascript]
----
// vite.config.ts
import {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} from '@module-federation/native-federation-typescript/vite'
export default defineConfig({
plugins: [
NativeFederationTypeScriptRemote({ /* options */ }),
NativeFederationTypeScriptHost({ /* options */ }),
],
/* ... */
server: { // This is needed to emulate the devServer.static.directory of WebPack and correctly serve the zip file
/* ... */
proxy: {
'/@mf-types.zip': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: () => `/@fs/${process.cwd()}/dist/@mf-types.zip`
}
},
fs: {
/* ... */
allow: ['./dist']
/* ... */
}
}
})

----

[source, javascript]
----
// rollup.config.js
import {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} from '@module-federation/native-federation-typescript/rollup'
export default {
plugins: [
NativeFederationTypeScriptRemote({ /* options */ }),
NativeFederationTypeScriptHost({ /* options */ }),
],
}

----

[source, javascript]
----
// webpack.config.js
const {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} = require('@module-federation/native-federation-typescript/webpack')
module.exports = {
/* ... */
plugins: [
NativeFederationTypeScriptRemote({ /* options */ }),
NativeFederationTypeScriptHost({ /* options */ })
]
}

----

[source, javascript]
----
// esbuild.config.js
import { build } from 'esbuild'
import {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} from '@module-federation/native-federation-typescript/esbuild'
build({
plugins: [
NativeFederationTypeScriptRemote({ /* options */ }),
NativeFederationTypeScriptHost({ /* options */ })
],
})

----

[source, javascript]
----
// rspack.config.js
const {NativeFederationTypeScriptHost, NativeFederationTypeScriptRemote} = require('@module-federation/native-federation-typescript/rspack')
module.exports = {
/* ... */
plugins: [
NativeFederationTypeScriptRemote({ /* options */ }),
NativeFederationTypeScriptHost({ /* options */ })
]
}

----

== TypeScript configuration

To have the type definitions automatically found for imports, add paths to the `compilerOptions` in the `tsconfig.json`:

[source, javascript]
----
{
"paths": {
"*": ["./@mf-types/*"]
}
}

----

== Examples

To use it in a `host` module, refer to https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/host[this example] .To use it in a `remote` module, refer to https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/host[this example] https://github.com/module-federation/module-federation-examples/tree/master/native-federation-tests-typescript-plugins/remote[this example] .

Loading