Skip to content

Commit 6834524

Browse files
authored
Set up rollup for webchannel-wrapper (#8203)
* convert webchannel-wrapper package to use rollup * clean up rollup config * formatting
1 parent f3bc8f5 commit 6834524

File tree

8 files changed

+115
-112
lines changed

8 files changed

+115
-112
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "@firebase/webchannel-wrapper/bloom-blob",
33
"description": "Bloom filter related code from the Closure library.",
4-
"browser": "../dist/bloom-blob/bloom_blob_es2018.js",
5-
"module": "../dist/bloom-blob/bloom_blob_es2018.js",
4+
"main": "../dist/bloom-blob/bloom_blob_es2018.js",
5+
"browser": "../dist/bloom-blob/esm/bloom_blob_es2018.js",
6+
"module": "../dist/bloom-blob/esm/bloom_blob_es2018.js",
67
"esm5": "../dist/bloom-blob/bloom_blob_es5.js",
78
"typings": "../dist/bloom-blob/bloom_blob_types.d.ts"
89
}

packages/webchannel-wrapper/empty.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
/**
19+
* This package has no main entry point and only allows imports from its
20+
* two subpaths. This file is provided for the top-level package.json
21+
* "main" field to point to.
22+
*/
23+
24+
export default {};

packages/webchannel-wrapper/gulpfile.js

Lines changed: 0 additions & 81 deletions
This file was deleted.

packages/webchannel-wrapper/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@
33
"version": "0.10.7",
44
"description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
6-
"main": "dist/index.js",
7-
"module": "dist/index.js",
8-
"esm5": "dist/index.esm.js",
6+
"main": "empty.js",
97
"exports": {
108
"./webchannel-blob": {
119
"types": "./dist/webchannel-blob/webchannel_blob_types.d.ts",
12-
"default": "./dist/webchannel-blob/webchannel_blob_es2018.js"
10+
"require": "./dist/webchannel-blob/webchannel_blob_es2018.js",
11+
"esm5": "./dist/webchannel-blob/webchannel_blob_es5.js",
12+
"default": "./dist/webchannel-blob/esm/webchannel_blob_es2018.js"
1313
},
1414
"./bloom-blob": {
1515
"types": "./dist/bloom-blob/bloom_blob_types.d.ts",
16-
"default": "./dist/bloom-blob/bloom_blob_es2018.js"
16+
"require": "./dist/bloom-blob/bloom_blob_es2018.js",
17+
"es5": "./dist/bloom-blob/bloom_blob_es5.js",
18+
"default": "./dist/bloom-blob/esm/bloom_blob_es2018.js"
1719
},
1820
"./package.json": "./package.json"
1921
},
@@ -24,18 +26,16 @@
2426
],
2527
"scripts": {
2628
"dev": "watch 'yarn build' src",
27-
"build": "gulp",
29+
"build": "rollup -c",
2830
"test": "echo 'No test suite for webchannel-wrapper'",
2931
"test:ci": "echo 'No test suite for webchannel-wrapper'"
3032
},
3133
"license": "Apache-2.0",
3234
"devDependencies": {
3335
"closure-net": "git+https://github.com/google/closure-net.git#9844d60",
3436
"@rollup/plugin-commonjs": "21.1.0",
35-
"gulp": "4.0.2",
36-
"gulp-concat": "2.6.1",
37-
"gulp-sourcemaps": "3.0.0",
3837
"rollup": "2.79.1",
38+
"rollup-plugin-copy": "3.5.0",
3939
"rollup-plugin-sourcemaps": "0.6.3",
4040
"rollup-plugin-typescript2": "0.31.2",
4141
"typescript": "4.7.4"
@@ -45,7 +45,7 @@
4545
"type": "git",
4646
"url": "git+https://github.com/firebase/firebase-js-sdk.git"
4747
},
48-
"typings": "./dist/types.d.ts",
48+
"typings": "./dist/webchannel-blob/webchannel_blob_types.d.ts",
4949
"bugs": {
5050
"url": "https://github.com/firebase/firebase-js-sdk/issues"
5151
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 { join } from 'path';
19+
import copy from 'rollup-plugin-copy';
20+
import commonjs from '@rollup/plugin-commonjs';
21+
import typescriptPlugin from 'rollup-plugin-typescript2';
22+
import typescript from 'typescript';
23+
import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file';
24+
import pkg from './package.json';
25+
26+
const closureBlobsDir = '../../node_modules/closure-net/firebase/';
27+
28+
const es2017BuildPlugins = [
29+
copy({
30+
targets: [
31+
{
32+
src: join(closureBlobsDir, 'webchannel_blob_*.*'),
33+
dest: 'dist/webchannel-blob'
34+
},
35+
{ src: join(closureBlobsDir, 'bloom_blob_*.*'), dest: 'dist/bloom-blob' }
36+
]
37+
}),
38+
typescriptPlugin({
39+
typescript,
40+
tsconfigOverride: {
41+
compilerOptions: {
42+
target: 'es2017'
43+
}
44+
}
45+
}),
46+
commonjs()
47+
];
48+
49+
/**
50+
* ESM builds
51+
*/
52+
const esm2017Builds = [
53+
{
54+
input: join(closureBlobsDir, 'webchannel_blob_es2018.js'),
55+
output: {
56+
file: pkg.exports['./webchannel-blob'].default,
57+
format: 'es',
58+
sourcemap: true
59+
},
60+
plugins: [...es2017BuildPlugins, emitModulePackageFile()]
61+
},
62+
{
63+
input: join(closureBlobsDir, 'bloom_blob_es2018.js'),
64+
output: {
65+
file: pkg.exports['./bloom-blob'].default,
66+
format: 'es',
67+
sourcemap: true
68+
},
69+
plugins: [...es2017BuildPlugins, emitModulePackageFile()]
70+
}
71+
];
72+
73+
export default esm2017Builds;

packages/webchannel-wrapper/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"declaration": false,
55
"outDir": "dist",
66
"downlevelIteration": true,
7-
}
7+
},
8+
"include": ["../../node_modules/closure-net/firebase"]
89
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "@firebase/webchannel-wrapper/webchannel-blob",
33
"description": "Webchannel related code from the Closure library.",
4-
"browser": "../dist/webchannel-blob/webchannel_blob_es2018.js",
5-
"module": "../dist/webchannel-blob/webchannel_blob_es2018.js",
4+
"main": "../dist/webchannel-blob/webchannel_blob_es2018.js",
5+
"browser": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js",
6+
"module": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js",
67
"esm5": "../dist/webchannel-blob/webchannel_blob_es5.js",
78
"typings": "../dist/webchannel-blob/webchannel_blob_types.d.ts"
89
}

yarn.lock

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6127,13 +6127,6 @@ concat-stream@^2.0.0:
61276127
readable-stream "^3.0.2"
61286128
typedarray "^0.0.6"
61296129

6130-
concat-with-sourcemaps@^1.0.0:
6131-
version "1.1.0"
6132-
resolved "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz#d4ea93f05ae25790951b99e7b3b09e3908a4082e"
6133-
integrity sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==
6134-
dependencies:
6135-
source-map "^0.6.1"
6136-
61376130
config-chain@^1.1.11, config-chain@^1.1.12:
61386131
version "1.1.13"
61396132
resolved "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz"
@@ -9330,15 +9323,6 @@ gulp-cli@^2.2.0:
93309323
v8flags "^3.2.0"
93319324
yargs "^7.1.0"
93329325

9333-
9334-
version "2.6.1"
9335-
resolved "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz#633d16c95d88504628ad02665663cee5a4793353"
9336-
integrity sha512-a2scActrQrDBpBbR3WUZGyGS1JEPLg5PZJdIa7/Bi3GuKAmPYDK6SFhy/NZq5R8KsKKFvtfR0fakbUCcKGCCjg==
9337-
dependencies:
9338-
concat-with-sourcemaps "^1.0.0"
9339-
through2 "^2.0.0"
9340-
vinyl "^2.0.0"
9341-
93429326
93439327
version "7.0.0"
93449328
resolved "https://registry.npmjs.org/gulp-filter/-/gulp-filter-7.0.0.tgz"

0 commit comments

Comments
 (0)