Compare commits

...

10 Commits

Author SHA1 Message Date
15be1dd3e1 add: analytics
Some checks failed
Deploy Vue with GitHub Pages dependencies preinstalled / build (push) Has been cancelled
Deploy Vue with GitHub Pages dependencies preinstalled / deploy (push) Has been cancelled
2024-11-01 08:51:34 +01:00
1709c3966f 0.0.3 2023-04-15 15:48:47 +01:00
7035d80b33 update package-lock 2023-04-15 15:48:35 +01:00
f4319a2884 0.0.2 2023-04-14 19:57:12 +01:00
f6061596f4 update codemirror 2023-04-14 19:56:59 +01:00
95833a3779 0.0.1 2023-04-14 18:58:04 +01:00
de4259d6e5 update packages lock 2023-04-14 18:57:59 +01:00
ee9f084e48 add next flag to AST parser 2023-04-14 18:57:27 +01:00
0bb7215843 fix: addDefaultLog - ignore 'use strict' literal 2023-01-09 22:56:39 +01:00
b6872f03b8 fix: don't send empty data 2023-01-03 16:23:26 +01:00
6 changed files with 1688 additions and 5690 deletions

7340
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "Instacode",
"description": "Scratchpad for instant JavaScript code running",
"version": "0.0.0",
"version": "0.0.3",
"author": "Grzegorz Kućmierz",
"homepage": "https://github.com/gkucmierz/instacode-app",
"scripts": {
@@ -11,8 +11,10 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},
"dependencies": {
"@codemirror/lang-javascript": "^6.1.1",
"@analytics/google-analytics": "^1.0.7",
"@codemirror/lang-javascript": "^6.1.6",
"@codemirror/theme-one-dark": "^6.1.0",
"analytics": "^0.8.14",
"codemirror": "^6.0.1",
"copy-to-clipboard": "^3.3.3",
"eventemitter3": "^4.0.7",

View File

@@ -3,6 +3,16 @@ import { defineComponent } from 'vue';
import HelpModal from './components/HelpModal.vue';
import ShareModal from './components/ShareModal.vue';
import Analytics from 'analytics';
import googleAnalytics from '@analytics/google-analytics';
const analytics = Analytics({
app: 'instacode-app',
plugins: [googleAnalytics({ measurementIds: ['G-919025NJDJ'] })]
});
analytics.page();
export default defineComponent({
components: {
HelpModal,

View File

@@ -13,7 +13,7 @@ export default defineComponent({
Codemirror,
},
data() {
const extensions = [javascript(), oneDark]
const extensions = [javascript(), oneDark];
// Codemirror EditorView instance ref
const view = shallowRef();

View File

@@ -42,10 +42,13 @@ const throttledPM = (() => {
}
if (lastUpdate + updateDelay <= now || finish) {
pm(limitData(dataCache.join('\n')));
const data = limitData(dataCache.join('\n'));
if (data) {
pm(data);
lastUpdate = now;
dataCache = [];
}
}
if (tryAgain) {
const nextTick = fn => setTimeout(fn, 0);

View File

@@ -3,8 +3,10 @@ import { parseScript } from 'meriyah';
export const addDefaultLog = code => {
const lines = code.split('\n');
const tree = parseScript(code, { loc: true });
const tree = parseScript(code, {
loc: true,
next: true,
});
const insert = ({ line, column }, str, trim = false) => {
const l = lines[line-1];
lines[line-1] = [
@@ -16,6 +18,11 @@ export const addDefaultLog = code => {
const exprs = (tree.body
.filter(node => node.type === 'ExpressionStatement')
.filter(node => {
if (node.expression.type !== 'Literal') return true;
if (node.expression.value !== 'use strict') return true;
return false;
})
.filter(node => {
const expr = node.expression;
if (expr.type !== 'CallExpression') return true;