@web/dev-server-rollup
Advanced tools
Comparing version 0.0.2 to 0.1.0
# @web/dev-server-rollup | ||
## 0.1.0 | ||
### Minor Changes | ||
- c4cb321: Use web dev server in test runner. This contains multiple breaking changes: | ||
- Browsers that don't support es modules are not supported for now. We will add this back later. | ||
- Most es-dev-server config options are no longer available. The only options that are kept are `plugins`, `middleware`, `nodeResolve` and `preserveSymlinks`. | ||
- Test runner config changes: | ||
- Dev server options are not available on the root level of the configuration file. | ||
- `nodeResolve` is no longer enabled by default. You can enable it with the `--node-resolve` flag or `nodeResolve` option. | ||
- `middlewares` option is now called `middleware`. | ||
- `testFrameworkImport` is now called `testFramework`. | ||
- `address` is now split into `protocol` and `hostname`. | ||
### Patch Changes | ||
- Updated dependencies [c4cb321] | ||
- @web/dev-server-core@0.1.0 | ||
## 0.0.2 | ||
@@ -4,0 +24,0 @@ |
@@ -1,4 +0,4 @@ | ||
import { Config, FSWatcher, Plugin as WdsPlugin, Context } from '@web/dev-server-core'; | ||
import { DevServerCoreConfig, FSWatcher, Plugin as WdsPlugin, Context } from '@web/dev-server-core'; | ||
import { PluginContext, MinimalPluginContext, TransformPluginContext } from 'rollup'; | ||
export declare function createRollupPluginContextAdapter<T extends PluginContext | MinimalPluginContext | TransformPluginContext>(pluginContext: T, wdsPlugin: WdsPlugin, config: Config, fileWatcher: FSWatcher, context: Context): T & { | ||
export declare function createRollupPluginContextAdapter<T extends PluginContext | MinimalPluginContext | TransformPluginContext>(pluginContext: T, wdsPlugin: WdsPlugin, config: DevServerCoreConfig, fileWatcher: FSWatcher, context: Context): T & { | ||
addWatchFile(id: string): void; | ||
@@ -5,0 +5,0 @@ emitAsset(): never; |
@@ -52,2 +52,12 @@ "use strict"; | ||
const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.pluginContext, wdsPlugin, config, fileWatcher, context); | ||
let resolvableImport = source; | ||
let importSuffix = ''; | ||
// we have to special case node-resolve because it doesn't support resolving | ||
// with hash/params at the moment | ||
if (rollupPlugin.name === 'node-resolve') { | ||
const [withoutHash, hash] = source.split('#'); | ||
const [importPath, params] = withoutHash.split('?'); | ||
importSuffix = `${params ? `?${params}` : ''}${hash ? `#${hash}` : ''}`; | ||
resolvableImport = importPath; | ||
} | ||
// if the import was already a fully resolved file path, it was probably injected by a plugin. | ||
@@ -58,4 +68,4 @@ // in that case use that instead of resolving it through a plugin hook. this puts the resolved file | ||
const result = injectedFilePath | ||
? source | ||
: await ((_a = rollupPlugin.resolveId) === null || _a === void 0 ? void 0 : _a.call(rollupPluginContext, source, filePath)); | ||
? resolvableImport | ||
: await ((_a = rollupPlugin.resolveId) === null || _a === void 0 ? void 0 : _a.call(rollupPluginContext, resolvableImport, filePath)); | ||
let resolvedImportFilePath = undefined; | ||
@@ -80,14 +90,12 @@ if (typeof result === 'string') { | ||
const prefixedImportPath = resolvedImportPath.startsWith('/') || resolvedImportPath.startsWith('.') | ||
? resolvedImportPath | ||
: `./${resolvedImportPath}`; | ||
? `${resolvedImportPath}${importSuffix}` | ||
: `./${resolvedImportPath}${importSuffix}`; | ||
if (!hasNullByte) { | ||
return prefixedImportPath; | ||
} | ||
else { | ||
const suffix = `${NULL_BYTE_PARAM}=${encodeURIComponent(resolvedImportFilePath)}`; | ||
if (prefixedImportPath.includes('?')) { | ||
return `${prefixedImportPath}&${suffix}`; | ||
} | ||
return `${prefixedImportPath}?${suffix}`; | ||
const suffix = `${NULL_BYTE_PARAM}=${encodeURIComponent(resolvedImportFilePath)}`; | ||
if (prefixedImportPath.includes('?')) { | ||
return `${prefixedImportPath}&${suffix}`; | ||
} | ||
return `${prefixedImportPath}?${suffix}`; | ||
} | ||
@@ -100,3 +108,3 @@ // if the resolved import includes a null byte (\0) there is some special logic | ||
} | ||
return resolvedImportFilePath; | ||
return `${resolvedImportFilePath}${importSuffix}`; | ||
}, | ||
@@ -103,0 +111,0 @@ async serve(context) { |
{ | ||
"name": "@web/dev-server-rollup", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"publishConfig": { | ||
@@ -41,4 +41,4 @@ "access": "public" | ||
"dependencies": { | ||
"@web/dev-server-core": "^0.0.3", | ||
"rollup": "^2.18.2", | ||
"@web/dev-server-core": "^0.1.0", | ||
"rollup": "^2.20.0", | ||
"whatwg-url": "^8.1.0" | ||
@@ -45,0 +45,0 @@ }, |
@@ -24,5 +24,3 @@ # Dev Server Rollup | ||
module.exports = { | ||
plugins: [ | ||
wrapRollupPlugin(replace({ include: ['src/**/*.js'], __environment__: '"development"' })), | ||
], | ||
plugins: [rollupAdapter(replace({ include: ['src/**/*.js'], __environment__: '"development"' }))], | ||
}; | ||
@@ -33,3 +31,3 @@ ``` | ||
Some rollup plugins do expensive operations. During development, this matters a lot more than during a production build. It's recommended to always scope the usage of plugins using the `include` and/or `exclude` options. | ||
Some rollup plugins do expensive operations. During development, this matters a lot more than during a production build. It's recommended to always scope the usage of plugins using the `include` and/or `exclude` options available in most rollup plugins. | ||
@@ -48,2 +46,3 @@ ## non-standard file types | ||
name: 'json-mime-type-plugin', | ||
resolveMimeType(context) { | ||
@@ -55,2 +54,3 @@ if (context.path.endsWith('.json')) { | ||
}, | ||
rollupAdapter(json()), | ||
@@ -57,0 +57,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32378
321
+ Added@web/dev-server-core@0.1.9(transitive)
- Removed@ampproject/remapping@2.3.0(transitive)
- Removed@babel/code-frame@7.24.7(transitive)
- Removed@babel/compat-data@7.25.4(transitive)
- Removed@babel/core@7.25.2(transitive)
- Removed@babel/generator@7.25.6(transitive)
- Removed@babel/helper-compilation-targets@7.25.2(transitive)
- Removed@babel/helper-module-imports@7.24.7(transitive)
- Removed@babel/helper-module-transforms@7.25.2(transitive)
- Removed@babel/helper-plugin-utils@7.24.8(transitive)
- Removed@babel/helper-simple-access@7.24.7(transitive)
- Removed@babel/helper-string-parser@7.24.8(transitive)
- Removed@babel/helper-validator-identifier@7.24.7(transitive)
- Removed@babel/helper-validator-option@7.24.8(transitive)
- Removed@babel/helpers@7.25.6(transitive)
- Removed@babel/highlight@7.24.7(transitive)
- Removed@babel/parser@7.25.6(transitive)
- Removed@babel/plugin-syntax-dynamic-import@7.8.3(transitive)
- Removed@babel/template@7.25.0(transitive)
- Removed@babel/traverse@7.25.6(transitive)
- Removed@babel/types@7.25.6(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@open-wc/building-utils@2.21.1(transitive)
- Removed@types/lru-cache@5.1.1(transitive)
- Removed@web/dev-server-core@0.0.3(transitive)
- Removed@webcomponents/shadycss@1.11.2(transitive)
- Removed@webcomponents/webcomponentsjs@2.8.0(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedarrify@2.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.112.0.1(transitive)
- Removedbrowserslist@4.24.0(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcamel-case@4.1.2(transitive)
- Removedcaniuse-lite@1.0.30001664(transitive)
- Removedchalk@2.4.2(transitive)
- Removedclean-css@4.2.45.3.3(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcommander@2.20.34.1.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconvert-source-map@2.0.0(transitive)
- Removedcore-js-bundle@3.38.1(transitive)
- Removeddeepmerge@4.3.1(transitive)
- Removeddot-case@3.0.4(transitive)
- Removedelectron-to-chromium@1.5.29(transitive)
- Removedentities@4.5.0(transitive)
- Removedes-module-shims@1.10.0(transitive)
- Removedescalade@3.2.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedgensync@1.0.0-beta.2(transitive)
- Removedglob@7.2.3(transitive)
- Removedglobals@11.12.0(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhe@1.2.0(transitive)
- Removedhtml-minifier-terser@5.1.1(transitive)
- Removedinflight@1.0.6(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjsesc@2.5.2(transitive)
- Removedjson5@2.2.3(transitive)
- Removedlodash.sortby@4.7.0(transitive)
- Removedlower-case@2.0.2(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedminimatch@3.1.27.4.6(transitive)
- Removedno-case@3.0.4(transitive)
- Removednode-releases@2.0.18(transitive)
- Removedonce@1.4.0(transitive)
- Removedparam-case@3.0.4(transitive)
- Removedparse5@7.1.2(transitive)
- Removedpascal-case@3.1.2(transitive)
- Removedpath-is-inside@1.0.2(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpicocolors@1.1.0(transitive)
- Removedregenerator-runtime@0.13.11(transitive)
- Removedrelateurl@0.2.7(transitive)
- Removedresolve@1.22.8(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsemver@6.3.1(transitive)
- Removedshady-css-scoped-element@0.0.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedsystemjs@6.15.1(transitive)
- Removedterser@4.8.1(transitive)
- Removedto-fast-properties@2.0.0(transitive)
- Removedtr46@1.0.1(transitive)
- Removedtslib@2.7.0(transitive)
- Removedupdate-browserslist-db@1.1.0(transitive)
- Removedvalid-url@1.0.9(transitive)
- Removedwebidl-conversions@4.0.2(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
- Removedwhatwg-url@7.1.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyallist@4.0.0(transitive)
Updated@web/dev-server-core@^0.1.0
Updatedrollup@^2.20.0