Skip to content

Commit

Permalink
code reorder refacotor
Browse files Browse the repository at this point in the history
  • Loading branch information
dux committed Jul 31, 2024
1 parent 82be3aa commit 9df050e
Show file tree
Hide file tree
Showing 16 changed files with 824 additions and 756 deletions.
2 changes: 1 addition & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (kind === 'w') {
await esbuild.build(opts)

} else {
console.error('ERROR: OPT w|b|d not selected')
console.error('ERROR: OPT w|b not selected')
}

cliRun(`ls -lh ${opts.outdir}`)
28 changes: 14 additions & 14 deletions demo/fez/clock.fez
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<script type="coffee">
export default class
setVars () ->
time = new Date()
@state.time = time
@state.hours = time.getHours()
@state.minutes = time.getMinutes();
@state.seconds = time.getSeconds();

connect () ->
@setVars()
@setInterval(this.setVars, 1000)
<script>
setVars() {
let time = new Date();
this.state.time = time
this.state.hours = time.getHours();
this.state.minutes = time.getMinutes();
this.state.seconds = time.getSeconds();
}

connect() {
this.setVars()
this.setInterval(this.setVars, 1000)
}
</script>

<style>
Expand Down Expand Up @@ -45,8 +46,7 @@
stroke: #666;
}

.second,
.second-counterweight {
.second, .second-counterweight {
stroke: rgb(180, 0, 0);
}

Expand Down
2 changes: 2 additions & 0 deletions dist/fez-loader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions dist/fez-loader.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions dist/fez.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/fez.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h1>
<a target="repo" href="https://github.com/dux/fez">GitHub repo</a>
</h1>

<p>Fez was created by <a href="https://github.com/dux/">@dux</a> in 2024. Latest update was <script>document.write(timeSince('Tue Jul 30 02:41:34 2024 +0200'))</script>.
<p>Fez was created by <a href="https://github.com/dux/">@dux</a> in 2024. Latest update was <script>document.write(timeSince('Tue Jul 30 02:49:40 2024 +0200'))</script>.


<script src="./demo/fez/clock.js"></script>
Expand Down
48 changes: 48 additions & 0 deletions src/fez-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// adapt
// https://github.com/johnie/esbuild-coffeescript/blob/master/index.js

// const { readFile } = require('fs/promises');
// const path = require('path');
// const coffeescript = require('coffeescript');

// const omit = (obj, keys) =>
// Object.keys(obj)
// .filter((key) => !keys.includes(key))
// .reduce((res, key) => Object.assign(res, { [key]: obj[key] }), {});

// const compileCoffee = (code, options) => coffeescript.compile(code, options);

// const convertMessage = ({ message, location, code, filename }) => {
// location = {
// file: filename,
// line: location.first_line,
// column: location.first_column,
// length: location.first_line - location.last_column,
// lineText: code,
// };
// return { text: message, location };
// };

// const coffeeScriptPlugin = (options = {}) => ({
// name: 'coffeescript',
// setup(build) {
// build.onLoad({ filter: /.\.(coffee|litcoffee)$/ }, async (args) => {
// const source = await readFile(args.path, 'utf8');
// const filename = path.relative(process.cwd(), args.path);
// const opt = omit(options, ['sourceMap']);

// try {
// const contents = compileCoffee(source, { filename, ...opt });
// return {
// contents,
// };
// } catch (e) {
// return {
// errors: [convertMessage(e)],
// };
// }
// });
// },
// });

// module.exports = coffeeScriptPlugin;
Loading

0 comments on commit 9df050e

Please sign in to comment.