@ripple-ts/typescript-plugin 0.2.178 → 0.2.180
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/package.json +2 -2
- package/src/language.js +6 -29
- package/src/utils.js +35 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "TypeScript plugin for Ripple",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.180",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"homepage": "https://ripplejs.com",
|
|
9
9
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"typescript": "^5.9.2",
|
|
26
|
-
"ripple": "0.2.
|
|
26
|
+
"ripple": "0.2.180"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsdown",
|
package/src/language.js
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
// @ts-expect-error type-only import from ESM module into CJS is fine
|
|
3
3
|
/** @import { CodeMapping } from 'ripple/compiler' */
|
|
4
4
|
/** @typedef {Map<string, CodeMapping>} CachedMappings */
|
|
5
|
-
|
|
6
|
-
const ts = require('typescript');
|
|
7
|
-
const { forEachEmbeddedCode } = require('@volar/language-core');
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
|
|
11
5
|
/** @typedef {import('typescript').CompilerOptions} CompilerOptions */
|
|
12
6
|
/** @typedef {Error & { pos?: number }} RippleError */
|
|
13
7
|
/** @typedef {import('@volar/language-core').IScriptSnapshot} IScriptSnapshot */
|
|
@@ -18,30 +12,13 @@ const path = require('path');
|
|
|
18
12
|
// @ts-expect-error type-only import from ESM module into CJS is fine
|
|
19
13
|
/** @typedef {import('ripple/compiler')} RippleCompiler */
|
|
20
14
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function log(...args) {
|
|
27
|
-
if (DEBUG) {
|
|
28
|
-
console.log('[Ripple Language]', ...args);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @param {...unknown} args
|
|
34
|
-
*/
|
|
35
|
-
function logError(...args) {
|
|
36
|
-
console.error('[Ripple Language ERROR]', ...args);
|
|
37
|
-
}
|
|
15
|
+
const ts = require('typescript');
|
|
16
|
+
const { forEachEmbeddedCode } = require('@volar/language-core');
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const { createLogging, DEBUG } = require('./utils.js');
|
|
38
20
|
|
|
39
|
-
|
|
40
|
-
* @param {...unknown} args
|
|
41
|
-
*/
|
|
42
|
-
function logWarning(...args) {
|
|
43
|
-
console.warn('[Ripple Language WARNING]', ...args);
|
|
44
|
-
}
|
|
21
|
+
const { log, logWarning, logError } = createLogging('[Ripple Language]');
|
|
45
22
|
|
|
46
23
|
/**
|
|
47
24
|
* @returns {RippleLanguagePlugin}
|
package/src/utils.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const DEBUG = process.env.RIPPLE_DEBUG === 'true';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a logging utility with a specific label
|
|
5
|
+
* @param {string} label
|
|
6
|
+
* @returns {{
|
|
7
|
+
* log: (...args: unknown[]) => void,
|
|
8
|
+
* logError: (...args: unknown[]) => void,
|
|
9
|
+
* logWarning: (...args: unknown[]) => void,
|
|
10
|
+
* }}
|
|
11
|
+
*/
|
|
12
|
+
function createLogging(label) {
|
|
13
|
+
return {
|
|
14
|
+
log(...args) {
|
|
15
|
+
if (DEBUG) {
|
|
16
|
+
console.log(label, ...args);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
logError(...args) {
|
|
20
|
+
if (DEBUG) {
|
|
21
|
+
console.error(label, ...args);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
logWarning(...args) {
|
|
25
|
+
if (DEBUG) {
|
|
26
|
+
console.warn(label, ...args);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
createLogging,
|
|
34
|
+
DEBUG,
|
|
35
|
+
};
|