@danielx/civet 0.2.10 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -8,9 +8,11 @@ declare module "@danielx/civet" {
8
8
  export function parse(source: string): CivetAST
9
9
  export function generate(ast: CivetAST, options?: CompileOptions): string
10
10
 
11
- export default interface Civet {
11
+ const Civet: {
12
12
  compile: typeof compile;
13
13
  parse: typeof parse;
14
14
  generate: typeof generate;
15
15
  }
16
+
17
+ export default Civet;
16
18
  }
@@ -0,0 +1,26 @@
1
+ const { readFile } = require('fs/promises');
2
+ const path = require('path');
3
+ const { compile } = require("./");
4
+
5
+ module.exports = {
6
+ name: 'civet',
7
+ setup(build) {
8
+ build.onLoad({
9
+ filter: /\.civet/
10
+ }, async function (args) {
11
+ return readFile(args.path, 'utf8')
12
+ .then(function (source) {
13
+ const filename = path.relative(process.cwd(), args.path);
14
+ return {
15
+ contents: compile(source, { filename, js: true })
16
+ };
17
+ }).catch(function (e) {
18
+ return {
19
+ errors: [{
20
+ text: e.message
21
+ }]
22
+ };
23
+ });
24
+ });
25
+ }
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.2.10",
3
+ "version": "0.2.13",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/types.d.ts",
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "files": [
11
11
  "dist/",
12
+ "esbuild-plugin.js",
12
13
  "register.js",
13
14
  "register.mjs"
14
15
  ],