Skip to content

Commit

Permalink
Merge 'upstream/v2' into wbinnssmith/merge-v2-2022-04-22
Browse files Browse the repository at this point in the history
* upstream/v2:
  fix: getNodeIdsConnected should remove duplicate values (#8054)
  chore: should log unsupported type not zero and toLocaleString's option typo (#8002)
  Allow animated images (#8018)
  Add "key" and "update_url" to webextension manifest schema (#8043)
  Allow to define the "compilerOptions" of the VueTransformer (#8031)
  fix(image transformer): Update supported formats (#8028)
  support for `oauth2` field in mv3 (#8037)
  Update @parcel/css to 1.8.2 (#8044)
  • Loading branch information
lettertwo committed May 6, 2022
2 parents e6b6f43 + 504e546 commit 8e13ce5
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 165 deletions.
4 changes: 3 additions & 1 deletion packages/configs/default/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"script:*.vue": ["@parcel/transformer-vue"],
"style:*.vue": ["@parcel/transformer-vue"],
"custom:*.vue": ["@parcel/transformer-vue"],
"*.{png,jpg,jpeg,webp}": ["@parcel/transformer-image"],
"*.{png,jpg,jpeg,webp,gif,tiff,avif,heic,heif}": [
"@parcel/transformer-image"
],
"*.svg": ["@parcel/transformer-svg"],
"*.{xml,rss,atom}": ["@parcel/transformer-xml"],
"url:*": ["...", "@parcel/transformer-raw"]
Expand Down
19 changes: 14 additions & 5 deletions packages/core/graph/src/AdjacencyList.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default class AdjacencyList<TEdgeType: number = 1> {
to: NodeId,
type: TEdgeType | NullEdgeType = 1,
): boolean {
assert(type > 0, `Unsupported edge type ${0}`);
assert(type > 0, `Unsupported edge type ${type}`);

let hash = this.#edges.hash(from, to, type);
let edge = this.#edges.addressOf(hash, from, to, type);
Expand Down Expand Up @@ -439,14 +439,18 @@ export default class AdjacencyList<TEdgeType: number = 1> {
(Array.isArray(type)
? type.includes(this.#nodes.typeOf(node))
: type === this.#nodes.typeOf(node));

let nodes = [];
let seen = new Set<NodeId>();
let node = this.#nodes.head(from);
while (node !== null) {
if (matches(node)) {
let edge = this.#nodes.firstOut(node);
while (edge !== null) {
nodes.push(this.#edges.to(edge));
let to = this.#edges.to(edge);
if (!seen.has(to)) {
nodes.push(to);
seen.add(to);
}
edge = this.#edges.nextOut(edge);
}
}
Expand All @@ -473,12 +477,17 @@ export default class AdjacencyList<TEdgeType: number = 1> {
: type === this.#nodes.typeOf(node));

let nodes = [];
let seen = new Set<NodeId>();
let node = this.#nodes.head(to);
while (node !== null) {
if (matches(node)) {
let edge = this.#nodes.firstIn(node);
while (edge !== null) {
nodes.push(this.#edges.from(edge));
let from = this.#edges.from(edge);
if (!seen.has(from)) {
nodes.push(from);
seen.add(from);
}
edge = this.#edges.nextIn(edge);
}
}
Expand Down Expand Up @@ -600,7 +609,7 @@ export class SharedTypeMap<TItemType, THash, TAddress: number>

get bufferSize(): string {
return `${(this.data.byteLength / 1024 / 1024).toLocaleString(undefined, {
minmumFractionDigits: 2,
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})} mb`;
}
Expand Down
12 changes: 12 additions & 0 deletions packages/core/graph/test/AdjacencyList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ describe('AdjacencyList', () => {
assert.deepEqual(graph.getNodeIdsConnectedTo(node1), [0, 2, 4, 5, 6]);
});

it('getNodeIdsConnectedTo and getNodeIdsConnectedFrom should remove duplicate values', () => {
let graph = new AdjacencyList();
let a = graph.addNode();
let b = graph.addNode();
let c = graph.addNode();
graph.addEdge(a, b);
graph.addEdge(a, c);
graph.addEdge(a, b, 2);
assert.deepEqual(graph.getNodeIdsConnectedFrom(a, -1), [b, c]);
assert.deepEqual(graph.getNodeIdsConnectedTo(b, -1), [a]);
});

it('removeEdge should remove an edge of a specific type from the graph', () => {
let graph = new AdjacencyList();
let a = graph.addNode();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./index.less');
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.index {
// Note the literal space after "xml"
background: url("data:image/svg+xml,%3C%3Fxml version%3D%221.0%22%3F%3E%3Csvg%3E%3C%2Fsvg%3E");
}
21 changes: 21 additions & 0 deletions packages/core/integration-tests/test/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,25 @@ describe('less', function () {

assert(css.includes('url("#default#VML")'));
});

it('preserves quotes around data urls that require them', async () => {
let b = await bundle(
path.join(__dirname, '/integration/less-url-quotes/index.less'),
);

assertBundles(b, [
{
name: 'index.css',
assets: ['index.less'],
},
]);

let css = await outputFS.readFile(path.join(distDir, 'index.css'), 'utf8');
assert(
css.includes(
// Note the literal space after "xml"
'background: url("data:image/svg+xml,%3C%3Fxml version%3D%221.0%22%3F%3E%3Csvg%3E%3C%2Fsvg%3E")',
),
);
});
});
2 changes: 1 addition & 1 deletion packages/optimizers/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"parcel": "^2.0.24"
},
"dependencies": {
"@parcel/css": "^1.8.1",
"@parcel/css": "^1.8.2",
"@parcel/diagnostic": "2.0.24",
"@parcel/plugin": "2.0.24",
"@parcel/source-map": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"parcel": "^2.0.24"
},
"dependencies": {
"@parcel/css": "^1.8.1",
"@parcel/css": "^1.8.2",
"@parcel/diagnostic": "2.0.24",
"@parcel/plugin": "2.0.24",
"@parcel/source-map": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/image/src/ImageTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default (new Transformer({
true,
);

let imagePipeline = sharp(inputBuffer);
let imagePipeline = sharp(inputBuffer, {animated: true});

imagePipeline.withMetadata();

Expand Down
2 changes: 2 additions & 0 deletions packages/transformers/vue/src/VueTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default (new Transformer({
return {
customBlocks: contents.customBlocks || {},
filePath: conf && conf.filePath,
compilerOptions: contents.compilerOptions || {},
};
},
canReuseAST({ast}) {
Expand Down Expand Up @@ -230,6 +231,7 @@ async function processPipeline({
scoped: styles.some(style => style.scoped),
isFunctional,
id,
compilerOptions: config.compilerOptions,
});
if (templateComp.errors.length) {
throw new ThrowableDiagnostic({
Expand Down
10 changes: 10 additions & 0 deletions packages/transformers/webextension/src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ const commonProps = {
properties: {},
},
},
key: string,
update_url: string,
chrome_settings_overrides: {
type: 'object',
properties: {
Expand Down Expand Up @@ -406,6 +408,14 @@ const commonProps = {
additionalProperties: false,
},
version_name: string,
oauth2: {
type: 'object',
properties: {
client_id: string,
scopes: arrStr,
},
additionalProperties: false,
},
};

export const MV3Schema = ({
Expand Down
Loading

0 comments on commit 8e13ce5

Please sign in to comment.