repo stringlengths 5 106 | file_url stringlengths 78 301 | file_path stringlengths 4 211 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:56:49 2026-01-05 02:23:25 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
webpack/webpack | https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/hot/poll.js | hot/poll.js | /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/* globals __resourceQuery */
if (module.hot) {
// eslint-disable-next-line no-implicit-coercion
var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000;
var log = require("./log");
/**
* @param {boolean... | javascript | MIT | d2a124db548cad6e84dffd93b502a4e74bfe2b6a | 2026-01-04T14:56:49.698101Z | false |
webpack/webpack | https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/hot/log.js | hot/log.js | /** @typedef {"info" | "warning" | "error"} LogLevel */
/** @type {LogLevel} */
var logLevel = "info";
function dummy() {}
/**
* @param {LogLevel} level log level
* @returns {boolean} true, if should log
*/
function shouldLog(level) {
var shouldLog =
(logLevel === "info" && level === "info") ||
(["info", "wa... | javascript | MIT | d2a124db548cad6e84dffd93b502a4e74bfe2b6a | 2026-01-04T14:56:49.698101Z | false |
webpack/webpack | https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/hot/emitter-event-target.js | hot/emitter-event-target.js | if (typeof EventTarget !== "function") {
throw new Error(
"Environment doesn't support lazy compilation (requires EventTarget)"
);
}
module.exports = new EventTarget();
| javascript | MIT | d2a124db548cad6e84dffd93b502a4e74bfe2b6a | 2026-01-04T14:56:49.698101Z | false |
webpack/webpack | https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/hot/load-http.js | hot/load-http.js | /**
* @param {boolean} isHTTPS true when need https module, otherwise false
* @returns {Promise<import("http") | import("https")>}
*/
module.exports = function (isHTTPS) {
return isHTTPS ? import("https") : import("http");
};
| javascript | MIT | d2a124db548cad6e84dffd93b502a4e74bfe2b6a | 2026-01-04T14:56:49.698101Z | false |
webpack/webpack | https://github.com/webpack/webpack/blob/d2a124db548cad6e84dffd93b502a4e74bfe2b6a/hot/only-dev-server.js | hot/only-dev-server.js | /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
/* globals __webpack_hash__ */
if (module.hot) {
/** @type {undefined | string} */
var lastHash;
var upToDate = function upToDate() {
return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
};
var ... | javascript | MIT | d2a124db548cad6e84dffd93b502a4e74bfe2b6a | 2026-01-04T14:56:49.698101Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/karma.conf.js | karma.conf.js | 'use strict';
module.exports = function (config) {
config.set({
frameworks: ['mocha'],
files: [
{ pattern: 'dist/tesseract.min.js', included: true },
{ pattern: 'dist/worker.min.js', included: false, served: true },
{ pattern: 'node_modules/tesseract.js-core/tesseract-core-simd-lstm.wasm.js... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/scripts/webpack.config.prod.js | scripts/webpack.config.prod.js | 'use strict';
const path = require('path');
const common = require('./webpack.config.common');
const webpack = require('webpack');
const genConfig = ({
entry, filename, library, libraryTarget,
}) => ({
...common,
mode: 'production',
devtool: 'source-map',
entry,
output: {
path: path.resolve(__dirname,... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/scripts/webpack.config.common.js | scripts/webpack.config.common.js | 'use strict';
module.exports = {
resolve: {
fallback: {
buffer: require.resolve('buffer/'),
},
},
module: {
rules: [
{
test: /\.m?js$/,
// exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets:... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/scripts/server.js | scripts/server.js | 'use strict';
const webpack = require('webpack');
const middleware = require('webpack-dev-middleware');
const express = require('express');
const path = require('path');
const cors = require('cors');
const webpackConfig = require('./webpack.config.prod');
const compiler = webpack(webpackConfig);
const app = express()... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/benchmarks/node/memory-benchmark.js | benchmarks/node/memory-benchmark.js | #!/usr/bin/env node
'use strict';
// Note: getting replicable results from this script requires:
// (1) Running with the `--expose-gc` flag,
// (2) adding `global.gc()` within the `index.js` file
// to force garbage collection within each worker after each iteration.
const path = require('path');
const { createWorke... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/benchmarks/node/speed-benchmark.js | benchmarks/node/speed-benchmark.js | #!/usr/bin/env node
'use strict';
const path = require('path');
const { createWorker } = require('../..');
(async () => {
const worker = await createWorker();
const fileArr = [
path.join(__dirname, '..', 'data', 'meditations.jpg'),
path.join(__dirname, '..', 'data', 'tyger.jpg'),
path.join(__dirname,... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/createWorker.js | src/createWorker.js | 'use strict';
const resolvePaths = require('./utils/resolvePaths');
const createJob = require('./createJob');
const { log } = require('./utils/log');
const getId = require('./utils/getId');
const OEM = require('./constants/OEM');
const {
defaultOptions,
spawnWorker,
terminateWorker,
onMessage,
loadImage,
s... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/createScheduler.js | src/createScheduler.js | 'use strict';
const createJob = require('./createJob');
const { log } = require('./utils/log');
const getId = require('./utils/getId');
let schedulerCounter = 0;
module.exports = () => {
const id = getId('Scheduler', schedulerCounter);
const workers = {};
const runningWorkers = {};
let jobQueue = [];
sche... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/index.js | src/index.js | 'use strict';
/**
*
* Entry point for tesseract.js, should be the entry when bundling.
*
* @fileoverview entry point for tesseract.js
* @author Kevin Kwok <antimatter15@gmail.com>
* @author Guillermo Webster <gui@mit.edu>
* @author Jerome Wu <jeromewus@gmail.com>
*/
require('regenerator-runtime/runtime');
cons... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/Tesseract.js | src/Tesseract.js | 'use strict';
const createWorker = require('./createWorker');
const recognize = async (image, langs, options) => {
const worker = await createWorker(langs, 1, options);
return worker.recognize(image)
.finally(async () => {
await worker.terminate();
});
};
const detect = async (image, options) => {
... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/createJob.js | src/createJob.js | 'use strict';
const getId = require('./utils/getId');
let jobCounter = 0;
module.exports = ({
id: _id,
action,
payload = {},
}) => {
let id = _id;
if (typeof id === 'undefined') {
id = getId('Job', jobCounter);
jobCounter += 1;
}
return {
id,
action,
payload,
};
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/node/send.js | src/worker/node/send.js | 'use strict';
/**
* send
*
* @name send
* @function send packet to worker and create a job
* @access public
*/
module.exports = async (worker, packet) => {
worker.postMessage(packet);
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/node/onMessage.js | src/worker/node/onMessage.js | 'use strict';
module.exports = (worker, handler) => {
worker.on('message', handler);
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/node/index.js | src/worker/node/index.js | 'use strict';
/**
*
* Tesseract Worker impl. for node (using child_process)
*
* @fileoverview Tesseract Worker impl. for node
* @author Kevin Kwok <antimatter15@gmail.com>
* @author Guillermo Webster <gui@mit.edu>
* @author Jerome Wu <jeromewus@gmail.com>
*/
const defaultOptions = require('./defaultOptions');
... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/node/defaultOptions.js | src/worker/node/defaultOptions.js | 'use strict';
const path = require('path');
const defaultOptions = require('../../constants/defaultOptions');
/*
* Default options for node worker
*/
module.exports = {
...defaultOptions,
workerPath: path.join(__dirname, '..', '..', 'worker-script', 'node', 'index.js'),
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/node/loadImage.js | src/worker/node/loadImage.js | 'use strict';
const util = require('util');
const fs = require('fs');
// Use built-in fetch if available, otherwise fallback to node-fetch
const fetch = global.fetch || require('node-fetch');
const isURL = require('is-url');
const readFile = util.promisify(fs.readFile);
/**
* loadImage
*
* @name loadImage
* @fun... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/node/terminateWorker.js | src/worker/node/terminateWorker.js | 'use strict';
/**
* terminateWorker
*
* @name terminateWorker
* @function kill worker
* @access public
*/
module.exports = (worker) => {
worker.terminate();
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/node/spawnWorker.js | src/worker/node/spawnWorker.js | 'use strict';
const { Worker } = require('worker_threads');
/**
* spawnWorker
*
* @name spawnWorker
* @function fork a new process in node
* @access public
*/
module.exports = ({ workerPath }) => new Worker(workerPath);
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/browser/send.js | src/worker/browser/send.js | 'use strict';
/**
* send
*
* @name send
* @function send packet to worker and create a job
* @access public
*/
module.exports = async (worker, packet) => {
worker.postMessage(packet);
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/browser/onMessage.js | src/worker/browser/onMessage.js | 'use strict';
module.exports = (worker, handler) => {
worker.onmessage = ({ data }) => { // eslint-disable-line
handler(data);
};
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/browser/index.js | src/worker/browser/index.js | 'use strict';
/**
*
* Tesseract Worker adapter for browser
*
* @fileoverview Tesseract Worker adapter for browser
* @author Kevin Kwok <antimatter15@gmail.com>
* @author Guillermo Webster <gui@mit.edu>
* @author Jerome Wu <jeromewus@gmail.com>
*/
const defaultOptions = require('./defaultOptions');
const spawnW... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/browser/defaultOptions.js | src/worker/browser/defaultOptions.js | 'use strict';
const version = require('../../../package.json').version;
const defaultOptions = require('../../constants/defaultOptions');
/*
* Default options for browser worker
*/
module.exports = {
...defaultOptions,
workerPath: `https://cdn.jsdelivr.net/npm/tesseract.js@v${version}/dist/worker.min.js`,
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/browser/loadImage.js | src/worker/browser/loadImage.js | 'use strict';
/**
* readFromBlobOrFile
*
* @name readFromBlobOrFile
* @function
* @access private
*/
const readFromBlobOrFile = (blob) => (
new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.onload = () => {
resolve(fileReader.result);
};
fileReader.onerror... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/browser/terminateWorker.js | src/worker/browser/terminateWorker.js | 'use strict';
/**
* terminateWorker
*
* @name terminateWorker
* @function terminate worker
* @access public
*/
module.exports = (worker) => {
worker.terminate();
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker/browser/spawnWorker.js | src/worker/browser/spawnWorker.js | 'use strict';
/**
* spawnWorker
*
* @name spawnWorker
* @function create a new Worker in browser
* @access public
*/
module.exports = ({ workerPath, workerBlobURL }) => {
let worker;
if (Blob && URL && workerBlobURL) {
const blob = new Blob([`importScripts("${workerPath}");`], {
type: 'application/... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/utils/getEnvironment.js | src/utils/getEnvironment.js | 'use strict';
module.exports = (key) => {
const env = {};
if (typeof WorkerGlobalScope !== 'undefined') {
env.type = 'webworker';
} else if (typeof document === 'object') {
env.type = 'browser';
} else if (typeof process === 'object' && typeof require === 'function') {
env.type = 'node';
}
if... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/utils/resolvePaths.js | src/utils/resolvePaths.js | 'use strict';
const isBrowser = require('./getEnvironment')('type') === 'browser';
const resolveURL = isBrowser ? s => (new URL(s, window.location.href)).href : s => s; // eslint-disable-line
module.exports = (options) => {
const opts = { ...options };
['corePath', 'workerPath', 'langPath'].forEach((key) => {
... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/utils/log.js | src/utils/log.js | 'use strict';
let logging = false;
exports.logging = logging;
exports.setLogging = (_logging) => {
logging = _logging;
};
exports.log = (...args) => (logging ? console.log.apply(this, args) : null);
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/utils/getId.js | src/utils/getId.js | 'use strict';
module.exports = (prefix, cnt) => (
`${prefix}-${cnt}-${Math.random().toString(16).slice(3, 8)}`
);
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/index.js | src/worker-script/index.js | 'use strict';
/**
*
* Worker script for browser and node
*
* @fileoverview Worker script for browser and node
* @author Kevin Kwok <antimatter15@gmail.com>
* @author Guillermo Webster <gui@mit.edu>
* @author Jerome Wu <jeromewus@gmail.com>
*/
require('regenerator-runtime/runtime');
const isURL = require('is-ur... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/node/getCore.js | src/worker-script/node/getCore.js | 'use strict';
const { simd, relaxedSimd } = require('wasm-feature-detect');
const OEM = require('../../constants/OEM');
let TesseractCore = null;
/*
* getCore is a sync function to load and return
* TesseractCore.
*/
module.exports = async (oem, _, res) => {
if (TesseractCore === null) {
const statusText = '... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/node/index.js | src/worker-script/node/index.js | 'use strict';
/**
*
* Tesseract Worker Script for Node
*
* @fileoverview Node worker implementation
* @author Kevin Kwok <antimatter15@gmail.com>
* @author Guillermo Webster <gui@mit.edu>
* @author Jerome Wu <jeromewus@gmail.com>
*/
// Use built-in fetch if available, otherwise fallback to node-fetch
const fet... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/node/cache.js | src/worker-script/node/cache.js | 'use strict';
const util = require('util');
const fs = require('fs');
module.exports = {
readCache: util.promisify(fs.readFile),
writeCache: util.promisify(fs.writeFile),
deleteCache: (path) => (
util.promisify(fs.unlink)(path)
.catch(() => {})
),
checkCache: (path) => (
util.promisify(fs.acce... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/node/gunzip.js | src/worker-script/node/gunzip.js | 'use strict';
module.exports = require('zlib').gunzipSync;
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/utils/dump.js | src/worker-script/utils/dump.js | 'use strict';
/**
*
* Dump data to a big JSON tree
*
* @fileoverview dump data to JSON tree
* @author Kevin Kwok <antimatter15@gmail.com>
* @author Guillermo Webster <gui@mit.edu>
* @author Jerome Wu <jeromewus@gmail.com>
*/
const arrayBufferToBase64 = require('./arrayBufferToBase64');
const imageType = requir... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/utils/arrayBufferToBase64.js | src/worker-script/utils/arrayBufferToBase64.js | 'use strict';
// Copied from https://gist.github.com/jonleighton/958841
// Copyright 2011 Jon Leighton, MIT LICENSE
/* eslint no-bitwise: 0 */
module.exports = (arrayBuffer) => {
let base64 = '';
const encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const bytes = new Uint8Array(... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/utils/setImage.js | src/worker-script/utils/setImage.js | 'use strict';
const bmp = require('bmp-js');
/**
* setImage
*
* @name setImage
* @function set image in tesseract for recognition
* @access public
*/
module.exports = (TessModule, api, image, angle = 0) => {
// Check for bmp magic numbers (42 and 4D in hex)
const isBmp = (image[0] === 66 && image[1] === 77)... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/browser/getCore.js | src/worker-script/browser/getCore.js | 'use strict';
const { simd, relaxedSimd } = require('wasm-feature-detect');
const coreVersion = require('../../../package.json').dependencies['tesseract.js-core'];
module.exports = async (lstmOnly, corePath, res) => {
if (typeof global.TesseractCore === 'undefined') {
const statusText = 'loading tesseract core'... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/browser/index.js | src/worker-script/browser/index.js | 'use strict';
/**
*
* Browser worker scripts
*
* @fileoverview Browser worker implementation
* @author Kevin Kwok <antimatter15@gmail.com>
* @author Guillermo Webster <gui@mit.edu>
* @author Jerome Wu <jeromewus@gmail.com>
*/
const worker = require('..');
const getCore = require('./getCore');
const gunzip = r... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/browser/cache.js | src/worker-script/browser/cache.js | 'use strict';
const { set, get, del } = require('idb-keyval');
module.exports = {
readCache: get,
writeCache: set,
deleteCache: del,
checkCache: (path) => (
get(path).then((v) => typeof v !== 'undefined')
),
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/browser/gunzip.js | src/worker-script/browser/gunzip.js | 'use strict';
module.exports = require('zlibjs').gunzipSync;
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/worker-script/constants/defaultOutput.js | src/worker-script/constants/defaultOutput.js | 'use strict';
/*
* default output formats for tesseract.js
*/
module.exports = {
text: true,
blocks: false,
layoutBlocks: false,
hocr: false,
tsv: false,
box: false,
unlv: false,
osd: false,
pdf: false,
imageColor: false,
imageGrey: false,
imageBinary: false,
debug: false,
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/constants/imageType.js | src/constants/imageType.js | 'use strict';
module.exports = {
COLOR: 0,
GREY: 1,
BINARY: 2,
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/constants/defaultOptions.js | src/constants/defaultOptions.js | 'use strict';
module.exports = {
/*
* Use BlobURL for worker script by default
* TODO: remove this option
*
*/
workerBlobURL: true,
logger: () => {},
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/constants/languages.js | src/constants/languages.js | 'use strict';
/*
* languages with existing tesseract traineddata
* https://tesseract-ocr.github.io/tessdoc/Data-Files#data-files-for-version-400-november-29-2016
*/
/**
* @typedef {object} Languages
* @property {string} AFR Afrikaans
* @property {string} AMH Amharic
* @property {string} ARA Arabic
* @property... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/constants/PSM.js | src/constants/PSM.js | 'use strict';
/*
* PSM = Page Segmentation Mode
*/
module.exports = {
OSD_ONLY: '0',
AUTO_OSD: '1',
AUTO_ONLY: '2',
AUTO: '3',
SINGLE_COLUMN: '4',
SINGLE_BLOCK_VERT_TEXT: '5',
SINGLE_BLOCK: '6',
SINGLE_LINE: '7',
SINGLE_WORD: '8',
CIRCLE_WORD: '9',
SINGLE_CHAR: '10',
SPARSE_TEXT: '11',
SPAR... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/src/constants/OEM.js | src/constants/OEM.js | 'use strict';
/*
* OEM = OCR Engine Mode, and there are 4 possible modes.
*
* By default tesseract.js uses LSTM_ONLY mode.
*
*/
module.exports = {
TESSERACT_ONLY: 0,
LSTM_ONLY: 1,
TESSERACT_LSTM_COMBINED: 2,
DEFAULT: 3,
};
| javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/examples/node/image-processing.js | examples/node/image-processing.js | #!/usr/bin/env node
'use strict';
const path = require('path');
const fs = require('fs');
const { createWorker } = require('../..');
const [,, imagePath] = process.argv;
const image = path.resolve(__dirname, (imagePath || '../data/meditations.jpg'));
console.log(`Recognizing ${image}`);
// Tesseract.js returns ima... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/examples/node/scheduler.js | examples/node/scheduler.js | 'use strict';
const path = require('path');
const { createWorker, createScheduler } = require('../..');
const [,, imagePath] = process.argv;
// Note: This example recognizes the same image 4 times in parallel
// to show how schedulers can be used to speed up bulk jobs.
// In actual use you would (obviously) not want... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/examples/node/download-pdf.js | examples/node/download-pdf.js | #!/usr/bin/env node
'use strict';
const path = require('path');
const fs = require('fs');
const { createWorker } = require('../..');
const [,, imagePath] = process.argv;
const image = path.resolve(__dirname, (imagePath || '../../tests/assets/images/cosmic.png'));
console.log(`Recognizing ${image}`);
(async () => {... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
naptha/tesseract.js | https://github.com/naptha/tesseract.js/blob/42eae669e4b3a66429d8516f078912cc747a89df/examples/node/recognize.js | examples/node/recognize.js | #!/usr/bin/env node
'use strict';
const path = require('path');
const { createWorker } = require('../..');
const [,, imagePath] = process.argv;
const image = path.resolve(__dirname, (imagePath || '../../tests/assets/images/cosmic.png'));
console.log(`Recognizing ${image}`);
(async () => {
const worker = await cr... | javascript | Apache-2.0 | 42eae669e4b3a66429d8516f078912cc747a89df | 2026-01-04T15:00:01.801420Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/.github/scripts/setup.js | .github/scripts/setup.js | const {spawn} = require('child_process');
const fs = require('fs').promises;
const path = require('path');
const chalk = require('chalk');
const inquirer = require('inquirer');
/**
* Run a command and stream output to the console
*
* @param {string} command
* @param {string[]} args
* @param {object} options
*/
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/.github/scripts/dependency-inspector.js | .github/scripts/dependency-inspector.js | #!/usr/bin/env node
'use strict';
const fs = require('fs');
const path = require('path');
const jsonc = require('jsonc-parser');
const { execSync } = require('child_process');
/**
* Smart lockfile drift detector that focuses on actionable updates
* and avoids API rate limits by using yarn's built-in commands where... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/.github/scripts/bump-version.js | .github/scripts/bump-version.js | const fs = require('fs/promises');
const exec = require('util').promisify(require('child_process').exec);
const path = require('path');
const core = require('@actions/core');
const semver = require('semver');
(async () => {
const corePackageJsonPath = path.join(__dirname, '../../ghost/core/package.json');
con... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/.github/scripts/dev-with-tinybird.js | .github/scripts/dev-with-tinybird.js | #!/usr/bin/env node
const {spawn, execSync} = require('child_process');
const fs = require('fs');
const path = require('path');
// Check if analytics containers are running
function checkAnalyticsRunning() {
try {
const output = execSync('docker ps --format "{{.Names}}"', {encoding: 'utf8'});
retu... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/.github/scripts/release-apps.js | .github/scripts/release-apps.js | const path = require('path');
const fs = require('fs/promises');
const exec = require('util').promisify(require('child_process').exec);
const readline = require('readline/promises');
const semver = require('semver');
// Maps a package name to the config key in defaults.json
const CONFIG_KEYS = {
'@tryghost/portal... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/.github/scripts/clean.js | .github/scripts/clean.js | // NOTE: this file can't use any NPM dependencies because it needs to run even if dependencies aren't installed yet or are corrupted
const {execSync} = require('child_process');
cleanYarnCache();
resetNxCache();
deleteNodeModules();
deleteBuildArtifacts();
console.log('Cleanup complete!');
function deleteBuildArtifac... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/.github/scripts/dev.js | .github/scripts/dev.js | const path = require('path');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const debug = require('debug')('ghost:dev');
const chalk = require('chalk');
const concurrently = require('concurrently');
debug('loading config');
const config = require('../../ghost/core/core/sha... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/pages.js | apps/portal/src/pages.js | import SigninPage from './components/pages/signin-page';
import SignupPage from './components/pages/signup-page';
import AccountHomePage from './components/pages/AccountHomePage/account-home-page';
import MagicLinkPage from './components/pages/magic-link-page';
import LoadingPage from './components/pages/loading-page';... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/app-context.js | apps/portal/src/app-context.js | // Ref: https://reactjs.org/docs/context.html
import React from 'react';
const AppContext = React.createContext({
site: {},
member: {},
action: '',
actionErrorMessage: null,
lastPage: '',
brandColor: '',
pageData: {},
doAction: (action, data) => {
return {action, data};
},
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/index.js | apps/portal/src/index.js | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './app';
const ROOT_DIV_ID = 'ghost-portal-root';
function addRootDiv() {
const elem = document.createElement('div');
elem.id = ROOT_DIV_ID;
elem.setAttribute('data-testid', 'portal-root');
document.body... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/app.js | apps/portal/src/app.js | import React from 'react';
import * as Sentry from '@sentry/react';
import i18n, {t} from './utils/i18n';
import {chooseBestErrorMessage} from './utils/errors';
import TriggerButton from './components/trigger-button';
import Notification from './components/notification';
import PopupModal from './components/popup-modal... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | true |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/data-attributes.js | apps/portal/src/data-attributes.js | /* eslint-disable no-console */
import {getCheckoutSessionDataFromPlanAttribute, getUrlHistory} from './utils/helpers';
import {HumanReadableError, chooseBestErrorMessage} from './utils/errors';
import {t} from './utils/i18n';
function displayErrorIfElementExists(errorEl, message) {
if (errorEl) {
errorEl.... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/actions.js | apps/portal/src/actions.js | import setupGhostApi from './utils/api';
import {chooseBestErrorMessage} from './utils/errors';
import {createPopupNotification, getMemberEmail, getMemberName, getProductCadenceFromPrice, removePortalLinkFromUrl, getRefDomain} from './utils/helpers';
import {t} from './utils/i18n';
function switchPage({data, state}) {... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/frame.js | apps/portal/src/components/frame.js | import {Component} from 'react';
import {createPortal} from 'react-dom';
export default class Frame extends Component {
componentDidMount() {
this.node.addEventListener('load', this.handleLoad);
}
handleLoad = () => {
this.setupFrameBaseStyle();
};
componentWillUnmout() {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/global.styles.js | apps/portal/src/components/global.styles.js | export const GlobalStyles = `
/* Colors
/* ----------------------------------------------------- */
:root {
--black: #000;
--blackrgb: 0,0,0;
--grey0: #1d1d1d;
--grey1: #333;
--grey1rgb: 33, 33, 33;
--grey2: #3d3d3d;
--grey3: #474747;
--grey4: ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/trigger-button.js | apps/portal/src/components/trigger-button.js | import React from 'react';
import Frame from './frame';
import MemberGravatar from './common/member-gravatar';
import AppContext from '../app-context';
import {ReactComponent as UserIcon} from '../images/icons/user.svg';
import {ReactComponent as ButtonIcon1} from '../images/icons/button-icon-1.svg';
import {ReactCompo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/notification.styles.js | apps/portal/src/components/notification.styles.js | import {GlobalStyles} from './global.styles';
const NotificationStyles = `
.gh-portal-notification-wrapper {
position: relative;
overflow: hidden;
height: 100%;
width: 100%;
}
.gh-portal-notification {
position: absolute;
display: flex;
gap: 12px;
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/popup-modal.js | apps/portal/src/components/popup-modal.js | import React from 'react';
import Frame from './frame';
import {hasMode} from '../utils/check-mode';
import AppContext from '../app-context';
import {getFrameStyles} from './frame.styles';
import Pages, {getActivePage} from '../pages';
import PopupNotification from './common/popup-notification';
import PoweredBy from '... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/notification.js | apps/portal/src/components/notification.js | import React from 'react';
import Frame from './frame';
import AppContext from '../app-context';
import NotificationStyle from './notification.styles';
import {ReactComponent as CloseIcon} from '../images/icons/close.svg';
import {ReactComponent as CheckmarkIcon} from '../images/icons/checkmark-fill.svg';
import {React... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/trigger-button.styles.js | apps/portal/src/components/trigger-button.styles.js | import {GlobalStyles} from './global.styles';
import {AvatarStyles} from './common/member-gravatar';
const TriggerButtonStyles = `
.gh-portal-triggerbtn-wrapper {
display: inline-flex;
align-items: flex-start;
justify-content: flex-end;
height: 100%;
opacity: 1;
tran... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/frame.styles.js | apps/portal/src/components/frame.styles.js | /** By default, CRAs webpack bundle combines and appends the main css at root level, so they are not applied inside iframe
* This uses a hack where we append `<style> </style>` tag with all CSS inside the head of iframe dynamically, thus making it available easily
* We can create separate variables to keep styles gro... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/email-suppressed-page.js | apps/portal/src/components/pages/email-suppressed-page.js | import AppContext from '../../app-context';
import {useContext, useEffect} from 'react';
import {hasCommentsEnabled, hasMultipleNewsletters} from '../../utils/helpers';
import CloseButton from '../common/close-button';
import BackButton from '../common/back-button';
import ActionButton from '../common/action-button';
i... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/account-profile-page.js | apps/portal/src/components/pages/account-profile-page.js | import React from 'react';
import AppContext from '../../app-context';
import MemberAvatar from '../common/member-gravatar';
import ActionButton from '../common/action-button';
import CloseButton from '../common/close-button';
import BackButton from '../common/back-button';
import InputForm from '../common/input-form';... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/signup-page.js | apps/portal/src/components/pages/signup-page.js | import React from 'react';
import ActionButton from '../common/action-button';
import AppContext from '../../app-context';
import CloseButton from '../common/close-button';
import SiteTitleBackButton from '../common/site-title-back-button';
import NewsletterSelectionPage from './newsletter-selection-page';
import Produ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/feedback-page.js | apps/portal/src/components/pages/feedback-page.js | import {useContext, useEffect, useState} from 'react';
import AppContext from '../../app-context';
import {ReactComponent as ThumbDownIcon} from '../../images/icons/thumbs-down.svg';
import {ReactComponent as ThumbUpIcon} from '../../images/icons/thumbs-up.svg';
import {ReactComponent as ThumbErrorIcon} from '../../ima... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/support-error.js | apps/portal/src/components/pages/support-error.js | import {useContext} from 'react';
import AppContext from '../../app-context';
import CloseButton from '../common/close-button';
import ActionButton from '../common/action-button';
import {ReactComponent as WarningIcon} from '../../images/icons/warning-outline.svg';
import * as Sentry from '@sentry/react';
import {t} fr... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/account-email-page.js | apps/portal/src/components/pages/account-email-page.js | import AppContext from '../../app-context';
import {useContext, useEffect, useState} from 'react';
import {isPaidMember, getSiteNewsletters, hasNewsletterSendingEnabled} from '../../utils/helpers';
import NewsletterManagement from '../common/newsletter-management';
import Interpolate from '@doist/react-interpolate';
im... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/newsletter-selection-page.js | apps/portal/src/components/pages/newsletter-selection-page.js | import AppContext from '../../app-context';
import {useContext, useState} from 'react';
import Switch from '../common/switch';
import {getSiteNewsletters, hasOnlyFreePlan} from '../../utils/helpers';
import ActionButton from '../common/action-button';
import {ReactComponent as LockIcon} from '../../images/icons/lock.sv... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/email-receiving-faq.js | apps/portal/src/components/pages/email-receiving-faq.js | import AppContext from '../../app-context';
import {useContext} from 'react';
import BackButton from '../common/back-button';
import CloseButton from '../common/close-button';
import {getDefaultNewsletterSender, getSupportAddress} from '../../utils/helpers';
import Interpolate from '@doist/react-interpolate';
import {t... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/unsubscribe-page.js | apps/portal/src/components/pages/unsubscribe-page.js | import AppContext from '../../app-context';
import ActionButton from '../common/action-button';
import {useContext, useEffect, useState} from 'react';
import {getSiteNewsletters,hasNewsletterSendingEnabled} from '../../utils/helpers';
import NewsletterManagement from '../common/newsletter-management';
import CloseButto... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/recommendations-page.js | apps/portal/src/components/pages/recommendations-page.js | import AppContext from '../../app-context';
import {useContext, useState, useEffect, useCallback, useMemo} from 'react';
import CloseButton from '../common/close-button';
import {clearURLParams} from '../../utils/notifications';
import LoadingPage from './loading-page';
import {ReactComponent as ArrowIcon} from '../../... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/email-suppression-faq.js | apps/portal/src/components/pages/email-suppression-faq.js | import AppContext from '../../app-context';
import {useContext} from 'react';
import BackButton from '../common/back-button';
import CloseButton from '../common/close-button';
import {getSupportAddress} from '../../utils/helpers';
import {t} from '../../utils/i18n';
export default function EmailSuppressedPage() {
... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/signin-page.js | apps/portal/src/components/pages/signin-page.js | import React from 'react';
import ActionButton from '../common/action-button';
import CloseButton from '../common/close-button';
// import SiteTitleBackButton from '../common/SiteTitleBackButton';
import AppContext from '../../app-context';
import InputForm from '../common/input-form';
import {ValidateInputForm} from '... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/offer-page.js | apps/portal/src/components/pages/offer-page.js | import React from 'react';
import ActionButton from '../common/action-button';
import AppContext from '../../app-context';
import {ReactComponent as CheckmarkIcon} from '../../images/icons/checkmark.svg';
import CloseButton from '../common/close-button';
import InputForm from '../common/input-form';
import {getCurrency... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/magic-link-page.js | apps/portal/src/components/pages/magic-link-page.js | import React from 'react';
import ActionButton from '../common/action-button';
import CloseButton from '../common/close-button';
import AppContext from '../../app-context';
import {ReactComponent as EnvelopeIcon} from '../../images/icons/envelope.svg';
import {t} from '../../utils/i18n';
export const MagicLinkStyles =... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/support-page.js | apps/portal/src/components/pages/support-page.js | import {useEffect, useState, useContext} from 'react';
import SupportError from './support-error';
import LoadingPage from './loading-page';
import setupGhostApi from '../../utils/api';
import AppContext from '../../app-context';
import {t} from '../../utils/i18n';
const SupportPage = () => {
const [isLoading, set... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/account-plan-page.js | apps/portal/src/components/pages/account-plan-page.js | import React, {useContext, useState} from 'react';
import AppContext from '../../app-context';
import ActionButton from '../common/action-button';
import CloseButton from '../common/close-button';
import BackButton from '../common/back-button';
import {MultipleProductsPlansSection} from '../common/plans-section';
impor... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/loading-page.js | apps/portal/src/components/pages/loading-page.js | import React from 'react';
import {ReactComponent as LoaderIcon} from '../../images/icons/loader.svg';
export default class LoadingPage extends React.Component {
render() {
return (
<div style={{display: 'flex', flexDirection: 'column', color: '#313131'}}>
<div style={{paddingLe... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/support-success.js | apps/portal/src/components/pages/support-success.js | import {useContext} from 'react';
import AppContext from '../../app-context';
import {ReactComponent as ConfettiIcon} from '../../images/icons/confetti.svg';
import CloseButton from '../common/close-button';
import ActionButton from '../common/action-button';
import {t} from '../../utils/i18n';
export const TipsAndDon... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/AccountHomePage/account-home-page.js | apps/portal/src/components/pages/AccountHomePage/account-home-page.js | import React from 'react';
import AppContext from '../../../app-context';
import {getSupportAddress} from '../../../utils/helpers';
import AccountFooter from './components/account-footer';
import AccountMain from './components/account-main';
import {isSigninAllowed} from '../../../utils/helpers';
export default class... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/AccountHomePage/components/email-preferences-action.js | apps/portal/src/components/pages/AccountHomePage/components/email-preferences-action.js | import AppContext from '../../../../app-context';
import {useContext} from 'react';
import {isEmailSuppressed, hasNewsletterSendingEnabled, hasCommentsEnabled} from '../../../../utils/helpers';
import {ReactComponent as EmailDeliveryFailedIcon} from '../../../../images/icons/email-delivery-failed.svg';
import {t} from ... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/AccountHomePage/components/continue-subscription-button.js | apps/portal/src/components/pages/AccountHomePage/components/continue-subscription-button.js | import AppContext from '../../../../app-context';
import ActionButton from '../../../common/action-button';
import {getMemberSubscription} from '../../../../utils/helpers';
import {getDateString} from '../../../../utils/date-time';
import {useContext} from 'react';
import {t} from '../../../../utils/i18n';
const Conti... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/AccountHomePage/components/paid-account-actions.js | apps/portal/src/components/pages/AccountHomePage/components/paid-account-actions.js | import AppContext from '../../../../app-context';
import {allowCompMemberUpgrade, getCompExpiry, getMemberSubscription, getMemberTierName, getUpdatedOfferPrice, hasMultipleProductsFeature, hasOnlyFreePlan, isComplimentaryMember, isPaidMember, isInThePast, subscriptionHasFreeTrial} from '../../../../utils/helpers';
impo... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
TryGhost/Ghost | https://github.com/TryGhost/Ghost/blob/31ecb69a147e71743e74014b4e04ccce09ab8c1a/apps/portal/src/components/pages/AccountHomePage/components/user-header.js | apps/portal/src/components/pages/AccountHomePage/components/user-header.js | import AppContext from '../../../../app-context';
import MemberAvatar from '../../../common/member-gravatar';
import {useContext} from 'react';
import {t} from '../../../../utils/i18n';
const UserHeader = () => {
const {member, brandColor} = useContext(AppContext);
const avatar = member.avatar_image;
retur... | javascript | MIT | 31ecb69a147e71743e74014b4e04ccce09ab8c1a | 2026-01-04T14:57:14.657301Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.