-
Notifications
You must be signed in to change notification settings - Fork 45
feat: perform full processing in a worker #43
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
Changes from all commits
a7226df
c3e0794
86ec796
c4e90de
7e92100
1024b62
b140a5a
cd60fca
5c4492c
ccb7456
4241c46
a87b0b5
5af677f
445f8f4
c64d70f
5e74a6c
2d988b9
63c1185
ebbc4b9
6ffcf90
209e983
c31c0b9
e4412c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| const defaultConfig = require('@stoplight/storybook-config/webpack.config'); | ||
| const path = require('path'); | ||
|
|
||
| module.exports = (baseConfig, env, config) => { | ||
| config = defaultConfig(baseConfig, env, config); | ||
|
|
||
| config.output.globalObject = 'this'; | ||
| config.resolve.alias['web-worker:../workers/schema.ts'] = path.join(process.cwd(), './src/__stories__/worker.shim.ts'); | ||
|
|
||
| return config; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| 'plugins': ['@babel/plugin-transform-modules-commonjs'], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you write a paragraph explaining why we need to add Babel to the ever-growing-list-of-compilers we need to support? Looks like it's only used by Jest?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hang on I just realized this isn't
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because of of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see we replaced
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rollup does not really like CJS modules, so this is the primary reason. |
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,24 @@ | ||
| module.exports = { | ||
| preset: "@stoplight/scripts", | ||
| testEnvironment: "jsdom", | ||
| setupFilesAfterEnv: ["./setupTests.ts"], | ||
| snapshotSerializers: ["enzyme-to-json/serializer"], | ||
| rootDir: process.cwd(), | ||
| testEnvironment: 'jsdom', | ||
| setupFilesAfterEnv: ['./setupTests.ts'], | ||
| moduleNameMapper: { | ||
| "\\.(css)$": "<rootDir>/__mocks__/styleMock.js" | ||
| } | ||
| '\\.css$': '<rootDir>/__mocks__/styleMock.js', | ||
| 'web-worker:\\.\\./(.+)$': '<rootDir>/src/$1' | ||
| }, | ||
| testMatch: ['<rootDir>/src/**/__tests__/*.(ts|js)?(x)'], | ||
| transformIgnorePatterns: ['/node_modules/(?!lodash-es)/'], | ||
| transform: { | ||
| '\\.tsx?$': 'ts-jest', | ||
| '^.+\\.js$': 'babel-jest' | ||
| }, | ||
| coveragePathIgnorePatterns: ['/node_modules/', '/__tests__/', '/__stories__/', '__mocks__/', 'types.ts'], | ||
| collectCoverageFrom: ['src/**/*.{ts,tsx}'], | ||
| globals: { | ||
| 'ts-jest': { | ||
| diagnostics: { | ||
| ignoreCodes: [151001], | ||
| }, | ||
| }, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import config from '@stoplight/scripts/rollup.config'; | ||
| import webWorkerLoader from 'rollup-plugin-web-worker-loader'; | ||
| import resolve from 'rollup-plugin-node-resolve'; | ||
| import commonjs from 'rollup-plugin-commonjs'; | ||
|
|
||
| config.plugins.push( | ||
| commonjs(), | ||
| resolve({ | ||
| only: ['json-schema-merge-allof', /lodash(?:-es)?\/?.*/], | ||
| }), | ||
| webWorkerLoader({ | ||
| inline: true, | ||
| }), | ||
| ); | ||
|
|
||
| export default config; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import Worker from 'worker-loader!../workers/schema.ts'; | ||
|
|
||
| export default Worker; |
Uh oh!
There was an error while loading. Please reload this page.