Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/2023-07: esbuild bump #6300

Merged
merged 10 commits into from
Jul 21, 2023
Merged
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
2 changes: 1 addition & 1 deletion configuration
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export DENO=v1.33.2
export DENO_DOM=v0.1.35-alpha-artifacts
export PANDOC=3.1.5
export DARTSASS=1.55.0
export ESBUILD=0.15.6
export ESBUILD=0.18.15
export TYPST=0.6.0

# Bootstrap dependencies from bslib
Expand Down
19 changes: 13 additions & 6 deletions package/src/bld.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* package.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
*
*/
* package.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
*/
import { Command } from "cliffy/command/mod.ts";
import { packageCommand } from "./cmd/pkg-cmd.ts";
import { configure } from "./common/configure.ts";
Expand All @@ -23,7 +22,10 @@ import {
cycleDependenciesCommand,
parseSwcLogCommand,
} from "./common/cyclic-dependencies.ts";
import { archiveBinaryDependencies } from "./common/archive-binary-dependencies.ts";
import {
archiveBinaryDependencies,
checkBinaryDependencies,
} from "./common/archive-binary-dependencies.ts";
import { updatePandoc } from "./common/update-pandoc.ts";

// Core command dispatch
Expand Down Expand Up @@ -75,6 +77,11 @@ function getCommands() {
.name("archive-bin-deps")
.description("Downloads and archives our binary dependencies."),
);
commands.push(
packageCommand(checkBinaryDependencies)
.name("check-bin-deps")
.description("Checks the paths and URLs of our binary dependencies."),
);
commands.push(
packageCommand(prepareDist)
.name("prepare-dist")
Expand Down
62 changes: 57 additions & 5 deletions package/src/common/archive-binary-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* archive-binary-dependencies.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
*
*/
* archive-binary-dependencies.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
*/
import { join } from "path/mod.ts";
import { info } from "log/mod.ts";

Expand Down Expand Up @@ -43,6 +42,59 @@ export async function archiveBinaryDependencies(_config: Configuration) {
});
}

// Archives dependencies (if they are not present in the archive already)
export async function checkBinaryDependencies(_config: Configuration) {
await withWorkingDir(async (workingDir) => {
info(`Updating binary dependencies...\n`);

for (const dependency of kDependencies) {
await checkBinaryDependency(dependency, workingDir);
}
});
}

export async function checkBinaryDependency(
dependency: Dependency,
workingDir: string,
) {
info(`** ${dependency.name} ${dependency.version} **`);

const dependencyBucketPath = `${dependency.bucket}/${dependency.version}`;
info("Checking archive status...\n");

const archive = async (
architectureDependency: ArchitectureDependency,
) => {
const platformDeps = [
architectureDependency.darwin,
architectureDependency.linux,
architectureDependency.windows,
];
for (const platformDep of platformDeps) {
if (platformDep) {
// This dependency doesn't exist, archive it
info(
`Checking ${dependencyBucketPath} - ${platformDep.filename}`,
);

// Download the file
await download(
workingDir,
platformDep,
);
}
}
};

for (const arch of Object.keys(dependency.architectureDependencies)) {
info(`Checking ${dependency.name}`);
const archDep = dependency.architectureDependencies[arch];
await archive(archDep);
}

info("");
}

