Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
/* eslint-disable node/no-unpublished-require */
/*
This script is pretty useful for launching a single template compilation
with our script:
node --inspect-brk lib/sample-compile-script.js
*/
const compiler = require('ember-source/dist/ember-template-compiler');
compiler.registerPlugin('ast', require('./ast-transform'));
let template = '<@nav.item />';
let output = compiler.precompile(template, { contents: template });
console.log(output); // eslint-disable-line no-console
'use strict';
/* eslint-disable node/no-unpublished-require */
/*
This script is pretty useful for launching a single template compilation
with our script:
node --inspect-brk lib/sample-compile-script.js
*/
const compiler = require('ember-source/dist/ember-template-compiler');
compiler.registerPlugin('ast', require('./ast-transform'));
let template = '<@nav.item />';
let output = compiler.precompile(template, { contents: template });
console.log(output); // eslint-disable-line no-console
/* eslint-env node */
// Inject the named blocks polyfill into the template compiler (and then into the babel plugin)
const templateCompiler = require('ember-source/dist/ember-template-compiler');
const namedBlocksPolyfillPlugin = require('ember-named-blocks-polyfill/lib/named-blocks-polyfill-plugin');
templateCompiler.registerPlugin('ast', namedBlocksPolyfillPlugin);
module.exports = {
presets: [
[
'@babel/preset-env',
{
shippedProposals: true,
useBuiltIns: 'usage',
corejs: '3',
targets: ['last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions'],
},
],
],
plugins: [
[
'@babel/plugin-proposal-decorators',
const Ember = require('ember-source/dist/ember.debug');
const { dasherize } = Ember.String;
const { pluralize } = require('inflection');
const { isEqual, get, uniqBy } = require('lodash');
const log = require('@cardstack/logger')('cardstack/ethereum/indexer');
const { declareInjections } = require('@cardstack/di');
const { fieldTypeFor } = require('./abi-utils');
const { apply_patch } = require('jsonpatch');
module.exports = declareInjections({
searchers: 'hub:searchers',
ethereumClient: `plugin-services:${require.resolve('./client')}`,
eventIndexer: `plugin-services:${require.resolve('./event-indexer')}`,
transactionIndexer: `plugin-services:${require.resolve('./transaction-indexer')}`
},
class EthereumIndexer {
const Ember = require('ember-source/dist/ember.debug');
const { dasherize } = Ember.String;
function solidityTypeToInternalType(type) {
switch(type) {
case 'uint8':
case 'uint16':
case 'uint32':
case 'uint64':
case 'uint128':
case 'uint256':
return 'number';
case 'bool':
return 'boolean';
case 'address':
return 'address';
case 'bytes32':
case 'string':
const Ember = require('ember-source/dist/ember.debug');
const { dasherize } = Ember.String;
const { pluralize, singularize } = require('inflection');
const { declareInjections } = require('@cardstack/di');
const Session = require('@cardstack/plugin-utils/session');
const log = require('@cardstack/logger')('cardstack/ethereum/event-indexer');
const { fieldTypeFor } = require('./abi-utils');
const { get, set, uniqBy, merge } = require('lodash');
function attachMeta(model, meta) {
model.meta = Object.assign(model.meta || {}, meta);
return model;
}
module.exports = declareInjections({
indexer: 'hub:indexers',
searchers: 'hub:searchers',
currentSchema: 'hub:current-schema',
const Ember = require('ember-source/dist/ember.debug');
const { dasherize } = Ember.String;
const log = require('@cardstack/logger')('cardstack/drupal');
exports.cardstackToDrupalDoc = cardstackToDrupalDoc;
function cardstackToDrupalDoc(doc, schemaModels) {
let newDoc = {
id: doc.id,
type: doc.type
};
if (doc.relationships) {
newDoc.relationships = {};
for (let [key, value] of Object.entries(doc.relationships)) {
let field = schemaModels.find(m => m.type === 'fields' && m.id === key);
if (field && field.meta['drupal-name']) {
newDoc.relationships[field.meta['drupal-name']] = value;
} else {
const Ember = require('ember-source/dist/ember.debug');
const { camelize } = Ember.String;
const Handlebars = require('handlebars');
const { declareInjections } = require('@cardstack/di');
const template = Handlebars.compile(`
{{#each properties as |property|}}
export const {{property.name}} = "{{property.value}}";
{{/each}}
`);
module.exports = declareInjections({
sources: 'hub:data-sources',
},
class EthereumCodeGenerator {
const Ember = require('ember-source/dist/ember.debug');
const { dasherize, camelize, capitalize } = Ember.String;
const { pluralize, singularize } = require('inflection');
const Web3 = require('web3');
const log = require('@cardstack/logger')('cardstack/ethereum/client');
const { get } = require('lodash');
const { promisify } = require('util');
const timeout = promisify(setTimeout);
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
const NULL_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
const MAX_WS_MESSAGE_SIZE_BYTES = 20000000;
module.exports = class EthereumClient {
static create(...args) {
return new this(...args);
}
module.exports = function(defaults) {
let emberVersion = require('ember-source/package.json').version;
let supportsNoJQuery = emberVersion.match(/^[\^~]?3.\d+.\d+.*$/);
let app = new EmberAddon(defaults, {
vendorFiles: supportsNoJQuery ? { 'jquery.js': null } : undefined
});
/*
This build file specifies the options for the dummy test app of this
addon, located in `/tests/dummy`
This build file does *not* influence how the addon or the app using it
behave. You most likely want to be modifying `./index.js` or app's build file
*/
return app.toTree();
};