type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration
|
private normaliseX(x);
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private workOutNewIndex(displayedColumns, allColumns, dragColumn, hDirection, xAdjustedForScroll);
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private checkCenterForScrolling(xAdjustedForScroll);
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
onDragging(draggingEvent: DraggingEvent, fromEnter?: boolean): void;
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private normaliseDirection(hDirection);
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private attemptMoveColumns(allMovingColumns, hDirection, xAdjusted, fromEnter);
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private getNewIndexForColMovingLeft(displayedColumns, allColumns, dragColumn, x);
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private getNewIndexForColMovingRight(displayedColumns, allColumns, dragColumnOrGroup, x);
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private ensureIntervalStarted();
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private ensureIntervalCleared();
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
MethodDeclaration
|
private moveInterval();
|
contata-dennemeyer/ag-grid
|
dist/lib/headerRendering/moveColumnController.d.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Dispatcher is like Reducer but with more freedom - receive the action and the entire state and mutates it.
*/
export interface ActionListener<T extends ActionType> extends AL<ActionType, ActionTypeMap, ACTION_LISTENER> {
/**
* Since in this "agile" code we could be registering listeners / reducers/sagas in the middle of UI code, we
* want to ensure they are unique and well identified with names form a central dictionary
*/
id: ACTION_LISTENER
listenerType: ActionListenerType
actionType: T
handle<T extends ActionType, A extends ActionTypeMap[T]>(action: A, state: State): void
}
|
cancerberoSgx/typescript-ast-explorer
|
src/store/actions.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* centralized action map to typed actions
*/
export interface ActionTypeMap {
[ActionType.NODE_SELECTION]: NodeSelectionAction
}
|
cancerberoSgx/typescript-ast-explorer
|
src/store/actions.ts
|
TypeScript
|
EnumDeclaration
|
/**
* name convention Like redux actions they are expect to come with an event payload
*/
export enum ActionType {
NODE_SELECTION = 'node:selection'
}
|
cancerberoSgx/typescript-ast-explorer
|
src/store/actions.ts
|
TypeScript
|
EnumDeclaration
|
export enum ACTION_LISTENER {
/**
* will just change the state after node selection
*/
reduceNodeSelection = 'reduceNodeSelection',
/**
* on explorerDetails UI, it will update the table and the value text when a node is selected
*/
updateDetailsViewOnNodeSelection = 'updateDetailsViewOnNodeSelection',
/**
* updates the code view UI when a node is selected
*/
updateCodeViewOnNodeSelection = 'updateCodeViewOnNodeSelection'
}
|
cancerberoSgx/typescript-ast-explorer
|
src/store/actions.ts
|
TypeScript
|
ClassDeclaration
|
/**
* A Token that represents a reference between two constructs
*
* References are recorded.
*/
export class Reference extends Token {
/**
* Check whether this is actually a Reference
*/
public static isReference(x: Token): x is Reference {
return (x as any)[REFERENCE_SYMBOL] === true;
}
public readonly target: Construct;
constructor(value: any, displayName: string, target: Construct) {
super(value, displayName);
this.target = target;
Object.defineProperty(this, REFERENCE_SYMBOL, { value: true });
}
}
|
KnisterPeter/aws-cdk
|
packages/@aws-cdk/cdk/lib/reference.ts
|
TypeScript
|
MethodDeclaration
|
/**
* Check whether this is actually a Reference
*/
public static isReference(x: Token): x is Reference {
return (x as any)[REFERENCE_SYMBOL] === true;
}
|
KnisterPeter/aws-cdk
|
packages/@aws-cdk/cdk/lib/reference.ts
|
TypeScript
|
ArrowFunction
|
(props) => {
const { id } = useParams<{ id: string }>()
return (
<div className={csses.container}>
<Card
hoverable
style={{ width: 240 }}
|
humpbackjs/boilerplate
|
src/components/card.tsx
|
TypeScript
|
ArrowFunction
|
(e) => message.info(e.value)
|
humpbackjs/boilerplate
|
src/components/card.tsx
|
TypeScript
|
FunctionDeclaration
|
function title(resource?: Uri, interpreter?: PythonInterpreter) {
return `${resource ? 'With a resource' : 'Without a resource'}${interpreter ? ' and an interpreter' : ''}`;
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
FunctionDeclaration
|
async function verifyCreateActivated(
factory: PythonExecutionFactory,
activationHelper: IEnvironmentActivationService,
resource?: Uri,
interpreter?: PythonInterpreter
): Promise<IPythonExecutionService> {
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve();
const service = await factory.createActivatedEnvironment({ resource, interpreter });
verify(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).once();
return service;
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
bufferDecoder = mock(BufferDecoder);
activationHelper = mock(EnvironmentActivationService);
processFactory = mock(ProcessServiceFactory);
configService = mock(ConfigurationService);
condaService = mock(CondaService);
processLogger = mock(ProcessLogger);
windowsStoreInterpreter = mock(WindowsStoreInterpreter);
executionService = typemoq.Mock.ofType<IPythonExecutionService>();
executionService.setup((p: any) => p.then).returns(() => undefined);
when(processLogger.logProcess('', [], {})).thenReturn();
processService = typemoq.Mock.ofType<IProcessService>();
processService
.setup((p) =>
p.on('exec', () => {
return;
})
)
.returns(() => processService.object);
processService.setup((p: any) => p.then).returns(() => undefined);
interpreterService = mock(InterpreterService);
when(interpreterService.getInterpreterDetails(anything())).thenResolve({
version: { major: 3 }
} as any);
const serviceContainer = mock(ServiceContainer);
when(serviceContainer.get<IDisposableRegistry>(IDisposableRegistry)).thenReturn([]);
when(serviceContainer.get<IProcessLogger>(IProcessLogger)).thenReturn(processLogger);
when(serviceContainer.get<IInterpreterService>(IInterpreterService)).thenReturn(
instance(interpreterService)
);
when(serviceContainer.tryGet<IInterpreterService>(IInterpreterService)).thenReturn(
instance(interpreterService)
);
factory = new PythonExecutionFactory(
instance(serviceContainer),
instance(activationHelper),
instance(processFactory),
instance(configService),
instance(condaService),
instance(bufferDecoder),
instance(windowsStoreInterpreter)
);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
(p: any) => p.then
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
(p) =>
p.on('exec', () => {
return;
})
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
() => {
return;
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
() => processService.object
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
() => sinon.restore()
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonSettings = mock(PythonSettings);
when(processFactory.create(resource)).thenResolve(processService.object);
when(activationHelper.getActivatedEnvironmentVariables(resource)).thenResolve({ x: '1' });
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(resource)).thenReturn(instance(pythonSettings));
const service = await factory.create({ resource });
expect(service).to.not.equal(undefined);
verify(processFactory.create(resource)).once();
verify(pythonSettings.pythonPath).once();
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonPath = 'path/to/python';
const pythonSettings = mock(PythonSettings);
when(processFactory.create(resource)).thenResolve(processService.object);
when(pythonSettings.pythonPath).thenReturn(pythonPath);
when(configService.getSettings(resource)).thenReturn(instance(pythonSettings));
let createInvoked = false;
const mockExecService = 'something';
factory.create = async (_options: ExecutionFactoryCreationOptions) => {
createInvoked = true;
return Promise.resolve((mockExecService as any) as IPythonExecutionService);
};
const service = await verifyCreateActivated(factory, activationHelper, resource, interpreter);
assert.deepEqual(service, mockExecService);
assert.equal(createInvoked, true);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async (_options: ExecutionFactoryCreationOptions) => {
createInvoked = true;
return Promise.resolve((mockExecService as any) as IPythonExecutionService);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
let createInvoked = false;
const mockExecService = 'something';
factory.create = async (_options: ExecutionFactoryCreationOptions) => {
createInvoked = true;
return Promise.resolve((mockExecService as any) as IPythonExecutionService);
};
const pythonSettings = mock(PythonSettings);
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({
x: '1'
});
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(resource)).thenReturn(instance(pythonSettings));
const service = await factory.createActivatedEnvironment({ resource, interpreter });
expect(service).to.not.equal(undefined);
verify(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).once();
if (!interpreter) {
verify(pythonSettings.pythonPath).once();
}
assert.equal(createInvoked, false);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonPath = 'path/to/python';
const pythonSettings = mock(PythonSettings);
when(processFactory.create(resource)).thenResolve(processService.object);
when(pythonSettings.pythonPath).thenReturn(pythonPath);
when(configService.getSettings(resource)).thenReturn(instance(pythonSettings));
when(windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath)).thenReturn(true);
const service = await factory.create({ resource });
expect(service).to.not.equal(undefined);
verify(processFactory.create(resource)).once();
verify(pythonSettings.pythonPath).once();
verify(windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath)).once();
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonPath = 'path/to/python';
when(condaService.getCondaEnvironment(pythonPath)).thenResolve({
name: 'foo',
path: 'path/to/foo/env'
});
when(condaService.getCondaVersion()).thenResolve(new SemVer(CONDA_RUN_VERSION));
when(condaService.getCondaFile()).thenResolve('conda');
const result = await factory.createCondaExecutionService(pythonPath, processService.object, resource);
expect(result).to.not.equal(undefined);
verify(condaService.getCondaVersion()).once();
verify(condaService.getCondaEnvironment(pythonPath)).once();
verify(condaService.getCondaFile()).once();
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonPath = 'path/to/python';
when(processFactory.create(resource)).thenResolve(processService.object);
when(condaService.getCondaEnvironment(pythonPath)).thenResolve({
name: 'foo',
path: 'path/to/foo/env'
});
when(condaService.getCondaVersion()).thenResolve(new SemVer(CONDA_RUN_VERSION));
when(condaService.getCondaFile()).thenResolve('conda');
const result = await factory.createCondaExecutionService(pythonPath, undefined, resource);
expect(result).to.not.equal(undefined);
verify(processFactory.create(resource)).once();
verify(condaService.getCondaVersion()).once();
verify(condaService.getCondaEnvironment(pythonPath)).once();
verify(condaService.getCondaFile()).once();
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonPath = 'path/to/python';
when(condaService.getCondaEnvironment(pythonPath)).thenResolve(undefined);
when(condaService.getCondaVersion()).thenResolve(new SemVer(CONDA_RUN_VERSION));
const result = await factory.createCondaExecutionService(pythonPath, processService.object);
expect(result).to.be.equal(
undefined,
'createCondaExecutionService should return undefined if not in a conda environment'
);
verify(condaService.getCondaVersion()).once();
verify(condaService.getCondaEnvironment(pythonPath)).once();
verify(condaService.getCondaFile()).once();
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonPath = 'path/to/python';
when(condaService.getCondaVersion()).thenResolve(new SemVer('1.0.0'));
const result = await factory.createCondaExecutionService(pythonPath, processService.object);
expect(result).to.be.equal(
undefined,
'createCondaExecutionService should return undefined if not in a conda environment'
);
verify(condaService.getCondaVersion()).once();
verify(condaService.getCondaEnvironment(pythonPath)).once();
verify(condaService.getCondaFile()).once();
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonSettings = mock(PythonSettings);
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({
x: '1'
});
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(anything())).thenReturn(instance(pythonSettings));
factory.createActivatedEnvironment = () => Promise.resolve(executionService.object);
const initialize = sinon.stub(PythonDaemonExecutionServicePool.prototype, 'initialize');
initialize.returns(Promise.resolve());
const daemon = await factory.createDaemon({ resource, pythonPath: item.interpreter?.path });
expect(daemon).instanceOf(PythonDaemonExecutionServicePool);
expect(initialize.callCount).to.equal(1);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
() => Promise.resolve(executionService.object)
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonSettings = mock(PythonSettings);
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({
x: '1'
});
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(anything())).thenReturn(instance(pythonSettings));
reset(interpreterService);
when(interpreterService.getInterpreterDetails(anything(), anything())).thenResolve({
version: parse('2.7.14')
} as any);
factory.createActivatedEnvironment = () => Promise.resolve(executionService.object);
const initialize = sinon.stub(PythonDaemonExecutionServicePool.prototype, 'initialize');
initialize.returns(Promise.resolve());
const daemon = await factory.createDaemon({ resource, pythonPath: item.interpreter?.path });
expect(daemon).not.instanceOf(PythonDaemonExecutionServicePool);
expect(initialize.callCount).to.equal(0);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonSettings = mock(PythonSettings);
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({
x: '1'
});
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(anything())).thenReturn(instance(pythonSettings));
factory.createActivatedEnvironment = () => Promise.resolve(executionService.object);
const initialize = sinon.stub(PythonDaemonExecutionServicePool.prototype, 'initialize');
initialize.returns(Promise.resolve());
const daemon1 = await factory.createDaemon({ resource, pythonPath: item.interpreter?.path });
const daemon2 = await factory.createDaemon({ resource, pythonPath: item.interpreter?.path });
expect(daemon1).to.equal(daemon2);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonSettings = mock(PythonSettings);
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({
x: '1'
});
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(anything())).thenReturn(instance(pythonSettings));
factory.createActivatedEnvironment = () => Promise.resolve(executionService.object);
const initialize = sinon.stub(PythonDaemonExecutionServicePool.prototype, 'initialize');
initialize.returns(Promise.resolve());
const daemon1 = await factory.createDaemon({ resource });
when(pythonSettings.pythonPath).thenReturn('HELLO2');
const daemon2 = await factory.createDaemon({ resource });
expect(daemon1).to.not.equal(daemon2);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonSettings = mock(PythonSettings);
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({
x: '1'
});
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(anything())).thenReturn(instance(pythonSettings));
factory.createActivatedEnvironment = () => Promise.resolve(executionService.object);
const initialize = sinon.stub(PythonDaemonExecutionServicePool.prototype, 'initialize');
initialize.returns(Promise.resolve());
const [daemon1, daemon2] = await Promise.all([
factory.createDaemon({ resource, pythonPath: item.interpreter?.path }),
factory.createDaemon({ resource, pythonPath: item.interpreter?.path })
]);
expect(daemon1).to.equal(daemon2);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const pythonSettings = mock(PythonSettings);
const pythonExecService = ({ dummy: 1 } as any) as IPythonExecutionService;
when(activationHelper.getActivatedEnvironmentVariables(resource, anything(), anything())).thenResolve({
x: '1'
});
when(pythonSettings.pythonPath).thenReturn('HELLO');
when(configService.getSettings(anything())).thenReturn(instance(pythonSettings));
factory.createActivatedEnvironment = () => Promise.resolve(pythonExecService);
const initialize = sinon.stub(PythonDaemonExecutionServicePool.prototype, 'initialize');
initialize.returns(Promise.reject(new Error('Kaboom')));
const daemon = await factory.createDaemon({ resource, pythonPath: item.interpreter?.path });
expect(daemon).not.instanceOf(PythonDaemonExecutionServicePool);
expect(initialize.callCount).to.equal(1);
expect(daemon).equal(pythonExecService);
}
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
ArrowFunction
|
() => Promise.resolve(pythonExecService)
|
AgrawalAmey/vscode-python
|
src/test/common/process/pythonExecutionFactory.unit.test.ts
|
TypeScript
|
FunctionDeclaration
|
export async function generateEsm(config: d.Config, compilerCtx: d.CompilerCtx, buildCtx: d.BuildCtx, rollupBuild: RollupBuild, outputTargets: d.OutputTargetDistLazy[]) {
const esmEs5Outputs = config.buildEs5 ? outputTargets.filter(o => !!o.esmEs5Dir && !o.isBrowserBuild) : [];
const esmOutputs = outputTargets.filter(o => !!o.esmDir && !o.isBrowserBuild);
if (esmOutputs.length + esmEs5Outputs.length > 0) {
const esmOpts: OutputOptions = {
format: 'es',
entryFileNames: '[name].mjs',
preferConst: true
};
const output = await generateRollupOutput(rollupBuild, esmOpts, config, buildCtx.entryModules);
if (output != null) {
const es2017destinations = esmOutputs.map(o => o.esmDir);
await generateLazyModules(config, compilerCtx, buildCtx, es2017destinations, output, 'es2017', false, '');
const es5destinations = esmEs5Outputs.map(o => o.esmEs5Dir);
await generateLazyModules(config, compilerCtx, buildCtx, es5destinations, output, 'es5', false, '');
await copyPolyfills(config, compilerCtx, esmOutputs);
await generateShortcuts(config, compilerCtx, outputTargets, output);
}
}
}
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
FunctionDeclaration
|
async function copyPolyfills(config: d.Config, compilerCtx: d.CompilerCtx, outputTargets: d.OutputTargetDistLazy[]) {
const destinations = outputTargets.filter(o => o.polyfills).map(o => o.esmDir);
if (destinations.length === 0) {
return;
}
const src = config.sys.path.join(config.sys.compiler.packageDir, 'internal', 'client', 'polyfills');
const files = await compilerCtx.fs.readdir(src);
await Promise.all(destinations.map(dest => {
return Promise.all(files.map(f => {
return compilerCtx.fs.copyFile(
f.absPath,
config.sys.path.join(dest, 'polyfills', f.relPath));
}));
}));
}
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
FunctionDeclaration
|
function generateShortcuts(config: d.Config, compilerCtx: d.CompilerCtx, outputTargets: d.OutputTargetDistLazy[], rollupResult: RollupResult[]) {
const indexFilename = rollupResult.find(r => r.isIndex).fileName;
return Promise.all(
outputTargets.map(async o => {
if (o.esmDir && o.esmIndexFile) {
const entryPointPath = config.buildEs5 && o.esmEs5Dir
? config.sys.path.join(o.esmEs5Dir, indexFilename)
: config.sys.path.join(o.esmDir, indexFilename);
const relativePath = relativeImport(config, o.esmIndexFile, entryPointPath);
const shortcutContent = `export * from '${relativePath}';`;
await compilerCtx.fs.writeFile(o.esmIndexFile, shortcutContent);
}
})
);
}
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
o => !!o.esmEs5Dir && !o.isBrowserBuild
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
o => !!o.esmDir && !o.isBrowserBuild
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
o => o.esmDir
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
o => o.esmEs5Dir
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
o => o.polyfills
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
dest => {
return Promise.all(files.map(f => {
return compilerCtx.fs.copyFile(
f.absPath,
config.sys.path.join(dest, 'polyfills', f.relPath));
}));
}
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
f => {
return compilerCtx.fs.copyFile(
f.absPath,
config.sys.path.join(dest, 'polyfills', f.relPath));
}
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
r => r.isIndex
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
async o => {
if (o.esmDir && o.esmIndexFile) {
const entryPointPath = config.buildEs5 && o.esmEs5Dir
? config.sys.path.join(o.esmEs5Dir, indexFilename)
: config.sys.path.join(o.esmDir, indexFilename);
const relativePath = relativeImport(config, o.esmIndexFile, entryPointPath);
const shortcutContent = `export * from '${relativePath}';`;
await compilerCtx.fs.writeFile(o.esmIndexFile, shortcutContent);
}
}
|
acuvera/stencil
|
src/compiler/component-lazy/generate-esm.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const result = await build({
absWorkingDir: process.cwd(),
write: false,
outdir: './test/fixture/dist',
bundle: true,
entryPoints: ['./test/fixtures/foo.jsx', './test/fixtures/bar.tsx'],
plugins: [vueJsx()],
external: ['vue'],
format: 'esm',
});
for (const file of result.outputFiles) {
expect(file.text).toMatchSnapshot(path.relative(process.cwd(), file.path));
}
}
|
chenjiahan/esbuild-plugin-vue-jsx
|
test/index.test.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const result = await build({
absWorkingDir: process.cwd(),
write: false,
outdir: './test/fixture/dist',
bundle: true,
entryPoints: ['./test/fixtures/foo.jsx'],
plugins: [
vueJsx({
pragma: 'myPragma',
}),
],
external: ['vue'],
format: 'esm',
});
for (const file of result.outputFiles) {
expect(file.text).toMatchSnapshot(path.relative(process.cwd(), file.path));
}
}
|
chenjiahan/esbuild-plugin-vue-jsx
|
test/index.test.ts
|
TypeScript
|
ArrowFunction
|
(缺省: 系统语言)
|
DragoncoinD/DANC-SRC
|
src/qt/locale/bitcoin_zh_CN.ts
|
TypeScript
|
ArrowFunction
|
(缺省: 12350 or testnet: 112350)
|
DragoncoinD/DANC-SRC
|
src/qt/locale/bitcoin_zh_CN.ts
|
TypeScript
|
ArrowFunction
|
(缺省: 125)
|
DragoncoinD/DANC-SRC
|
src/qt/locale/bitcoin_zh_CN.ts
|
TypeScript
|
ArrowFunction
|
(缺省: 100)
|
DragoncoinD/DANC-SRC
|
src/qt/locale/bitcoin_zh_CN.ts
|
TypeScript
|
ClassDeclaration
|
/**
* Token Manager of CloudPak for data.
*
* The Token Manager performs basic auth with a username and password
* to acquire CP4D tokens.
*/
export class Cp4dTokenManager extends JwtTokenManager {
protected requiredOptions = ['username', 'url'];
private username: string;
private password: string;
private apikey: string;
/**
* Create a new [[Cp4dTokenManager]] instance.
*
* @param {object} options Configuration options.
* @param {string} options.username The username used to obtain a bearer token.
* @param {string} options.password The password used to obtain a bearer token [required if apikey not specified].
* @param {string} options.apikey The API key used to obtain a bearer token [required if password not specified].
* @param {string} options.url The endpoint for CP4D token requests.
* @param {boolean} [options.disableSslVerification] A flag that indicates
* whether verification of the token server's SSL certificate should be
* disabled or not.
* @param {object<string, string>} [options.headers] Headers to be sent with every
* outbound HTTP requests to token services.
* @constructor
*/
constructor(options: Options) {
super(options);
this.tokenName = 'token';
if ((!options.password && !options.apikey) || (options.password && options.apikey)) {
throw new Error('Exactly one of `apikey` or `password` must be specified.');
}
validateInput(options, this.requiredOptions);
const tokenApiPath = '/v1/authorize';
// do not append the path if user already has
if (this.url && !this.url.endsWith(tokenApiPath)) {
this.url += tokenApiPath;
}
this.username = options.username;
this.password = options.password;
this.apikey = options.apikey;
}
protected requestToken(): Promise<any> {
// these cannot be overwritten
const requiredHeaders = {
'Content-Type': 'application/json',
};
const parameters = {
options: {
url: this.url,
body: {
username: this.username,
password: this.password,
api_key: this.apikey,
},
method: 'POST',
headers: extend(true, {}, this.headers, requiredHeaders),
rejectUnauthorized: !this.disableSslVerification,
},
};
return this.requestWrapperInstance.sendRequest(parameters);
}
}
|
IBM/node-sdk-core
|
auth/token-managers/cp4d-token-manager.ts
|
TypeScript
|
InterfaceDeclaration
|
/** Configuration options for CP4D token retrieval. */
interface Options extends JwtTokenManagerOptions {
/** The endpoint for CP4D token requests. */
url: string;
/** The username used to obtain a bearer token. */
username: string;
/** The password used to obtain a bearer token [required if apikey not specified]. */
password?: string;
/** The API key used to obtain a bearer token [required if password not specified]. */
apikey?: string;
}
|
IBM/node-sdk-core
|
auth/token-managers/cp4d-token-manager.ts
|
TypeScript
|
InterfaceDeclaration
|
// this interface is a representation of the response
// object from the CP4D authentication service
export interface CpdTokenData {
username: string;
role: string;
permissions: string[];
sub: string;
iss: string;
aud: string;
uid: string;
_messageCode_: string;
message: string;
accessToken: string;
}
|
IBM/node-sdk-core
|
auth/token-managers/cp4d-token-manager.ts
|
TypeScript
|
MethodDeclaration
|
protected requestToken(): Promise<any> {
// these cannot be overwritten
const requiredHeaders = {
'Content-Type': 'application/json',
};
const parameters = {
options: {
url: this.url,
body: {
username: this.username,
password: this.password,
api_key: this.apikey,
},
method: 'POST',
headers: extend(true, {}, this.headers, requiredHeaders),
rejectUnauthorized: !this.disableSslVerification,
},
};
return this.requestWrapperInstance.sendRequest(parameters);
}
|
IBM/node-sdk-core
|
auth/token-managers/cp4d-token-manager.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseDoubleValue(): DoubleValue {
return { value: 0 };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseFloatValue(): FloatValue {
return { value: 0 };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseInt64Value(): Int64Value {
return { value: Long.ZERO };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseUInt64Value(): UInt64Value {
return { value: Long.UZERO };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseInt32Value(): Int32Value {
return { value: 0 };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseUInt32Value(): UInt32Value {
return { value: 0 };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseBoolValue(): BoolValue {
return { value: false };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseStringValue(): StringValue {
return { value: '' };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function createBaseBytesValue(): BytesValue {
return { value: new Uint8Array() };
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
FunctionDeclaration
|
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
arr.forEach((byte) => {
bin.push(String.fromCharCode(byte));
});
return btoa(bin.join(''));
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
ArrowFunction
|
() => {
if (typeof globalThis !== 'undefined') return globalThis;
if (typeof self !== 'undefined') return self;
if (typeof window !== 'undefined') return window;
if (typeof global !== 'undefined') return global;
throw 'Unable to locate global object';
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
ArrowFunction
|
(b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
ArrowFunction
|
(bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
ArrowFunction
|
(byte) => {
bin.push(String.fromCharCode(byte));
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `double`.
*
* The JSON representation for `DoubleValue` is JSON number.
*/
export interface DoubleValue {
/** The double value. */
value: number;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `float`.
*
* The JSON representation for `FloatValue` is JSON number.
*/
export interface FloatValue {
/** The float value. */
value: number;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `int64`.
*
* The JSON representation for `Int64Value` is JSON string.
*/
export interface Int64Value {
/** The int64 value. */
value: Long;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `uint64`.
*
* The JSON representation for `UInt64Value` is JSON string.
*/
export interface UInt64Value {
/** The uint64 value. */
value: Long;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `int32`.
*
* The JSON representation for `Int32Value` is JSON number.
*/
export interface Int32Value {
/** The int32 value. */
value: number;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `uint32`.
*
* The JSON representation for `UInt32Value` is JSON number.
*/
export interface UInt32Value {
/** The uint32 value. */
value: number;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `bool`.
*
* The JSON representation for `BoolValue` is JSON `true` and `false`.
*/
export interface BoolValue {
/** The bool value. */
value: boolean;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `string`.
*
* The JSON representation for `StringValue` is JSON string.
*/
export interface StringValue {
/** The string value. */
value: string;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Wrapper message for `bytes`.
*
* The JSON representation for `BytesValue` is JSON string.
*/
export interface BytesValue {
/** The bytes value. */
value: Uint8Array;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
TypeAliasDeclaration
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type DeepPartial<T> = T extends Builtin
? T
: T extends Long
? string | number | Long
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
MethodDeclaration
|
encode(message: DoubleValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.value !== 0) {
writer.uint32(9).double(message.value);
}
return writer;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
MethodDeclaration
|
decode(input: _m0.Reader | Uint8Array, length?: number): DoubleValue {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDoubleValue();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.value = reader.double();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
MethodDeclaration
|
fromJSON(object: any): DoubleValue {
return {
value: isSet(object.value) ? Number(object.value) : 0,
};
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
MethodDeclaration
|
toJSON(message: DoubleValue): unknown {
const obj: any = {};
message.value !== undefined && (obj.value = message.value);
return obj;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
MethodDeclaration
|
fromPartial<I extends Exact<DeepPartial<DoubleValue>, I>>(object: I): DoubleValue {
const message = createBaseDoubleValue();
message.value = object.value ?? 0;
return message;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
MethodDeclaration
|
encode(message: FloatValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.value !== 0) {
writer.uint32(13).float(message.value);
}
return writer;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
MethodDeclaration
|
decode(input: _m0.Reader | Uint8Array, length?: number): FloatValue {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFloatValue();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.value = reader.float();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
}
|
PhirtualHQ/ts-proto
|
integration/simple-long/google/protobuf/wrappers.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.