Socket
Socket
Sign inDemoInstall

@web/dev-server-rollup

Package Overview
Dependencies
Maintainers
6
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web/dev-server-rollup - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

6

CHANGELOG.md
# @web/dev-server-rollup
## 0.1.4
### Patch Changes
- 1c915d0: handle inline scripts
## 0.1.3

@@ -4,0 +10,0 @@

31

dist/rollupAdapter.js

@@ -11,2 +11,4 @@ "use strict";

const dev_server_core_1 = require("@web/dev-server-core");
const dom5_1 = require("@web/dev-server-core/dist/dom5");
const parse5_1 = require("parse5");
const url_1 = require("url");

@@ -156,3 +158,3 @@ const chalk_1 = require("chalk");

async transform(context) {
var _a;
var _a, _b;
if (!rollupPlugin.transform) {

@@ -183,2 +185,29 @@ return;

}
if (context.response.is('html')) {
const documentAst = parse5_1.parse(context.body);
const inlineModuleNodes = dom5_1.queryAll(documentAst, dom5_1.predicates.AND(dom5_1.predicates.hasTagName('script'), dom5_1.predicates.hasAttrValue('type', 'module'), dom5_1.predicates.NOT(dom5_1.predicates.hasAttr('src'))));
const filePath = resolveFilePath(rootDir, context.path);
try {
for (const node of inlineModuleNodes) {
const code = dom5_1.getTextContent(node);
const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context);
const result = await ((_b = rollupPlugin.transform) === null || _b === void 0 ? void 0 : _b.call(rollupPluginContext, code, filePath));
let transformedCode = undefined;
if (typeof result === 'string') {
transformedCode = result;
}
if (typeof result === 'object' && typeof (result === null || result === void 0 ? void 0 : result.code) === 'string') {
transformedCode = result.code;
}
if (transformedCode) {
transformedFiles.add(context.path);
context.body = context.body.replace(code, transformedCode);
}
}
return context.body;
}
catch (error) {
throw wrapRollupError(filePath, context, error);
}
}
},

@@ -185,0 +214,0 @@ };

2

package.json
{
"name": "@web/dev-server-rollup",
"version": "0.1.3",
"version": "0.1.4",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc