Skip to content

Commit c1aca52

Browse files
committed
Merge branch 'ch-vertex-feature' of https://github.com/FirebasePrivate/firebase-js-sdk into ch-vertex-feature
2 parents 9ca1a4e + 61af236 commit c1aca52

17 files changed

+580
-2
lines changed

packages/firebase/package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,18 @@
215215
},
216216
"default": "./storage/dist/esm/index.esm.js"
217217
},
218+
"./vertexai": {
219+
"types": "./vertexai/dist/vertexai/index.d.ts",
220+
"node": {
221+
"require": "./vertexai/dist/index.cjs.js",
222+
"import": "./vertexai/dist/index.mjs"
223+
},
224+
"browser": {
225+
"require": "./vertexai/dist/index.cjs.js",
226+
"import": "./vertexai/dist/esm/index.esm.js"
227+
},
228+
"default": "./vertexai/dist/esm/index.esm.js"
229+
},
218230
"./compat/analytics": {
219231
"types": "./compat/analytics/dist/compat/analytics/index.d.ts",
220232
"node": {
@@ -399,7 +411,8 @@
399411
"@firebase/analytics-compat": "0.2.7",
400412
"@firebase/app-check": "0.8.2",
401413
"@firebase/app-check-compat": "0.3.9",
402-
"@firebase/util": "1.9.4"
414+
"@firebase/util": "1.9.4",
415+
"@firebase/vertexai": "0.0.1"
403416
},
404417
"devDependencies": {
405418
"rollup": "2.79.1",
@@ -431,7 +444,8 @@
431444
"remote-config",
432445
"messaging",
433446
"messaging/sw",
434-
"database"
447+
"database",
448+
"vertexai"
435449
],
436450
"typings": "empty.d.ts"
437451
}

packages/firebase/vertexai/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
export * from '@firebase/vertexai';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "firebase/vertexai",
3+
"main": "dist/index.cjs.js",
4+
"browser": "dist/esm/index.esm.js",
5+
"module": "dist/esm/index.esm.js",
6+
"typings": "dist/vertexai/index.d.ts"
7+
}

packages/vertexai/.eslintrc.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
const path = require('path');
18+
19+
module.exports = {
20+
extends: '../../config/.eslintrc.js',
21+
parserOptions: {
22+
project: 'tsconfig.json',
23+
// to make vscode-eslint work with monorepo
24+
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250
25+
tsconfigRootDir: __dirname
26+
},
27+
rules: {
28+
'import/no-extraneous-dependencies': [
29+
'error',
30+
{
31+
'packageDir': [path.resolve(__dirname, '../../'), __dirname]
32+
}
33+
]
34+
}
35+
};

packages/vertexai/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# @firebase/vertexai
2+

packages/vertexai/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# @firebase/vertexai
2+
3+
4+

packages/vertexai/api-extractor.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../config/api-extractor.json",
3+
// Point it to your entry point d.ts file.
4+
"mainEntryPointFilePath": "<projectFolder>/dist/src/index.d.ts",
5+
"dtsRollup": {
6+
"enabled": true,
7+
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
8+
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts"
9+
}
10+
}

packages/vertexai/karma.conf.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
const karmaBase = require('../../config/karma.base');
19+
20+
const files = [`src/**/*.test.ts`];
21+
22+
module.exports = function (config) {
23+
const karmaConfig = {
24+
...karmaBase,
25+
// files to load into karma
26+
files,
27+
// frameworks to use
28+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
29+
frameworks: ['mocha']
30+
};
31+
32+
config.set(karmaConfig);
33+
};
34+
35+
module.exports.files = files;