export async function archiveBinaryDependency(
dependency: Dependency,
workingDir: string,
Expand Down
21 changes: 10 additions & 11 deletions package/src/common/dependencies/esbuild.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* esbuild.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
*
*/
* esbuild.ts
*
* Copyright (C) 2020-2022 Posit Software, PBC
*/
import { ensureDirSync, existsSync } from "fs/mod.ts";
import { dirname, join } from "path/mod.ts";

Expand All @@ -20,7 +19,7 @@ export function esBuild(version: string): Dependency {
return {
filename: `esbuild-${platformstr}.tgz`,
url:
`https://registry.npmjs.org/esbuild-${platformstr}/-/esbuild-${platformstr}-${version}.tgz`,
`https://registry.npmjs.org/@esbuild/${platformstr}/-/${platformstr}-${version}.tgz`,
configure: async (config: Configuration, path: string) => {
const file = config.os === "windows" ? "esbuild.exe" : "esbuild";
const vendor = Deno.env.get("QUARTO_VENDOR_BINARIES");
Expand All @@ -30,7 +29,7 @@ export function esBuild(version: string): Dependency {

const targetDir = join(dir, config.arch);
ensureDirSync(targetDir);

// extracts to package/bin
const esbuildDir = join(dir, `package`);
if (existsSync(esbuildDir)) {
Expand Down Expand Up @@ -73,13 +72,13 @@ export function esBuild(version: string): Dependency {
version,
architectureDependencies: {
"x86_64": {
"windows": esBuildRelease("windows-64"),
"linux": esBuildRelease("linux-64"),
"darwin": esBuildRelease("darwin-64"),
"windows": esBuildRelease("win32-x64"),
"linux": esBuildRelease("linux-x64"),
"darwin": esBuildRelease("darwin-x64"),
},
"aarch64": {
"linux": esBuildRelease("linux-arm64"),
"darwin": esBuildRelease("darwin-arm64")
"darwin": esBuildRelease("darwin-arm64"),
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion package/src/quarto-bld
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export DENO_NO_UPDATE_CHECK=1

# TODO: Consider generating a source map or something to get a good stack
# Create the Deno bundle
"$QUARTO_DENO" run --unstable --allow-env --allow-read --allow-write --allow-run --allow-net --allow-ffi --importmap="${SCRIPT_PATH}/../../src/dev_import_map.json" "$SCRIPT_PATH/bld.ts" $@
"$QUARTO_DENO" run --unstable --allow-env --allow-read --allow-write --allow-run --allow-net --allow-ffi --v8-flags=--stack-trace-limit=100 --importmap="${SCRIPT_PATH}/../../src/dev_import_map.json" "$SCRIPT_PATH/bld.ts" $@
14 changes: 7 additions & 7 deletions src/command/build-js/cmd.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*
* cmd.ts
*
* Copyright (C) 2021-2022 Posit Software, PBC
*
*/
* cmd.ts
*
* Copyright (C) 2021-2022 Posit Software, PBC
*/

import { Command } from "cliffy/command/mod.ts";

import { esbuildCompile } from "../../core/esbuild.ts";
import { buildIntelligenceResources } from "../../core/schema/build-schema-file.ts";
import { resourcePath } from "../../core/resources.ts";
import { simple } from "acorn/walk";
import { parse as parseES6 } from "acorn/acorn";
import { Parser } from "acorn/acorn";
import classFields from "acorn-class-fields";
import { initYamlIntelligenceResourcesFromFilesystem } from "../../core/schema/utils.ts";

// initialize language handlers
import "../../core/handlers/handlers.ts";

function ensureAllowableIDESyntax(src: string, filename: string) {
const ast = parseES6(src, {
const ast = Parser.extend(classFields).parse(src, {
ecmaVersion: "2020",
sourceType: "module",
});
Expand Down
9 changes: 7 additions & 2 deletions src/dev_import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
"moment-guess": "./vendor/cdn.skypack.dev/moment-guess@1.2.4.js",
"ansi_up": "./vendor/cdn.skypack.dev/ansi_up@v5.1.0.js",
"lodash/": "./vendor/cdn.skypack.dev/lodash@4.17.21/",
"acorn/acorn": "./vendor/cdn.skypack.dev/acorn@7.4.1.js",
"acorn/walk": "./vendor/cdn.skypack.dev/acorn-walk@7.2.0.js",
"acorn-class-fields": "./vendor/cdn.skypack.dev/acorn-class-fields@1.0.0.js",
"acorn/acorn": "./vendor/cdn.skypack.dev/acorn@8.4.0.js",
"acorn/walk": "./vendor/cdn.skypack.dev/acorn-walk@8.2.0.js",
"binary-search-bounds": "./vendor/cdn.skypack.dev/binary-search-bounds@2.0.5.js",
"blueimpMd5": "./vendor/cdn.skypack.dev/blueimp-md5@2.19.0.js",
"diff": "./vendor/cdn.skypack.dev/diff@5.0.0.js",
Expand Down Expand Up @@ -277,7 +278,11 @@
"./vendor/cdn.skypack.dev/": {
"/-/acorn@v7.4.1-aIeX4aKa0RO2JeS9dtPa/dist=es2019,mode=imports/optimized/acorn.js": "./vendor/cdn.skypack.dev/-/acorn@v7.4.1-aIeX4aKa0RO2JeS9dtPa/dist=es2019,mode=imports/optimized/acorn.js",
"/-/acorn-walk@v7.2.0-HE7wS37ePcNncqJvsD8k/dist=es2019,mode=imports/optimized/acorn-walk.js": "./vendor/cdn.skypack.dev/-/acorn-walk@v7.2.0-HE7wS37ePcNncqJvsD8k/dist=es2019,mode=imports/optimized/acorn-walk.js",
"/-/acorn-private-class-elements@v1.0.0-74UyKouPfmJKyVmXndKD/dist=es2019,mode=imports/optimized/acorn-private-class-elements.js": "./vendor/cdn.skypack.dev/-/acorn-private-class-elements@v1.0.0-74UyKouPfmJKyVmXndKD/dist=es2019,mode=imports/optimized/acorn-private-class-elements.js",
"/-/acorn@v8.4.0-TUBEehokUmfefnUMjao9/dist=es2019,mode=imports/optimized/acorn.js": "./vendor/cdn.skypack.dev/-/acorn@v8.4.0-TUBEehokUmfefnUMjao9/dist=es2019,mode=imports/optimized/acorn.js",
"/-/@observablehq/parser@v4.5.0-rWZiNfab8flhVomtfVvr/dist=es2019,mode=imports/optimized/@observablehq/parser.js": "./vendor/cdn.skypack.dev/-/@observablehq/parser@v4.5.0-rWZiNfab8flhVomtfVvr/dist=es2019,mode=imports/optimized/@observablehq/parser.js",
"/-/acorn-class-fields@v1.0.0-VEggkLxq9gMrdwRuKkzZ/dist=es2019,mode=imports/optimized/acorn-class-fields.js": "./vendor/cdn.skypack.dev/-/acorn-class-fields@v1.0.0-VEggkLxq9gMrdwRuKkzZ/dist=es2019,mode=imports/optimized/acorn-class-fields.js",
"/-/acorn-walk@v8.2.0-X811aiix0R2fkBGq305v/dist=es2019,mode=imports/optimized/acorn-walk.js": "./vendor/cdn.skypack.dev/-/acorn-walk@v8.2.0-X811aiix0R2fkBGq305v/dist=es2019,mode=imports/optimized/acorn-walk.js",
"/-/ansi_up@v5.1.0-ifIRWFhqTFJbTEKi2tZH/dist=es2019,mode=imports/optimized/ansi_up.js": "./vendor/cdn.skypack.dev/-/ansi_up@v5.1.0-ifIRWFhqTFJbTEKi2tZH/dist=es2019,mode=imports/optimized/ansi_up.js",
"/-/binary-search-bounds@v2.0.5-c8IgO4OqUhed8ANHQXKv/dist=es2019,mode=imports/optimized/binary-search-bounds.js": "./vendor/cdn.skypack.dev/-/binary-search-bounds@v2.0.5-c8IgO4OqUhed8ANHQXKv/dist=es2019,mode=imports/optimized/binary-search-bounds.js",
"/-/blueimp-md5@v2.19.0-FsBtHB6ITwdC3L5Giq4Q/dist=es2019,mode=imports/optimized/blueimp-md5.js": "./vendor/cdn.skypack.dev/-/blueimp-md5@v2.19.0-FsBtHB6ITwdC3L5Giq4Q/dist=es2019,mode=imports/optimized/blueimp-md5.js",
Expand Down
5 changes: 3 additions & 2 deletions src/import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
"moment-guess": "https://cdn.skypack.dev/moment-guess@1.2.4",
"ansi_up": "https://cdn.skypack.dev/ansi_up@v5.1.0",
"lodash/": "https://cdn.skypack.dev/lodash@4.17.21/",
"acorn/acorn": "https://cdn.skypack.dev/acorn@7.4.1",
"acorn/walk": "https://cdn.skypack.dev/acorn-walk@7.2.0",
"acorn-class-fields": "https://cdn.skypack.dev/acorn-class-fields@1.0.0",
"acorn/acorn": "https://cdn.skypack.dev/acorn@8.4.0",
"acorn/walk": "https://cdn.skypack.dev/acorn-walk@8.2.0",
"binary-search-bounds": "https://cdn.skypack.dev/binary-search-bounds@2.0.5",
"blueimpMd5": "https://cdn.skypack.dev/blueimp-md5@2.19.0",
"diff": "https://cdn.skypack.dev/diff@5.0.0",
Expand Down
Loading