Skip to content

Commit

Permalink
Bundle (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
samestep authored Jun 26, 2023
1 parent a9d785e commit d42e38f
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 18 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ prettier: yarn
npx prettier --check .

# build `packages/`
packages: core vscode wasm
packages: core site vscode wasm

# run JavaScript tests
test-js: test-core
Expand All @@ -63,6 +63,11 @@ core: yarn wasm
test-core: yarn wasm
yarn workspace rose test run

## `packages/site`

site: yarn core
yarn workspace @rose-lang/site build

## `packages/vscode`

# fetch encircled icon
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"prettier-plugin-organize-imports": "^3",
"typescript": "^5",
"esbuild": "^0.17.19",
"vite": "^4",
"vite-plugin-top-level-await": "^1",
"vitest": "^0.31.2"
}
}
20 changes: 5 additions & 15 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
// basic stuff, or everything breaks
"module": "ESNext",
"moduleResolution": "node16",
"lib": ["ESNext"],
"skipLibCheck": true,

// build config
"rootDir": "src",
"outDir": "dist",
"declaration": true,
"sourceMap": true,
"declarationMap": true,

// typechecking
"noFallthroughCasesInSwitch": true,
"strict": true
}
"outDir": "dist",
"sourceMap": true
},
"include": ["src"]
}
12 changes: 12 additions & 0 deletions packages/site/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Rose</title>
</head>
<body>
<pre><code id="code"></code></pre>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions packages/site/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@rose-lang/site",
"version": "0.0.0",
"private": true,
"type": "module",
"dependencies": {
"rose": "0.0.0"
},
"scripts": {
"build": "vite build",
"dev": "vite",
"preview": "vite preview"
}
}
4 changes: 4 additions & 0 deletions packages/site/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as rose from "rose";

const elem = document.getElementById("code");
if (elem !== null) elem.innerText = JSON.stringify(rose, null, 2);
1 change: 1 addition & 0 deletions packages/site/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "../../tsconfig.json", "include": ["src"] }
4 changes: 4 additions & 0 deletions packages/site/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defineConfig } from "vite";
import topLevelAwait from "vite-plugin-top-level-await";

export default defineConfig({ plugins: [topLevelAwait()] });
15 changes: 15 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"lib": [
"DOM", // https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
"ES2021" // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
],
"module": "ES2022", // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#top_level_await
"moduleResolution": "node16",
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022" // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#top_level_await
}
}
89 changes: 87 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,77 @@
resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==

"@rollup/plugin-virtual@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-virtual/-/plugin-virtual-3.0.1.tgz#cea7e489481cc0ca91516c047f8c53c1cfb1adf6"
integrity sha512-fK8O0IL5+q+GrsMLuACVNk2x21g3yaw+sG2qn16SnUd3IlBsQyvWxLMGHmCmXRMecPjGRSZ/1LmZB4rjQm68og==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.66.tgz#b34a396479ca8fc82876d6dfb28c78a51010e6ce"
integrity sha512-UijJsvuLy73vxeVYEy7urIHksXS+3BdvJ9s9AY+bRMSQW483NO7RLp8g4FdTyJbRaN0BH15SQnY0dcjQBkVuHw==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.66.tgz#b778e434d29652eae6da6ee7ed335605f7cfd866"
integrity sha512-xGsHKvViQnwTNLF30Y/5OqWdnN6RsiyUI8awZXfz1sHcXCEaLe+v+WLQ+/E8sgw0YUkYVHzzfV/sAN2CezJK5Q==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.66.tgz#a7ab556dc9fc770069fea292ff5551161df83a70"
integrity sha512-gNbLcSIV2pq90BkMSpzvK4xPXOl8GEF3YR4NaqF0CYSzQsVXXTTqMuX/r26xNYudBKzH0345S1MpoRk2qricnA==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.66.tgz#00591f5fd0d9f1d1ed565329936451eb6d0d5433"
integrity sha512-cJSQ0oplyWbJqy4rzVcnBYLAi6z1QT3QCcR7iAey0aAmCvfRBZJfXlyjggMjn4iosuadkauwCZR1xYNhBDRn7w==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.66.tgz#dd8e5e7b1154b5a42a32d57914e0de2cef6686ff"
integrity sha512-GDQZpcB9aGxG9PTA2shdIkoMZlGK5omJ8NR49uoBTtLBVYiGeXAwV0U1Uaw8kXEZj9i7wZDkvjzjSaNH3evRsg==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.66.tgz#35de4b88e3f256e7923503a8031569c733859b68"
integrity sha512-lg8E4O/Pd9KfK0lajdinVMuGME8dSv7V9arhEpmlfGE2eXSDCWqDn5Htk5QVBstt9lt1lsRhWHJ/YYc2eQY30Q==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.66.tgz#623de62c638a31cda5d44014b981290e3f79f6de"
integrity sha512-lo8ZcAO/zL2pZWH+LZIyge8u2MklaeuT6+FpVVpBFktMVdYXbaVtzpvWbgRFBZHvL3SRDF+u8jxjtkXhvGUpTw==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.66.tgz#49a432f43a314666e681a98801d7b2d303e5ef75"
integrity sha512-cQoVwBuJY5WkHbfpCOlndNwYr1ZThatRjQQvKy540NUIeAEk9Fa6ozlDBtU75UdaWKtUG6YQ/bWz+KTemheVxw==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.66.tgz#80c8af627b46de67fbac05908025e764194669ad"
integrity sha512-y/FrAIINK4UBeUQQknGlWXEyjo+MBvjF7WkUf2KP7sNr9EHHy8+dXohAGd5Anz0eJrqOM1ZXR/GEjxRp7bGQ1Q==

