@web/dev-server-rollup
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -47,3 +47,4 @@ "use strict"; | ||
fileWatcher.add(filePath); | ||
}, emitAsset() { | ||
}, | ||
emitAsset() { | ||
throw new Error('Emitting files is not yet supported'); | ||
@@ -62,3 +63,4 @@ }, | ||
throw new Error('Emitting files is not yet supported'); | ||
}, async resolve(source, importer, options) { | ||
}, | ||
async resolve(source, importer, options) { | ||
var _a, _b; | ||
@@ -65,0 +67,0 @@ if (!context) |
@@ -14,3 +14,3 @@ "use strict"; | ||
let transformPluginContext = undefined; | ||
await rollup_1.rollup(Object.assign(Object.assign({}, inputOptions), { input: 'noop', plugins: [ | ||
await (0, rollup_1.rollup)(Object.assign(Object.assign({}, inputOptions), { input: 'noop', plugins: [ | ||
{ | ||
@@ -17,0 +17,0 @@ name: 'noop', |
import { InputOptions, Plugin as RollupPlugin } from 'rollup'; | ||
declare type FnArgs = readonly unknown[]; | ||
declare type RollupPluginFn<T extends FnArgs> = (...args: T) => RollupPlugin; | ||
type FnArgs = readonly unknown[]; | ||
type RollupPluginFn<T extends FnArgs> = (...args: T) => RollupPlugin; | ||
export interface FromRollupOptions { | ||
@@ -5,0 +5,0 @@ throwOnUnresolvedImport?: boolean; |
@@ -14,3 +14,3 @@ "use strict"; | ||
// wrap the rollup plugin in an adapter for web dev server | ||
return rollupAdapter_1.rollupAdapter(rollupPlugin, rollupInputOptions, options); | ||
return (0, rollupAdapter_1.rollupAdapter)(rollupPlugin, rollupInputOptions, options); | ||
}; | ||
@@ -17,0 +17,0 @@ } |
@@ -61,3 +61,3 @@ "use strict"; | ||
({ rootDir } = config); | ||
rollupPluginContexts = await createRollupPluginContexts_1.createRollupPluginContexts(rollupInputOptions); | ||
rollupPluginContexts = await (0, createRollupPluginContexts_1.createRollupPluginContexts)(rollupInputOptions); | ||
idResolvers = []; | ||
@@ -122,5 +122,5 @@ // call the options and buildStart hooks | ||
} | ||
const filePath = dev_server_core_1.getRequestFilePath(context.url, rootDir); | ||
const filePath = (0, dev_server_core_1.getRequestFilePath)(context.url, rootDir); | ||
try { | ||
const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.pluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
const rollupPluginContext = (0, createRollupPluginContextAdapter_1.createRollupPluginContextAdapter)(rollupPluginContexts.pluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
let resolvableImport = source; | ||
@@ -173,3 +173,3 @@ let importSuffix = ''; | ||
adapterOptions.throwOnUnresolvedImport) { | ||
const errorMessage = nanocolors_1.red(`Could not resolve import ${nanocolors_1.cyan(`"${source}"`)}.`); | ||
const errorMessage = (0, nanocolors_1.red)(`Could not resolve import ${(0, nanocolors_1.cyan)(`"${source}"`)}.`); | ||
if (typeof code === 'string' && | ||
@@ -201,7 +201,7 @@ typeof column === 'number' && | ||
// some plugins don't return a file path, so we just return it as is | ||
if (!utils_1.isAbsoluteFilePath(resolvedImportPath)) { | ||
if (!(0, utils_1.isAbsoluteFilePath)(resolvedImportPath)) { | ||
return `${resolvedImportPath}`; | ||
} | ||
// file already resolved outsided root dir | ||
if (utils_1.isOutsideRootDir(resolvedImportPath)) { | ||
if ((0, utils_1.isOutsideRootDir)(resolvedImportPath)) { | ||
return `${resolvedImportPath}`; | ||
@@ -220,4 +220,4 @@ } | ||
// we expect the relative part to consist of only ../ or ..\\ | ||
const errorMessage = nanocolors_1.red(`\n\nResolved ${nanocolors_1.cyan(source)} to ${nanocolors_1.cyan(resolvedImportPath)}.\n\n`) + | ||
nanocolors_1.red('This path could not be converted to a browser path. Please file an issue with a reproduction.'); | ||
const errorMessage = (0, nanocolors_1.red)(`\n\nResolved ${(0, nanocolors_1.cyan)(source)} to ${(0, nanocolors_1.cyan)(resolvedImportPath)}.\n\n`) + | ||
(0, nanocolors_1.red)('This path could not be converted to a browser path. Please file an issue with a reproduction.'); | ||
if (typeof code === 'string' && | ||
@@ -232,9 +232,9 @@ typeof column === 'number' && | ||
} | ||
const importPath = utils_1.toBrowserPath(relativePath.substring(lastDirUpIndex)); | ||
const importPath = (0, utils_1.toBrowserPath)(relativePath.substring(lastDirUpIndex)); | ||
resolvedImportPath = `/__wds-outside-root__/${dirUpStrings.length - 1}/${importPath}`; | ||
} | ||
else { | ||
const resolveRelativeTo = path_1.default.extname(filePath) ? path_1.default.dirname(filePath) : filePath; | ||
const resolveRelativeTo = path_1.default.dirname(filePath); | ||
const relativeImportFilePath = path_1.default.relative(resolveRelativeTo, resolvedImportPath); | ||
resolvedImportPath = `./${utils_1.toBrowserPath(relativeImportFilePath)}`; | ||
resolvedImportPath = `./${(0, utils_1.toBrowserPath)(relativeImportFilePath)}`; | ||
} | ||
@@ -267,3 +267,3 @@ return `${resolvedImportPath}${importSuffix}`; | ||
try { | ||
const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.pluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
const rollupPluginContext = (0, createRollupPluginContextAdapter_1.createRollupPluginContextAdapter)(rollupPluginContexts.pluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
let result; | ||
@@ -297,3 +297,3 @@ if (typeof rollupPlugin.load === 'function') { | ||
try { | ||
const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
const rollupPluginContext = (0, createRollupPluginContextAdapter_1.createRollupPluginContextAdapter)(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
let result; | ||
@@ -322,10 +322,10 @@ if (typeof rollupPlugin.transform === 'function') { | ||
if (context.response.is('html')) { | ||
const documentAst = parse5_1.parse(context.body); | ||
const inlineScripts = dom5_1.queryAll(documentAst, dom5_1.predicates.AND(dom5_1.predicates.hasTagName('script'), dom5_1.predicates.NOT(dom5_1.predicates.hasAttr('src')))); | ||
const filePath = dev_server_core_1.getRequestFilePath(context.url, rootDir); | ||
const documentAst = (0, parse5_1.parse)(context.body); | ||
const inlineScripts = (0, dom5_1.queryAll)(documentAst, dom5_1.predicates.AND(dom5_1.predicates.hasTagName('script'), dom5_1.predicates.NOT(dom5_1.predicates.hasAttr('src')))); | ||
const filePath = (0, dev_server_core_1.getRequestFilePath)(context.url, rootDir); | ||
let transformed = false; | ||
try { | ||
for (const node of inlineScripts) { | ||
const code = dom5_1.getTextContent(node); | ||
const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
const code = (0, dom5_1.getTextContent)(node); | ||
const rollupPluginContext = (0, createRollupPluginContextAdapter_1.createRollupPluginContextAdapter)(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
let result; | ||
@@ -345,3 +345,3 @@ if (typeof rollupPlugin.transform === 'function') { | ||
transformedFiles.add(context.path); | ||
dom5_1.setTextContent(node, transformedCode); | ||
(0, dom5_1.setTextContent)(node, transformedCode); | ||
transformed = true; | ||
@@ -351,3 +351,3 @@ } | ||
if (transformed) { | ||
return parse5_1.serialize(documentAst); | ||
return (0, parse5_1.serialize)(documentAst); | ||
} | ||
@@ -365,4 +365,4 @@ } | ||
} | ||
const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
const filePath = dev_server_core_1.getRequestFilePath(context.url, rootDir); | ||
const rollupPluginContext = (0, createRollupPluginContextAdapter_1.createRollupPluginContextAdapter)(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context, pluginMetaPerModule); | ||
const filePath = (0, dev_server_core_1.getRequestFilePath)(context.url, rootDir); | ||
const info = rollupPluginContext.getModuleInfo(filePath); | ||
@@ -369,0 +369,0 @@ if (!info) |
@@ -10,3 +10,3 @@ "use strict"; | ||
async function bundleEntrypoints(rollupConfig) { | ||
const bundle = await rollup_1.rollup(rollupConfig); | ||
const bundle = await (0, rollup_1.rollup)(rollupConfig); | ||
if (Array.isArray(rollupConfig.output)) { | ||
@@ -13,0 +13,0 @@ throw new Error('Multiple outputs not supported.'); |
{ | ||
"name": "@web/dev-server-rollup", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"publishConfig": { | ||
@@ -61,7 +61,7 @@ "access": "public" | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-commonjs": "24.0.1", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"@types/parse5": "^6.0.1", | ||
"@types/whatwg-url": "^11.0.0", | ||
"@web/test-runner-chrome": "^0.13.0", | ||
"@web/test-runner-chrome": "^0.13.1", | ||
"@web/test-runner-core": "^0.11.0", | ||
@@ -68,0 +68,0 @@ "chai": "^4.2.0", |
@@ -320,3 +320,3 @@ /* eslint-disable no-control-regex */ | ||
} else { | ||
const resolveRelativeTo = path.extname(filePath) ? path.dirname(filePath) : filePath; | ||
const resolveRelativeTo = path.dirname(filePath); | ||
const relativeImportFilePath = path.relative(resolveRelativeTo, resolvedImportPath); | ||
@@ -323,0 +323,0 @@ resolvedImportPath = `./${toBrowserPath(relativeImportFilePath)}`; |
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
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
88402
1428