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

@greenwood/cli

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@greenwood/cli - npm Package Compare versions

Comparing version 0.28.4 to 0.28.5

4

package.json
{
"name": "@greenwood/cli",
"version": "0.28.4",
"version": "0.28.5",
"description": "Greenwood CLI.",

@@ -76,3 +76,3 @@ "type": "module",

},
"gitHead": "7c4aa0128bea0395c66df48f1a07901c4829dd33"
"gitHead": "0ff955495e0d62f13d0ec074547c6c864279832b"
}

@@ -87,13 +87,13 @@ import { bundleCompilation } from '../lifecycles/bundle.js';

const provider = plugin.provider(compilation);
if (!(provider instanceof ServerInterface)) {
console.warn(`WARNING: ${plugin.name}'s provider is not an instance of ServerInterface.`);
}
return provider;
})];
await Promise.all(servers.map(async (server) => {
await server.start();
return Promise.resolve(server);

@@ -123,5 +123,5 @@ }));

});
};
export { runProductionBuild };

@@ -10,5 +10,5 @@ import { ServerInterface } from '../lib/server-interface.js';

const { port } = compilation.config.devServer;
(await getDevServer(compilation)).listen(port, () => {
console.info(`Started local development server at localhost:${port}`);

@@ -15,0 +15,0 @@

@@ -8,3 +8,3 @@ import fs from 'fs/promises';

const configFiles = await fs.readdir(configFileDirUrl);
for (const file of configFiles) {

@@ -15,3 +15,3 @@ const from = new URL(`./${file}`, configFileDirUrl);

await fs.copyFile(from, to);
console.log(`Ejected ${file} successfully.`);

@@ -18,0 +18,0 @@ }

@@ -147,3 +147,3 @@ import fs from 'fs/promises';

input,
output: {
output: {
dir: normalizePathnameForWindows(outputDir),

@@ -150,0 +150,0 @@ entryFileNames: '[name].[hash].js',

@@ -82,3 +82,3 @@ #!/usr/bin/env node

break;
default:
default:
console.warn(`

@@ -85,0 +85,0 @@ Error: not able to detect command. try using the --help flag if

@@ -11,3 +11,3 @@ // TODO convert this to use / return URLs

let nodeModulesUrl;
try {

@@ -14,0 +14,0 @@ const packageEntryLocation = (await import.meta.resolve(packageName)).replace(/\\/g, '/'); // force / for consistency and path matching

@@ -6,7 +6,7 @@ class ServerInterface {

}
async start() {
return Promise.resolve(true);
}
async stop() {

@@ -13,0 +13,0 @@ return Promise.resolve(true);

@@ -63,3 +63,3 @@ /* eslint-disable max-depth,complexity */

}
await walkPackageJson(path.join(absoluteNodeModulesLocation, 'package.json'));

@@ -132,14 +132,14 @@ } else if (isBarePath) {

const exportMap = entry;
for (const entry of exportMap) {
const exportMapEntry = dependencyPackageJson.exports[entry];
let packageExport;
if (Array.isArray(exportMapEntry)) {
let fallbackPath;
let esmPath;
exportMapEntry.forEach((mapItem) => {
switch (typeof mapItem) {
case 'string':

@@ -164,6 +164,6 @@ fallbackPath = mapItem;

break;
}
});
packageExport = esmPath

@@ -176,3 +176,3 @@ ? esmPath

: exportMapEntry.default;
// use the dependency itself as an entry in the importMap

@@ -179,0 +179,0 @@ if (entry === '.') {

@@ -94,3 +94,3 @@ /* eslint-disable max-depth, max-len */

const basenamePieces = path.basename(srcPath).split('.');
const fileNamePieces = srcPath.split('/').filter(piece => piece !== ''); // normalize by removing any leading /'s
const fileNamePieces = srcPath.split('/').filter(piece => piece !== ''); // normalize by removing any leading /'s

@@ -97,0 +97,0 @@ optimizedFileName = srcPath.indexOf('/node_modules') >= 0

@@ -37,3 +37,3 @@ import fs from 'fs/promises';

}
resolve(context);

@@ -40,0 +40,0 @@ } catch (err) {

@@ -37,3 +37,3 @@ /* eslint-disable complexity, max-depth */

} else {
const extension = `.${filenameUrl.pathname.split('.').pop()}`;
const extension = `.${filenameUrl.pathname.split('.').pop()}`;
const isStatic = extension === '.md' || extension === '.html';

@@ -73,3 +73,3 @@ const isDynamic = extension === '.js';

const { attributes } = fm(fileContents);
template = attributes.template || 'page';

@@ -125,3 +125,3 @@ title = attributes.title || title;

filePath = route;
await new Promise((resolve, reject) => {

@@ -150,3 +150,3 @@ const worker = new Worker(routeWorkerUrl);

});
if (ssrFrontmatter) {

@@ -157,3 +157,3 @@ template = ssrFrontmatter.template || template;

customData = ssrFrontmatter.data || customData;
/* Menu Query

@@ -169,3 +169,3 @@ * Custom front matter - Variable Definitions

customData.index = ssrFrontmatter.index || '';
}
}
} else {

@@ -172,0 +172,0 @@ console.debug(`Unhandled extension (.${extension}) for route => ${route}`);

@@ -134,3 +134,3 @@ import fs from 'fs/promises';

console.info('pages to generate', `\n ${pages.map(page => page.route).join('\n ')}`);
await Promise.all(pages.map(async (page) => {

@@ -137,0 +137,0 @@ const { route, outputPath } = page;

@@ -128,3 +128,3 @@ import fs from 'fs/promises';

}
await next();

@@ -163,3 +163,3 @@ });

ctx.set('Etag', etagHash);
// TODO automatically loop and apply all custom headers to Koa response, include Content-Type below

@@ -285,3 +285,3 @@ // https://github.com/ProjectEvergreen/greenwood/issues/1048

});
return app;

@@ -313,2 +313,4 @@ }

ctx.set('Content-Type', 'text/html');
// TODO should use status from response
// https://github.com/ProjectEvergreen/greenwood/issues/1048
ctx.status = 200;

@@ -319,6 +321,9 @@ } else if (isApiRoute) {

const response = await handler(request);
const { body } = response;
// TODO should use status from response
// https://github.com/ProjectEvergreen/greenwood/issues/1048
ctx.body = body ? Readable.from(body) : null;
ctx.status = 200;
ctx.set('Content-Type', response.headers.get('Content-Type'));
ctx.body = Readable.from(response.body);
}

@@ -334,3 +339,3 @@ } catch (e) {

export {
export {
getDevServer,

@@ -337,0 +342,0 @@ getStaticServer,

@@ -23,3 +23,3 @@ import fs from 'fs/promises';

shouldHandle = true;
if (!checkOnly) {

@@ -26,0 +26,0 @@ response = await plugin.serve(url, request);

/*
*
*
* Manages routing to API routes.

@@ -4,0 +4,0 @@ *

/*
*
*
* Manages routing devServer.proxy entries to their destination.

@@ -4,0 +4,0 @@ *

/*
*
*
* Detects and fully resolves requests to node_modules and handles creating an importMap.

@@ -69,3 +69,3 @@ *

async shouldIntercept(url, request, response) {
return response.headers.get('Content-Type').indexOf('text/html') >= 0;
return response.headers.get('Content-Type')?.indexOf('text/html') >= 0;
}

@@ -85,3 +85,3 @@

const userPackageJson = await getPackageJson(context);
// if there are dependencies and we haven't generated the importMap already

@@ -123,3 +123,3 @@ // walk the project's package.json for all its direct dependencies

'preventAssignment': true,
// https://github.com/rollup/rollup/issues/487#issuecomment-177596512

@@ -126,0 +126,0 @@ 'process.env.NODE_ENV': JSON.stringify('production')

/*
*
*
* Detects and fully resolve requests to source map (.map) files.

@@ -4,0 +4,0 @@ *

/*
*
*
* Manages web standard resource related operations for audio formats.

@@ -4,0 +4,0 @@ * This is a Greenwood default plugin.

/*
*
*
* Manages web standard resource related operations for fonts.

@@ -4,0 +4,0 @@ * This is a Greenwood default plugin.

@@ -185,3 +185,4 @@ /* eslint-disable complexity, max-depth */

body = body.replace(/\<content-outlet>(.*)<\/content-outlet>/s, processedMarkdown.contents);
// https://github.com/ProjectEvergreen/greenwood/issues/1126
body = body.replace(/\<content-outlet>(.*)<\/content-outlet>/s, processedMarkdown.contents.replace(/\$/g, '$$$'));
} else if (matchingRoute.external) {

@@ -188,0 +189,0 @@ body = body.replace(/\<content-outlet>(.*)<\/content-outlet>/s, matchingRoute.body);

/*
*
*
* Manages web standard resource related operations for image formats.

@@ -4,0 +4,0 @@ * This is a Greenwood default plugin.

/*
*
*
* Manages web standard resource related operations for JavaScript.

@@ -4,0 +4,0 @@ * This is a Greenwood default plugin.

/*
*
*
* Manages web standard resource related operations for JSON.

@@ -4,0 +4,0 @@ * This is a Greenwood default plugin.

/*
*
*
* Manages web standard resource related operations for video formats.

@@ -37,3 +37,3 @@ * This is a Greenwood default plugin.

contentType = 'video/x-msvideo';
break;
break;
case 'flv':

@@ -40,0 +40,0 @@ contentType = 'video/x-flv';

/*
*
*
*
* Manages SPA like client side routing for static pages.

@@ -26,3 +26,3 @@ * This is a Greenwood default plugin.

const routerUrl = new URL('../../lib/router.js', import.meta.url);
return new Request(`file://${routerUrl.pathname}`);

@@ -29,0 +29,0 @@ }

/*
*
* Detects and fully resolve requests to the user's workspace.
*
* Detects and fully resolve requests to the user's workspace.
* This sets the default value for requests in Greenwood.

@@ -5,0 +5,0 @@ *

@@ -19,3 +19,3 @@ import fs from 'fs/promises';

const plugin = pluginImport[Object.keys(pluginImport)[0]];
return plugin;

@@ -54,7 +54,7 @@ })))

class LiveReloadResource extends ResourceInterface {
async shouldIntercept(url, request, response) {
const contentType = response.headers.get('Content-Type');
return contentType.indexOf('text/html') >= 0 && process.env.__GWD_COMMAND__ === 'develop'; // eslint-disable-line no-underscore-dangle
return contentType?.indexOf('text/html') >= 0 && process.env.__GWD_COMMAND__ === 'develop'; // eslint-disable-line no-underscore-dangle
}

@@ -64,3 +64,3 @@

let body = await response.text();
body = body.replace('</head>', `

@@ -67,0 +67,0 @@ <script src="http://localhost:35729/livereload.js?snipver=1"></script>

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