"@swc/[email protected]":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.66.tgz#7984da6bf1f1a5410c2e6514dc2814abb2e6c91a"
integrity sha512-yI64ACzS14qFLrfyO12qW+f/UROTotzDeEbuyJAaPD2IZexoT1cICznI3sBmIfrSt33mVuW8eF5m3AG/NUImzw==

"@swc/core@^1.3.10":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.66.tgz#d07e4c9cd49205881171ee1ffd04f824ecea2f25"
integrity sha512-Hpf91kH5ly7fHkWnApwryTQryT+TO4kMMPH3WyciUSQOWLE3UuQz1PtETHQQk7PZ/b1QF0qQurJrgfBr5bSKUA==
optionalDependencies:
"@swc/core-darwin-arm64" "1.3.66"
"@swc/core-darwin-x64" "1.3.66"
"@swc/core-linux-arm-gnueabihf" "1.3.66"
"@swc/core-linux-arm64-gnu" "1.3.66"
"@swc/core-linux-arm64-musl" "1.3.66"
"@swc/core-linux-x64-gnu" "1.3.66"
"@swc/core-linux-x64-musl" "1.3.66"
"@swc/core-win32-arm64-msvc" "1.3.66"
"@swc/core-win32-ia32-msvc" "1.3.66"
"@swc/core-win32-x64-msvc" "1.3.66"

"@types/chai-subset@^1.3.3":
version "1.3.3"
resolved "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz"
Expand Down Expand Up @@ -1214,6 +1285,11 @@ util-deprecate@^1.0.1:
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==

uuid@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==

[email protected]:
version "0.31.2"
resolved "https://registry.npmjs.org/vite-node/-/vite-node-0.31.2.tgz"
Expand All @@ -1226,9 +1302,18 @@ [email protected]:
picocolors "^1.0.0"
vite "^3.0.0 || ^4.0.0"

"vite@^3.0.0 || ^4.0.0":
vite-plugin-top-level-await@^1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/vite-plugin-top-level-await/-/vite-plugin-top-level-await-1.3.1.tgz#7e7293be01489b508692627529c0a3b3218a23a3"
integrity sha512-55M1h4NAwkrpxPNOJIBzKZFihqLUzIgnElLSmPNPMR2Fn9+JHKaNg3sVX1Fq+VgvuBksQYxiD3OnwQAUu7kaPQ==
dependencies:
"@rollup/plugin-virtual" "^3.0.1"
"@swc/core" "^1.3.10"
uuid "^9.0.0"

"vite@^3.0.0 || ^4.0.0", vite@^4:
version "4.3.9"
resolved "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz"
resolved "https://registry.yarnpkg.com/vite/-/vite-4.3.9.tgz#db896200c0b1aa13b37cdc35c9e99ee2fdd5f96d"
integrity sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==
dependencies:
esbuild "^0.17.5"
Expand Down

0 comments on commit d42e38f

Please sign in to comment.