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

@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.5 to 0.1.6

dist/fromRollup.d.ts

8

CHANGELOG.md
# @web/dev-server-rollup
## 0.1.6
### Patch Changes
- 556827f: add fromRollup function
- 9484e97: replace rollupAdapter with fromRollup
- 7741a51: don't skip absolute windows paths
## 0.1.5

@@ -4,0 +12,0 @@

4

dist/createRollupPluginContextAdapter.js

@@ -8,3 +8,2 @@ "use strict";

const path_1 = __importDefault(require("path"));
const url_1 = require("url");
function createRollupPluginContextAdapter(pluginContext, wdsPlugin, config, fileWatcher, context) {

@@ -55,4 +54,3 @@ return Object.assign(Object.assign({}, pluginContext), { getModuleInfo(id) {

if (resolvedId) {
const fileUrl = new url_1.URL(resolvedId, `${url_1.pathToFileURL(importer)}`);
return { id: url_1.fileURLToPath(fileUrl) };
return { id: path_1.default.join(path_1.default.dirname(importer), resolvedId) };
}

@@ -59,0 +57,0 @@ }

@@ -0,2 +1,3 @@

export { fromRollup } from './fromRollup';
export { rollupAdapter } from './rollupAdapter';
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rollupAdapter = exports.fromRollup = void 0;
var fromRollup_1 = require("./fromRollup");
Object.defineProperty(exports, "fromRollup", { enumerable: true, get: function () { return fromRollup_1.fromRollup; } });
var rollupAdapter_1 = require("./rollupAdapter");
Object.defineProperty(exports, "rollupAdapter", { enumerable: true, get: function () { return rollupAdapter_1.rollupAdapter; } });
//# sourceMappingURL=index.js.map

@@ -13,3 +13,2 @@ "use strict";

const parse5_1 = require("parse5");
const url_1 = require("url");
const chalk_1 = require("chalk");

@@ -21,6 +20,2 @@ const utils_1 = require("./utils");

const VIRTUAL_FILE_PREFIX = '/__web-dev-server__/rollup';
function resolveFilePath(rootDir, path) {
const fileUrl = new url_1.URL(`.${path}`, `${url_1.pathToFileURL(rootDir)}/`);
return url_1.fileURLToPath(fileUrl);
}
/**

@@ -66,8 +61,8 @@ * Wraps rollup error in a custom error for web dev server.

}
if (!injectedFilePath && whatwg_url_1.default.parseURL(source) != null) {
// don't resolve valid urls
if (!injectedFilePath && !path_1.default.isAbsolute(source) && whatwg_url_1.default.parseURL(source) != null) {
// don't resolve relative and valid urls
return source;
}
const requestedFile = context.path.endsWith('/') ? `${context.path}index.html` : context.path;
const filePath = resolveFilePath(rootDir, requestedFile);
const filePath = path_1.default.join(rootDir, requestedFile);
try {

@@ -142,3 +137,3 @@ const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.pluginContext, wdsPlugin, config, fileWatcher, context);

else {
filePath = resolveFilePath(rootDir, context.path);
filePath = path_1.default.join(rootDir, context.path);
}

@@ -166,3 +161,3 @@ try {

if (context.response.is('js')) {
const filePath = resolveFilePath(rootDir, context.path);
const filePath = path_1.default.join(rootDir, context.path);
try {

@@ -191,3 +186,3 @@ const rollupPluginContext = createRollupPluginContextAdapter_1.createRollupPluginContextAdapter(rollupPluginContexts.transformPluginContext, wdsPlugin, config, fileWatcher, context);

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);
const filePath = path_1.default.join(rootDir, context.path);
try {

@@ -194,0 +189,0 @@ for (const node of inlineModuleNodes) {

{
"name": "@web/dev-server-rollup",
"version": "0.1.5",
"version": "0.1.6",
"publishConfig": {

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

@@ -17,10 +17,12 @@ # Dev Server Rollup

Import the rollup plugin and the `rollupAdapter` function in your configuration file. Then, wrap the rollup plugin with the adapter function:
Import the rollup plugin and the `fromRollup` function in your configuration file. Then, wrap the rollup plugin with the adapter function:
```js
const replace = require('@rollup/plugin-replace');
const { rollupAdapter } = require('@web/dev-server-rollup');
const rollupReplace = require('@rollup/plugin-replace');
const { fromRollup } = require('@web/dev-server-rollup');
const replace = fromRollup(rollupReplace);
module.exports = {
plugins: [rollupAdapter(replace({ include: ['src/**/*.js'], __environment__: '"development"' }))],
plugins: [replace({ include: ['src/**/*.js'], __environment__: '"development"' })],
};

@@ -31,3 +33,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 available in most rollup plugins.
Some rollup plugins do expensive operations. During development, this matters a lot more than during a production build. You are therefore required to always set the `include` and/or `exclude` options on rollup plugins.

@@ -39,5 +41,7 @@ ## non-standard file types

```js
const json = require('@rollup/plugin-json');
const { rollupAdapter } = require('@web/dev-server-rollup');
const rollupJson = require('@rollup/plugin-json');
const { fromRollup } = require('@web/dev-server-rollup');
const json = fromRollup(rollupJson);
module.exports = {

@@ -55,3 +59,3 @@ plugins: [

rollupAdapter(json()),
json({ include: ['src/**/*.js'] }),
],

@@ -58,0 +62,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

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