Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web/dev-server-core

Package Overview
Dependencies
Maintainers
7
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.2.12 to 0.2.13

dist/server/addPlugins.d.ts

6

CHANGELOG.md
# @web/dev-server-core
## 0.2.13
### Patch Changes
- e8ebfcc: ensure user plugins are run after builtin plugins
## 0.2.12

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

10

dist/plugins/transformModuleImportsPlugin.js

@@ -168,8 +168,14 @@ "use strict";

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'))));
let transformed = false;
for (const node of inlineModuleNodes) {
const code = dom5_1.getTextContent(node);
const resolvedCode = await transformModuleImportsWithPlugins(context, code, rootDir, importPlugins);
dom5_1.setTextContent(node, resolvedCode);
if (code !== resolvedCode) {
dom5_1.setTextContent(node, resolvedCode);
transformed = true;
}
}
return { body: parse5_1.serialize(documentAst) };
if (transformed) {
return { body: parse5_1.serialize(documentAst) };
}
}

@@ -176,0 +182,0 @@ },

8

dist/server/createServer.js

@@ -14,3 +14,3 @@ "use strict";

const createMiddleware_1 = require("./createMiddleware");
const createPlugins_1 = require("./createPlugins");
const addPlugins_1 = require("./addPlugins");
/**

@@ -31,7 +31,3 @@ * A request handler that returns a 301 HTTP Redirect to the same location as the original

const app = new koa_1.default();
const plugins = createPlugins_1.createPlugins(cfg);
if (!cfg.plugins) {
cfg.plugins = [];
}
cfg.plugins.push(...plugins);
addPlugins_1.addPlugins(cfg);
// special case the legacy plugin, if it is given make sure the resolve module imports plugin

@@ -38,0 +34,0 @@ // runs before the legacy plugin because it compiles away module syntax. ideally we have a

{
"name": "@web/dev-server-core",
"version": "0.2.12",
"version": "0.2.13",
"publishConfig": {

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

@@ -130,3 +130,2 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

// static import
const importSpecifier = code.substring(start, end);

@@ -262,2 +261,3 @@ const lines = code.slice(0, end).split('\n');

);
let transformed = false;

@@ -272,6 +272,11 @@ for (const node of inlineModuleNodes) {

);
setTextContent(node, resolvedCode);
if (code !== resolvedCode) {
setTextContent(node, resolvedCode);
transformed = true;
}
}
return { body: serializeHtml(documentAst) };
if (transformed) {
return { body: serializeHtml(documentAst) };
}
}

@@ -278,0 +283,0 @@ },

@@ -12,3 +12,3 @@ import Koa from 'koa';

import { Logger } from '../logger/Logger';
import { createPlugins } from './createPlugins';
import { addPlugins } from './addPlugins';

@@ -32,7 +32,3 @@ /**

const plugins = createPlugins(cfg);
if (!cfg.plugins) {
cfg.plugins = [];
}
cfg.plugins.push(...plugins);
addPlugins(cfg);

@@ -42,9 +38,9 @@ // special case the legacy plugin, if it is given make sure the resolve module imports plugin

// generic API for this, but we need to design that a bit more first
const indexOfLegacy = cfg.plugins.findIndex(p => p.name === 'legacy');
let indexOfResolve = cfg.plugins.findIndex(p => p.name === 'resolve-module-imports');
const indexOfLegacy = cfg.plugins!.findIndex(p => p.name === 'legacy');
let indexOfResolve = cfg.plugins!.findIndex(p => p.name === 'resolve-module-imports');
if (indexOfLegacy !== -1 && indexOfResolve !== -1) {
const legacy = cfg.plugins.splice(indexOfLegacy, 1)[0];
const legacy = cfg.plugins!.splice(indexOfLegacy, 1)[0];
// recompute after splicing
indexOfResolve = cfg.plugins.findIndex(p => p.name === 'resolve-module-imports');
cfg.plugins.splice(indexOfResolve, 1, cfg.plugins[indexOfResolve], legacy);
indexOfResolve = cfg.plugins!.findIndex(p => p.name === 'resolve-module-imports');
cfg.plugins!.splice(indexOfResolve, 1, cfg.plugins![indexOfResolve], legacy);
}

@@ -51,0 +47,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

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