Skip to content

Commit

Permalink
trying to run ember-eui
Browse files Browse the repository at this point in the history
explore - sub expressions in on modifier
word boundary replacement
fix compiler, add helper/modifier/component helpers
better modifiers
EuiAccordion, EuiPanel
pretty plugin

+

+

carrying args exploration

+

+

+

+

playing with ember component

reactivity inside let argument

+

+
  • Loading branch information
lifeart committed Feb 6, 2024
1 parent 97f7b88 commit 26624b1
Show file tree
Hide file tree
Showing 54 changed files with 4,802 additions and 200 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<link rel="stylesheet" href="/src/style.css" />
</head>
<body>
<script>
window.global = window;
</script>
<div id="app"><!--ssr-outlet--></div>
<script type="module">
import App from "/src/index.ts";
Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,23 @@
"devDependencies": {
"@glint/core": "^1.3.0",
"@glint/template": "^1.3.0",
"@babel/core": "^7.23.6",
"@babel/plugin-syntax-decorators": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/standalone": "^7.23.8",
"@ember-eui/core": "^8.0.4",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@glint/environment-ember-template-imports": "^1.2.1",
"@glint/environment-glimmerx": "^1.2.1",
"@lifeart/tiny-router": "^0.0.8",
"@playwright/test": "^1.40.1",
"@types/babel__core": "^7.20.5",
"@types/qunit": "^2.19.9",
"autoprefixer": "^10.4.16",
"babel-import-util": "^2.0.1",
"backburner.js": "^2.8.0",
"express": "^4.18.2",
"happy-dom": "^13.0.6",
"nyc": "^15.1.0",
"postcss": "^8.4.33",
"prettier": "^3.1.1",
Expand All @@ -90,8 +101,6 @@
"vite-plugin-dts": "^3.7.0",
"vitest": "^1.1.1",
"zx": "^7.2.3",
"express": "^4.18.2",
"happy-dom": "^13.0.6",
"glint-environment-gxt": "file:./glint-environment-gxt"
},
"dependencies": {
Expand Down
21 changes: 20 additions & 1 deletion plugins/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export function processTemplate(
);
}
},
CallExpression(path: any) {
// @ts-expect-error context is not used
CallExpression(path: any, context: Context) {
if (path.node.callee && path.node.callee.type === 'Identifier') {
if (path.node.callee.name === 'scope') {
path.remove();
Expand All @@ -122,6 +123,24 @@ export function processTemplate(
path.node.arguments.pop();
}
}
} else if (path.node.callee.name === 'precompileTemplate') {
// const template = path.node.arguments[0].quasis[0].value
// .raw as string;
// const isInsideClassBody = context.isInsideClassBody === true;
// const hasThisInTemplate = template.includes('this');
// let hasThisAccess =
// isInsideClassBody === true || hasThisInTemplate;
// // looks like it's function based template, we don't need to mess with it's context hell
// if (context.isInsideReturnStatement === true) {
// hasThisAccess = true;
// }
// hbsToProcess.push({
// template,
// flags: {
// hasThisAccess: hasThisAccess,
// },
// });
// path.replaceWith(t.identifier('$placeholder'));
}
}
},
Expand Down
12 changes: 8 additions & 4 deletions plugins/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Plugin } from 'vite';
import { Preprocessor } from 'content-tag';
import { transform } from './test';
import { MAIN_IMPORT } from './symbols';
// import { MAIN_IMPORT } from './symbols';
import { type Flags, defaultFlags } from './flags.ts';
import { HMR, fixExportsForHMR, shouldHotReloadFile } from './hmr.ts';

Expand Down Expand Up @@ -50,6 +50,7 @@ export function compiler(mode: string, options: Options = {}): Plugin {
} else {
defineValues = {};
}
defineValues['process.env.BABEL_TYPES_8_BREAKING'] = false;

return {
define: defineValues,
Expand Down Expand Up @@ -83,12 +84,15 @@ export function compiler(mode: string, options: Options = {}): Plugin {
);
}
}
if (!code.includes(MAIN_IMPORT)) {
return;
}
// if (!code.includes(MAIN_IMPORT)) {
// return;
// }
let result: string | undefined = undefined;
if (scriptFileRegex.test(file)) {
const source = code;
// if (code.includes('precompileTemplate')) {
// console.log(code);
// }
const result = transform(
source,
file,
Expand Down
2 changes: 1 addition & 1 deletion plugins/converter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ASTv1 } from '@glimmer/syntax';
import { type ASTv1 } from '@glimmer/syntax';
import {
type HBSControlExpression,
type HBSNode,
Expand Down
2 changes: 2 additions & 0 deletions plugins/decorator-transforms/globals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as runtime from './runtime.ts';
(globalThis as any)['dt7948'] = runtime;
Loading

0 comments on commit 26624b1

Please sign in to comment.