Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/peregrine/lib/targets/peregrine-intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ function TalonWrapperConfig(addTransforms) {
wrapWith: wrapperModule =>
addTransforms({
type: 'source',
fileToTransform: path.join('./lib/talons/', talonFile),
fileToTransform: path.join(
'@magento/peregrine/lib/talons/',
talonFile
),
transformModule:
'@magento/pwa-buildpack/lib/WebpackTools/loaders/wrap-esm-loader',
options: {
Expand Down
22 changes: 16 additions & 6 deletions packages/pwa-buildpack/lib/WebpackTools/ModuleTransformConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,18 @@ class ModuleTransformConfig {
}
if (path.isAbsolute(fileToTransform)) {
throw this._traceableError(
`Invalid fileToTransform path "${fileToTransform}": Extensions are not allowed to provide absolute fileToTransform paths! This transform request from "${requestor}" must provide a relative path to one of its own files.`
`Invalid fileToTransform path "${fileToTransform}": Extensions are not allowed to provide absolute fileToTransform paths! This transform request from "${requestor}" must provide a relative path to one of its own files, or to a file within the project's local source code.`
);
}
// make module-absolute if relative
return fileToTransform.startsWith(requestor)
? fileToTransform
: path.join(requestor, fileToTransform);
const belongsToRequestor = fileToTransform.startsWith(requestor);
const isRelative = fileToTransform.startsWith('.');

if (!belongsToRequestor && !isRelative) {
throw this._traceableError(
`Invalid fileToTransform path "${fileToTransform}": Cannot transform a file provided by another module! This transform request from "${requestor}" must provide a module-relative path to one of its own files, e.g. "${requestor}/some/file", or to a file within the project's local source code, e.g. "./index.css".`
);
}
return fileToTransform;
}
/**
*
Expand All @@ -93,7 +98,11 @@ class ModuleTransformConfig {
);
// Capturing in the sync phase so that a resolve failure is traceable.
const resolveError = this._traceableError(
`ModuleTransformConfig could not resolve ${toResolve} in order to transform it with ${transformModule}.`
`ModuleTransformConfig could not resolve ${toResolve} in order to transform it with ${transformModule}. Resolver options: ${JSON.stringify(
this._resolver.config,
null,
2
)})`
);
// push the promise, so we don't run a bunch of resolves all at once
this._reqs.push(
Expand All @@ -117,6 +126,7 @@ class ModuleTransformConfig {
async toLoaderOptions() {
const byType = {
babel: {},
postcss: {},
source: {}
};
// Some reqs may still be outstanding!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,83 @@ getModuleRules.js = async ({
* @returns Rule object for Webpack `module` configuration which parses
* CSS files
*/
getModuleRules.css = async ({ paths, hasFlag }) => ({
test: /\.css$/,
oneOf: [
{
test: [paths.src, ...hasFlag('cssModules')],
use: [
'style-loader',
{
loader: 'css-loader',
options: {
localIdentName: '[name]-[local]-[hash:base64:3]',
modules: true
}
getModuleRules.css = async ({ mode, paths, hasFlag, transformRequests }) => {
const styleLoader = {
loader: 'style-loader'
};

const nonModuleRule = {
include: /node_modules/,
use: [
styleLoader,
{
loader: 'css-loader',
options: {
modules: false
}
]
},
{
include: /node_modules/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: false
}
}
]
};

const cssModuleLoader = {
loader: 'css-loader',
options: {
sourceMap: mode === 'development',
localIdentName: '[name]-[local]-[hash:base64:3]',
modules: true
}
};

const moduleRule = {
test: [paths.src, ...hasFlag('cssModules')],
use: [styleLoader, cssModuleLoader]
};

const oneOf = [moduleRule, nonModuleRule];

const postCssTransformedModules = new Map();
Object.entries(transformRequests.postcss).forEach(
([plugin, requestsByFile]) => {
const pluginFactory = require(plugin);
Object.entries(requestsByFile).forEach(([filename, requests]) => {
let pluginsForFile = postCssTransformedModules.get(filename);
if (!pluginsForFile) {
pluginsForFile = [];
postCssTransformedModules.set(filename, pluginsForFile);
}
]
pluginsForFile.push([pluginFactory, requests]);
});
}
]
});
);
if (postCssTransformedModules.size > 0) {
const postCssLoader = {
loader: 'postcss-loader',
ident: 'buildpack-postcss-loader',
options: {
ident: 'buildpack-postcss-loader',
plugins: loader => {
const pluginsForFile =
postCssTransformedModules.get(loader.resourcePath) ||
[];
return pluginsForFile.map(([plugin, options]) =>
plugin(options)
);
},
sourceMap: mode === 'development' && 'inline'
}
};
const transformedModuleRule = {
include: [...postCssTransformedModules.keys()],
use: [styleLoader, cssModuleLoader, postCssLoader]
};
oneOf.unshift(transformedModuleRule);
}

return {
test: /\.css$/,
oneOf
};
};

/**
* @param {Buildpack/WebpackTools~WebpackConfigHelper} helper
Expand Down
2 changes: 2 additions & 0 deletions packages/pwa-buildpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
"peerDependencies": {
"babel-loader": "~8.0.5",
"css-loader": "~2.1.1",
"postcss": "~7.0.26",
"postcss-loader": "~3.0.0",
"terser-webpack-plugin": "~1.2.3",
"webpack": "~4.38.0",
"workbox-webpack-plugin": "5.1.3"
Expand Down
4 changes: 4 additions & 0 deletions packages/venia-concept/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"prettier:fix": "yarn run -s prettier -- --write",
"start": "node server.js",
"start:debug": "node --inspect-brk ./node_modules/.bin/webpack-dev-server --progress --color --env.mode development",
"storybook": "echo 'Venia component stories have moved to @magento/venia-ui. Trying to run in sibling directory...' && (cd ../venia-ui && yarn run storybook:build)",
"storybook:build": "yarn run storybook",
"test": "yarn run -s prettier:check && yarn run -s lint && jest",
"validate-queries": "yarn run download-schema && graphql validate-magento-pwa-queries --project venia",
"watch": "webpack-dev-server --progress --color --env.mode development"
Expand Down Expand Up @@ -94,6 +96,8 @@
"lodash.over": "~4.7.0",
"memoize-one": "~5.0.0",
"memory-fs": "~0.4.1",
"postcss": "~7.0.26",
"postcss-loader": "~3.0.0",
"prettier": "~1.16.4",
"prop-types": "~15.7.2",
"react": "~16.9.0",
Expand Down
12 changes: 8 additions & 4 deletions packages/venia-concept/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--venia-anim-out: cubic-bezier(0.4, 0, 1, 1);
--venia-anim-standard: cubic-bezier(0.4, 0, 0.2, 1);
--venia-background-color: 255, 255, 255;
--venia-border: 224, 224, 224;
--venia-foreground-color: 33, 33, 33;
--venia-error: 192, 18, 63;
--venia-error-alt: 255, 226, 234;
--venia-font: Muli, -apple-system, BlinkMacSystemFont, sans-serif;
Expand All @@ -20,7 +20,10 @@
--venia-teal-alt: 224, 240, 241;
--venia-teal-dark: 0, 104, 108;
--venia-teal-light: 212, 243, 238;
--venia-text: 33, 33, 33;
--venia-border: var(--venia-grey);
--venia-border-alt: var(--venia-grey-dark);
--venia-disabled: var(--venia-grey-dark);
--venia-text: var(--venia-foreground-color);
--venia-text-alt: var(--venia-grey-darker);
--venia-text-hint: 158, 158, 158;
--venia-text-spot: 255, 99, 51;
Expand All @@ -29,7 +32,7 @@
}

html {
background-color: white;
background-color: rgb(var(--venia-background-color));
font-size: 100%;
font-weight: 400;
line-height: 1;
Expand All @@ -38,7 +41,7 @@ html {
}

body {
background-color: white;
background-color: rgb(var(--venia-background-color));
color: rgb(var(--venia-text));
margin: 0;
padding: 0;
Expand Down Expand Up @@ -102,6 +105,7 @@ dt {

button {
background: none;
color: rgb(var(--venia-foreground-color));
border: 0;
cursor: pointer;
font-family: var(--venia-font);
Expand Down
4 changes: 2 additions & 2 deletions packages/venia-ui/lib/RootComponents/Category/category.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
margin-left: 0.5rem;
display: inline-block;
padding: 0.75rem 2rem;
border: 1px solid black;
border: 1px solid rgb(var(--venia-foreground-color));
border-radius: 3px;
color: black;
color: rgb(var(--venia-foreground-color));
outline: none;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-ui/lib/components/AuthBar/authBar.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.root {
align-items: center;
background-color: white;
background-color: rgb(var(--venia-background-color));
display: grid;
gap: 0.75rem;
grid-auto-flow: column;
Expand Down
4 changes: 2 additions & 2 deletions packages/venia-ui/lib/components/Button/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

.filled {
background-color: rgb(var(--color));
color: white;
color: rgb(var(--venia-background-color));
}

.root:hover {
Expand All @@ -39,7 +39,7 @@

.root:disabled {
pointer-events: none;
--color: var(--venia-grey-dark);
--color: var(--venia-disabled);
}

.content {
Expand Down
8 changes: 4 additions & 4 deletions packages/venia-ui/lib/components/ButtonGroup/button.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.root {
composes: root from '../clickable.css';
background: none white;
border: 1px solid rgb(var(--venia-grey-dark));
background: none rgb(var(--venia-background-color));
border: 1px solid rgb(var(--venia-border-alt));
color: rgb(var(--venia-text));
font-size: 0.75rem;
font-weight: 600;
Expand Down Expand Up @@ -30,8 +30,8 @@
}

.root:disabled {
border-color: rgb(var(--venia-grey-dark));
color: rgb(var(--venia-grey-dark));
border-color: rgb(var(--venia-disabled));
color: rgb(var(--venia-grey-disabled));
}

.root:nth-of-type(1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.root {
background-color: white;
background-color: rgb(var(--venia-background-color));
bottom: 0;
display: grid;
grid-template-rows: auto 1fr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

.button {
align-items: center;
background-color: white;
border: 1px solid rgb(var(--venia-grey-darker));
background-color: rgb(var(--venia-background-color));
border: 1px solid rgb(var(--venia-text-alt));
border-radius: 50%;
display: inline-flex;
height: 2.25rem;
Expand All @@ -35,8 +35,8 @@
}

.button:disabled {
border-color: rgb(var(--venia-grey-darker)) !important;
background-color: #d0d0d0 !important;
border-color: rgb(var(--venia-text-alt)) !important;
background-color: rgb(var(--venia-disabled)) !important;
opacity: 0.5;
cursor: not-allowed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: rgb(var(--venia-foreground-color));
}
4 changes: 2 additions & 2 deletions packages/venia-ui/lib/components/Checkout/Receipt/receipt.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.root {
background-color: white;
background-color: rgb(var(--venia-background-color));
display: grid;
grid-template-rows: 1fr auto;
height: 100vh;
Expand Down Expand Up @@ -29,7 +29,7 @@
}

.orderId {
color: #22a1a8;
color: rgb(var(--venia-teal-dark));
text-decoration: underline;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-ui/lib/components/Checkout/addressForm.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/* fields */
.textInput {
background: white;
background: rgb(var(--venia-background-color));
border: 1px solid rgb(var(--venia-text-alt));
border-radius: 2px;
color: rgb(var(--venia-text));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.icon {
composes: root from '../Icon/icon.css';
--stroke: white;
--stroke: rgb(var(--venia-background-color));
}
6 changes: 3 additions & 3 deletions packages/venia-ui/lib/components/Checkout/flow.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}

.heading {
background-color: white;
background-color: rgb(var(--venia-background-color));
font-size: 0.875rem;
font-weight: 600;
grid-column-end: span 2;
Expand All @@ -20,7 +20,7 @@
animation-duration: 224ms;
animation-iteration-count: 1;
animation-name: enter;
background-color: white;
background-color: rgb(var(--venia-background-color));
bottom: 5rem;
box-shadow: 0 -1px rgb(var(--venia-border));
display: grid;
Expand All @@ -35,7 +35,7 @@

.footer {
align-items: center;
background-color: white;
background-color: rgb(var(--venia-background-color));
display: grid;
grid-auto-columns: min-content;
grid-auto-flow: column;
Expand Down
Loading