Skip to content

Commit

Permalink
TODOs cleanup and tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Feb 5, 2023
1 parent 3395dce commit a2eefc6
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/lib/node-modules-utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// TODO convert this to use / return URLs
// https://github.com/ProjectEvergreen/greenwood/issues/953
import { createRequire } from 'module'; // https://stackoverflow.com/a/62499498/417806
import { checkResourceExists } from '../lib/resource-utils.js';
import fs from 'fs/promises';
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/lib/resource-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function mergeResponse(destination, source) {

source.headers.forEach((value, key) => {
// TODO better way to handle Response automatically setting content-type
// https://github.com/ProjectEvergreen/greenwood/issues/1049
const isDefaultHeader = key.toLowerCase() === 'content-type' && value === 'text/plain;charset=UTF-8';

if (!isDefaultHeader) {
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/lifecycles/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const PLUGINS_FLATTENED_DEPTH = 2;

// get and "tag" all plugins provided / maintained by the @greenwood/cli
// and include as the default set, with all user plugins getting appended
// TODO could probably refactored to use a for loop
const greenwoodPlugins = (await Promise.all([
new URL('./copy/', greenwoodPluginsDirectoryUrl),
new URL('./renderer/', greenwoodPluginsDirectoryUrl),
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/src/lifecycles/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ async function getDevServer(compilation) {
}
}

// TODO would be nice if Koa (or other framework) could just a Response object directly
// not sure why we have to use `Readable.from`, does this couple us to NodeJS?
ctx.body = response.body ? Readable.from(response.body) : '';
ctx.type = response.headers.get('Content-Type');
ctx.status = response.status;
Expand Down Expand Up @@ -107,8 +105,6 @@ async function getDevServer(compilation) {
}
}, Promise.resolve(initResponse.clone()));

// TODO would be nice if Koa (or other framework) could just a Response object directly
// not sure why we have to use `Readable.from`, does this couple us to NodeJS?
ctx.body = response.body ? Readable.from(response.body) : '';
ctx.set('Content-Type', response.headers.get('Content-Type'));
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/plugins/resource/plugin-node-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class NodeModulesResource extends ResourceInterface {
}

// TODO convert node modules util to URL
// https://github.com/ProjectEvergreen/greenwood/issues/953v
async resolve(url) {
const { projectDirectory } = this.compilation.context;
const { pathname } = url;
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/plugins/resource/plugin-standard-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function bundleCss(body, url, projectDirectory) {
const resolvedUrl = value.startsWith('/node_modules')
? new URL(`.${value}`, projectDirectory)
: new URL(value, url);
// TODO intentionally using sync, unless csstree can support an async walk?
const importContents = fs.readFileSync(resolvedUrl, 'utf-8');

optimizedCss += bundleCss(importContents, url, projectDirectory);
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/plugins/resource/plugin-standard-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ class StandardHtmlResource extends ResourceInterface {
}
}

// TODO clean up lit-polyfill as part of https://github.com/ProjectEvergreen/greenwood/issues/728
// TODO clean up lit-polyfill
// https://github.com/ProjectEvergreen/greenwood/issues/728
body = body.replace(/<script src="(.*lit\/polyfill-support.js)"><\/script>/, '');

return new Response(body);
Expand Down

0 comments on commit a2eefc6

Please sign in to comment.