-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
321 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule excalidraw
added at
b7d7cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
diff --git a/src/packages/utils/index.js b/src/packages/utils/index.js | ||
index 4dc03e93..c739646d 100644 | ||
--- a/src/packages/utils/index.js | ||
+++ b/src/packages/utils/index.js | ||
@@ -1 +1,6 @@ | ||
-export { exportToBlob, exportToSvg, exportToCanvas } from "../utils.ts"; | ||
+export { | ||
+ loadFromBlob, | ||
+ exportToBlob, | ||
+ exportToSvg, | ||
+ exportToCanvas, | ||
+} from "../utils.ts"; | ||
diff --git a/src/packages/utils/package.json b/src/packages/utils/package.json | ||
index 7375e8b5..c2ba6275 100644 | ||
--- a/src/packages/utils/package.json | ||
+++ b/src/packages/utils/package.json | ||
@@ -41,6 +41,7 @@ | ||
"@babel/plugin-transform-typescript": "7.18.8", | ||
"@babel/preset-env": "7.18.9", | ||
"@babel/preset-typescript": "7.18.6", | ||
+ "autoprefixer": "10.4.7", | ||
"babel-loader": "8.2.5", | ||
"babel-plugin-transform-class-properties": "6.24.1", | ||
"cross-env": "7.0.3", | ||
@@ -50,7 +51,8 @@ | ||
"ts-loader": "9.3.1", | ||
"webpack": "5.76.0", | ||
"webpack-bundle-analyzer": "4.5.0", | ||
- "webpack-cli": "4.10.0" | ||
+ "webpack-cli": "4.10.0", | ||
+ "import-meta-loader": "1.1.0" | ||
}, | ||
"bugs": "https://github.com/excalidraw/excalidraw/issues", | ||
"repository": "https://github.com/excalidraw/excalidraw", | ||
diff --git a/src/packages/utils/webpack.prod.config.js b/src/packages/utils/webpack.prod.config.js | ||
index 7238ad02..18f38dfd 100644 | ||
--- a/src/packages/utils/webpack.prod.config.js | ||
+++ b/src/packages/utils/webpack.prod.config.js | ||
@@ -1,4 +1,5 @@ | ||
const webpack = require("webpack"); | ||
+const autoprefixer = require("autoprefixer"); | ||
const path = require("path"); | ||
const BundleAnalyzerPlugin = | ||
require("webpack-bundle-analyzer").BundleAnalyzerPlugin; | ||
@@ -23,11 +24,38 @@ module.exports = { | ||
{ | ||
test: /\.(sa|sc|c)ss$/, | ||
exclude: /node_modules/, | ||
- use: ["style-loader", { loader: "css-loader" }, "sass-loader"], | ||
+ use: [ | ||
+ "style-loader", | ||
+ { | ||
+ loader: "css-loader", | ||
+ }, | ||
+ { | ||
+ loader: "postcss-loader", | ||
+ options: { | ||
+ postcssOptions: { | ||
+ plugins: [autoprefixer()], | ||
+ }, | ||
+ }, | ||
+ }, | ||
+ "sass-loader", | ||
+ ], | ||
}, | ||
+ // So that type module works with webpack | ||
+ // https://github.com/webpack/webpack/issues/11467#issuecomment-691873586 | ||
{ | ||
- test: /\.(ts|tsx|js)$/, | ||
+ test: /\.m?js/, | ||
+ resolve: { | ||
+ fullySpecified: false, | ||
+ }, | ||
+ }, | ||
+ { | ||
+ test: /\.(ts|tsx|js|jsx|mjs)$/, | ||
+ exclude: | ||
+ /node_modules[\\/](?!(browser-fs-access|canvas-roundrect-polyfill))/, | ||
use: [ | ||
+ { | ||
+ loader: "import-meta-loader", | ||
+ }, | ||
{ | ||
loader: "ts-loader", | ||
options: { | ||
@@ -37,18 +65,24 @@ module.exports = { | ||
}, | ||
{ | ||
loader: "babel-loader", | ||
- | ||
options: { | ||
presets: [ | ||
"@babel/preset-env", | ||
["@babel/preset-react", { runtime: "automatic" }], | ||
"@babel/preset-typescript", | ||
], | ||
- plugins: [["@babel/plugin-transform-runtime"]], | ||
+ plugins: [ | ||
+ "transform-class-properties", | ||
+ "@babel/plugin-transform-runtime", | ||
+ ], | ||
}, | ||
}, | ||
], | ||
}, | ||
+ { | ||
+ test: /\.(woff|woff2|eot|ttf|otf)$/, | ||
+ type: "asset/resource", | ||
+ }, | ||
], | ||
}, | ||
plugins: [ | ||
diff --git a/src/packages/utils/yarn.lock b/src/packages/utils/yarn.lock | ||
index c10a5aed..10a3c51b 100644 | ||
--- a/src/packages/utils/yarn.lock | ||
+++ b/src/packages/utils/yarn.lock | ||
@@ -1231,6 +1231,18 @@ ansi-styles@^4.1.0: | ||
dependencies: | ||
color-convert "^2.0.1" | ||
|
||
+[email protected]: | ||
+ version "10.4.7" | ||
+ resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.7.tgz#1db8d195f41a52ca5069b7593be167618edbbedf" | ||
+ integrity sha512-ypHju4Y2Oav95SipEcCcI5J7CGPuvz8oat7sUtYj3ClK44bldfvtvcxK6IEK++7rqB7YchDGzweZIBG+SD0ZAA== | ||
+ dependencies: | ||
+ browserslist "^4.20.3" | ||
+ caniuse-lite "^1.0.30001335" | ||
+ fraction.js "^4.2.0" | ||
+ normalize-range "^0.1.2" | ||
+ picocolors "^1.0.0" | ||
+ postcss-value-parser "^4.2.0" | ||
+ | ||
babel-code-frame@^6.26.0: | ||
version "6.26.0" | ||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" | ||
@@ -1393,6 +1405,16 @@ browserslist@^4.14.5, browserslist@^4.20.2, browserslist@^4.21.2: | ||
node-releases "^2.0.6" | ||
update-browserslist-db "^1.0.4" | ||
|
||
+browserslist@^4.20.3: | ||
+ version "4.22.2" | ||
+ resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.2.tgz#704c4943072bd81ea18997f3bd2180e89c77874b" | ||
+ integrity sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A== | ||
+ dependencies: | ||
+ caniuse-lite "^1.0.30001565" | ||
+ electron-to-chromium "^1.4.601" | ||
+ node-releases "^2.0.14" | ||
+ update-browserslist-db "^1.0.13" | ||
+ | ||
buffer-from@^1.0.0: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" | ||
@@ -1406,6 +1428,11 @@ call-bind@^1.0.0: | ||
function-bind "^1.1.1" | ||
get-intrinsic "^1.0.2" | ||
|
||
+caniuse-lite@^1.0.30001335, caniuse-lite@^1.0.30001565: | ||
+ version "1.0.30001568" | ||
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001568.tgz#53fa9297273c9a977a560663f48cbea1767518b7" | ||
+ integrity sha512-vSUkH84HontZJ88MiNrOau1EBrCqEQYgkC5gIySiDlpsm8sGVrhU7Kx4V6h0tnqaHzIHZv08HlJIwPbL4XL9+A== | ||
+ | ||
caniuse-lite@^1.0.30001366: | ||
version "1.0.30001367" | ||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001367.tgz#2b97fe472e8fa29c78c5970615d7cd2ee414108a" | ||
@@ -1585,6 +1612,11 @@ electron-to-chromium@^1.4.188: | ||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.195.tgz#139b2d95a42a3f17df217589723a1deac71d1473" | ||
integrity sha512-vefjEh0sk871xNmR5whJf9TEngX+KTKS3hOHpjoMpauKkwlGwtMz1H8IaIjAT/GNnX0TbGwAdmVoXCAzXf+PPg== | ||
|
||
+electron-to-chromium@^1.4.601: | ||
+ version "1.4.610" | ||
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.610.tgz#e17b22203f4aa2e1ed77759c720546d95a51186f" | ||
+ integrity sha512-mqi2oL1mfeHYtOdCxbPQYV/PL7YrQlxbvFEZ0Ee8GbDdShimqt2/S6z2RWqysuvlwdOrQdqvE0KZrBTipAeJzg== | ||
+ | ||
emojis-list@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" | ||
@@ -1700,6 +1732,11 @@ find-up@^4.0.0: | ||
locate-path "^5.0.0" | ||
path-exists "^4.0.0" | ||
|
||
+fraction.js@^4.2.0: | ||
+ version "4.3.7" | ||
+ resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7" | ||
+ integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew== | ||
+ | ||
function-bind@^1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" | ||
@@ -1788,6 +1825,11 @@ import-local@^3.0.2: | ||
pkg-dir "^4.2.0" | ||
resolve-cwd "^3.0.0" | ||
|
||
+[email protected]: | ||
+ version "1.1.0" | ||
+ resolved "https://registry.yarnpkg.com/import-meta-loader/-/import-meta-loader-1.1.0.tgz#927060305f2d0f88b495f2754aa33387ca6579d7" | ||
+ integrity sha512-f96r2o8xT+b2KVlOY4x+1KTJmJiapZlf77j1WebR8NQgMG1dpdqijjGl4i/2jMoXch2CVqcQoTMfh5BR7bR8wA== | ||
+ | ||
indexes-of@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" | ||
@@ -1990,11 +2032,21 @@ neo-async@^2.6.2: | ||
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" | ||
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== | ||
|
||
+node-releases@^2.0.14: | ||
+ version "2.0.14" | ||
+ resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" | ||
+ integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== | ||
+ | ||
node-releases@^2.0.6: | ||
version "2.0.6" | ||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" | ||
integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== | ||
|
||
+normalize-range@^0.1.2: | ||
+ version "0.1.2" | ||
+ resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" | ||
+ integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA== | ||
+ | ||
object-keys@^1.0.12, object-keys@^1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" | ||
@@ -2448,6 +2500,14 @@ uniq@^1.0.1: | ||
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" | ||
integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= | ||
|
||
+update-browserslist-db@^1.0.13: | ||
+ version "1.0.13" | ||
+ resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" | ||
+ integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== | ||
+ dependencies: | ||
+ escalade "^3.1.1" | ||
+ picocolors "^1.0.0" | ||
+ | ||
update-browserslist-db@^1.0.4: | ||
version "1.0.5" | ||
resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz#be06a5eedd62f107b7c19eb5bcefb194411abf38" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ | |
|
||
base-pkgs = with pkgs; [ | ||
bun | ||
yarn | ||
nodejs_latest | ||
pandoc | ||
pandoc-norg-rs.packages.${system}.default | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import { spawnSync } from "node:child_process"; | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
export const project_root = path.join(__dirname, ".."); | ||
|
||
const excalidrawDir = path.join(project_root, "excalidraw"); | ||
const excalidrawPkgDir = path.join(excalidrawDir, "src/packages/utils"); | ||
|
||
const gitRevCheck = spawnSync( | ||
"git", | ||
[ | ||
"apply", | ||
"--reverse", | ||
"--check", | ||
path.join(project_root, "excalidraw.patch"), | ||
], | ||
{ | ||
cwd: excalidrawDir, | ||
}, | ||
); | ||
|
||
if (gitRevCheck.status != 0) { | ||
spawnSync("git", ["apply", path.join(project_root, "excalidraw.patch")], { | ||
cwd: excalidrawDir, | ||
stdio: "inherit", | ||
}); | ||
} else { | ||
console.error("Excalidraw patch already applied"); | ||
} | ||
|
||
let res = spawnSync("yarn", ["--frozen-lockfile"], { | ||
stdio: "inherit", | ||
cwd: excalidrawDir, | ||
}); | ||
|
||
if (res.error) throw res.error; | ||
|
||
res = spawnSync("yarn", ["--frozen-lockfile"], { | ||
stdio: "inherit", | ||
cwd: excalidrawPkgDir, | ||
}); | ||
|
||
if (res.error) throw res.error; | ||
|
||
res = spawnSync("rm", ["-rf", "dist"], { | ||
stdio: "inherit", | ||
cwd: excalidrawPkgDir, | ||
}); | ||
|
||
if (res.error) throw res.error; | ||
|
||
res = spawnSync("yarn", ["run", "build:umd"], { | ||
stdio: "inherit", | ||
cwd: excalidrawPkgDir, | ||
env: { | ||
NODE_ENV: "production", | ||
}, | ||
}); | ||
|
||
if (res.error) throw res.error; | ||
|
||
res = spawnSync("bun", ["install", "--ignore-scripts", "--frozen-lockfile"], { | ||
stdio: "inherit", | ||
}); | ||
|
||
if (res.error) throw res.error; |