packages/vertexai/package.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"name": "@firebase/vertexai",
3+
"version": "0.0.1",
4+
"private": true,
5+
"description": "A template package for new firebase packages",
6+
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
7+
"engines": {
8+
"node": ">=18.0.0"
9+
},
10+
"main": "dist/index.cjs.js",
11+
"browser": "dist/esm/index.esm2017.js",
12+
"module": "dist/esm/index.esm2017.js",
13+
"esm5": "dist/index.esm5.js",
14+
"exports": {
15+
".": {
16+
"types": "./dist/src/index.d.ts",
17+
"node": {
18+
"require": "./dist/index.cjs.js",
19+
"import": "./dist/esm/index.esm2017.js"
20+
},
21+
"esm5": "./dist/index.esm5.js",
22+
"browser": {
23+
"require": "./dist/index.cjs.js",
24+
"import": "./dist/esm/index.esm2017.js"
25+
},
26+
"default": "./dist/esm/index.esm2017.js"
27+
},
28+
"./package.json": "./package.json"
29+
},
30+
"files": [
31+
"dist"
32+
],
33+
"scripts": {
34+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
35+
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
36+
"build": "rollup -c",
37+
"build:deps": "lerna run --scope @firebase/template --include-dependencies build",
38+
"dev": "rollup -c -w",
39+
"test": "run-p --npm-path npm lint test:all",
40+
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
41+
"test:all": "run-p --npm-path npm test:browser test:node",
42+
"test:browser": "karma start --single-run",
43+
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --config ../../config/mocharc.node.js"
44+
},
45+
"peerDependencies": {
46+
"@firebase/app": "0.x",
47+
"@firebase/app-types": "0.x"
48+
},
49+
"dependencies": {
50+
"@firebase/app-check-interop-types": "0.3.0",
51+
"@firebase/component": "0.6.5",
52+
"@firebase/logger": "0.4.0",
53+
"@firebase/util": "1.9.4",
54+
"tslib": "^2.1.0"
55+
},
56+
"license": "Apache-2.0",
57+
"devDependencies": {
58+
"@firebase/app": "0.9.28",
59+
"@rollup/plugin-json": "4.1.0",
60+
"rollup": "2.79.1",
61+
"rollup-plugin-replace": "2.2.0",
62+
"rollup-plugin-typescript2": "0.31.2",
63+
"typescript": "4.7.4"
64+
},
65+
"repository": {
66+
"directory": "packages/vertexai",
67+
"type": "git",
68+
"url": "https://github.com/firebase/firebase-js-sdk.git"
69+
},
70+
"bugs": {
71+
"url": "https://github.com/firebase/firebase-js-sdk/issues"
72+
},
73+
"typings": "dist/src/index.d.ts",
74+
"nyc": {
75+
"extension": [
76+
".ts"
77+
],
78+
"reportDir": "./coverage/node"
79+
}
80+
}

packages/vertexai/rollup.config.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/**
2+
* @license
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import json from '@rollup/plugin-json';
19+
import typescriptPlugin from 'rollup-plugin-typescript2';
20+
import replace from 'rollup-plugin-replace';
21+
import typescript from 'typescript';
22+
import pkg from './package.json';
23+
import { generateBuildTargetReplaceConfig } from '../../scripts/build/rollup_replace_build_target';
24+
import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file';
25+
26+
const deps = Object.keys(
27+
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
28+
);
29+
30+
const es5BuildPlugins = [
31+
typescriptPlugin({
32+
typescript
33+
}),
34+
json()
35+
];
36+
37+
const es2017BuildPlugins = [
38+
typescriptPlugin({
39+
typescript,
40+
tsconfigOverride: {
41+
compilerOptions: {
42+
target: 'es2017'
43+
}
44+
}
45+
}),
46+
json()
47+
];
48+
49+
const browserBuilds = [
50+
{
51+
input: 'src/index.ts',
52+
output: [{ file: pkg.esm5, format: 'es', sourcemap: true }],
53+
plugins: [
54+
...es5BuildPlugins,
55+
replace(generateBuildTargetReplaceConfig('esm', 5))
56+
],
57+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
58+
},
59+
{
60+
input: 'src/index.ts',
61+
output: {
62+
file: pkg.module,
63+
format: 'es',
64+
sourcemap: true
65+
},
66+
plugins: [
67+
...es2017BuildPlugins,
68+
replace(generateBuildTargetReplaceConfig('esm', 2017)),
69+
emitModulePackageFile()
70+
],
71+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
72+
},
73+
{
74+
input: 'src/index.ts',
75+
output: {
76+
file: './dist/index.cjs.js',
77+
format: 'cjs',
78+
sourcemap: true
79+
},
80+
plugins: [
81+
...es2017BuildPlugins,
82+
replace(generateBuildTargetReplaceConfig('cjs', 2017))
83+
],
84+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
85+
}
86+
];
87+
88+
// const nodeBuilds = [
89+
// {
90+
// input: 'index.node.ts',
91+
// output: [{ file: pkg.main, format: 'cjs', sourcemap: true }],
92+
// plugins: es2017BuildPlugins,
93+
// external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
94+
// },
95+
// {
96+
// input: 'index.node.ts',
97+
// output: [
98+
// { file: pkg.exports['.'].node.import, format: 'es', sourcemap: true }
99+
// ],
100+
// plugins: [...es2017BuildPlugins, emitModulePackageFile()],
101+
// external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
102+
// }
103+
// ];
104+
105+
export default [...browserBuilds];

0 commit comments

Comments
 (0)