Skip to content

Set up rollup for webchannel-wrapper #8203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/webchannel-wrapper/bloom-blob/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@firebase/webchannel-wrapper/bloom-blob",
"description": "Bloom filter related code from the Closure library.",
"browser": "../dist/bloom-blob/bloom_blob_es2018.js",
"module": "../dist/bloom-blob/bloom_blob_es2018.js",
"main": "../dist/bloom-blob/bloom_blob_es2018.js",
"browser": "../dist/bloom-blob/esm/bloom_blob_es2018.js",
"module": "../dist/bloom-blob/esm/bloom_blob_es2018.js",
"esm5": "../dist/bloom-blob/bloom_blob_es5.js",
"typings": "../dist/bloom-blob/bloom_blob_types.d.ts"
}
7 changes: 7 additions & 0 deletions packages/webchannel-wrapper/empty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* This package has no main entry point and only allows imports from its
* two subpaths. This file is provided for the top-level package.json
* "main" field to point to.
*/

export default {};
81 changes: 0 additions & 81 deletions packages/webchannel-wrapper/gulpfile.js

This file was deleted.

20 changes: 10 additions & 10 deletions packages/webchannel-wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
"version": "0.10.7",
"description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application",
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
"main": "dist/index.js",
"module": "dist/index.js",
"esm5": "dist/index.esm.js",
"main": "empty.js",
"exports": {
"./webchannel-blob": {
"types": "./dist/webchannel-blob/webchannel_blob_types.d.ts",
"default": "./dist/webchannel-blob/webchannel_blob_es2018.js"
"require": "./dist/webchannel-blob/webchannel_blob_es2018.js",
"esm5": "./dist/webchannel-blob/webchannel_blob_es5.js",
"default": "./dist/webchannel-blob/esm/webchannel_blob_es2018.js"
},
"./bloom-blob": {
"types": "./dist/bloom-blob/bloom_blob_types.d.ts",
"default": "./dist/bloom-blob/bloom_blob_es2018.js"
"require": "./dist/bloom-blob/bloom_blob_es2018.js",
"es5": "./dist/bloom-blob/bloom_blob_es5.js",
"default": "./dist/bloom-blob/esm/bloom_blob_es2018.js"
},
"./package.json": "./package.json"
},
Expand All @@ -24,18 +26,16 @@
],
"scripts": {
"dev": "watch 'yarn build' src",
"build": "gulp",
"build": "rollup -c",
"test": "echo 'No test suite for webchannel-wrapper'",
"test:ci": "echo 'No test suite for webchannel-wrapper'"
},
"license": "Apache-2.0",
"devDependencies": {
"closure-net": "git+https://github.com/google/closure-net.git#9844d60",
"@rollup/plugin-commonjs": "21.1.0",
"gulp": "4.0.2",
"gulp-concat": "2.6.1",
"gulp-sourcemaps": "3.0.0",
"rollup": "2.79.1",
"rollup-plugin-copy": "3.5.0",
"rollup-plugin-sourcemaps": "0.6.3",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
Expand All @@ -45,7 +45,7 @@
"type": "git",
"url": "git+https://github.com/firebase/firebase-js-sdk.git"
},
"typings": "./dist/types.d.ts",
"typings": "./dist/webchannel-blob/webchannel_blob_types.d.ts",
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
}
Expand Down
76 changes: 76 additions & 0 deletions packages/webchannel-wrapper/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { join } from 'path';
import copy from 'rollup-plugin-copy';
import commonjs from '@rollup/plugin-commonjs';
import typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file';
import pkg from './package.json';

const closureBlobsDir = '../../node_modules/closure-net/firebase/';

const es2017BuildPlugins = [
copy({
targets: [
{ src: join(closureBlobsDir, 'webchannel_blob_*.*'), dest: 'dist/webchannel-blob'},
{ src: join(closureBlobsDir, 'bloom_blob_*.*'), dest: 'dist/bloom-blob'},
]
}),
typescriptPlugin({
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
}
}
}),
commonjs()
];

/**
* ESM builds
*/
const esm2017Builds = [
{
input: join(closureBlobsDir, 'webchannel_blob_es2018.js'),
output: {
file: pkg.exports['./webchannel-blob'].default,
format: 'es',
sourcemap: true
},
plugins: [
...es2017BuildPlugins,
emitModulePackageFile()
]
},
{
input: join(closureBlobsDir, 'bloom_blob_es2018.js'),
output: {
file: pkg.exports['./bloom-blob'].default,
format: 'es',
sourcemap: true
},
plugins: [
...es2017BuildPlugins,
emitModulePackageFile()
]
}
];

export default esm2017Builds;
3 changes: 2 additions & 1 deletion packages/webchannel-wrapper/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"declaration": false,
"outDir": "dist",
"downlevelIteration": true,
}
},
"include": ["../../node_modules/closure-net/firebase"]
}
5 changes: 3 additions & 2 deletions packages/webchannel-wrapper/webchannel-blob/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@firebase/webchannel-wrapper/webchannel-blob",
"description": "Webchannel related code from the Closure library.",
"browser": "../dist/webchannel-blob/webchannel_blob_es2018.js",
"module": "../dist/webchannel-blob/webchannel_blob_es2018.js",
"main": "../dist/webchannel-blob/webchannel_blob_es2018.js",
"browser": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js",
"module": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js",
"esm5": "../dist/webchannel-blob/webchannel_blob_es5.js",
"typings": "../dist/webchannel-blob/webchannel_blob_types.d.ts"
}
16 changes: 0 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6127,13 +6127,6 @@ concat-stream@^2.0.0:
readable-stream "^3.0.2"
typedarray "^0.0.6"

concat-with-sourcemaps@^1.0.0:
version "1.1.0"
resolved "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz#d4ea93f05ae25790951b99e7b3b09e3908a4082e"
integrity sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==
dependencies:
source-map "^0.6.1"

config-chain@^1.1.11, config-chain@^1.1.12:
version "1.1.13"
resolved "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz"
Expand Down Expand Up @@ -9330,15 +9323,6 @@ gulp-cli@^2.2.0:
v8flags "^3.2.0"
yargs "^7.1.0"

[email protected]:
version "2.6.1"
resolved "https://registry.npmjs.org/gulp-concat/-/gulp-concat-2.6.1.tgz#633d16c95d88504628ad02665663cee5a4793353"
integrity sha512-a2scActrQrDBpBbR3WUZGyGS1JEPLg5PZJdIa7/Bi3GuKAmPYDK6SFhy/NZq5R8KsKKFvtfR0fakbUCcKGCCjg==
dependencies:
concat-with-sourcemaps "^1.0.0"
through2 "^2.0.0"
vinyl "^2.0.0"

[email protected]:
version "7.0.0"
resolved "https://registry.npmjs.org/gulp-filter/-/gulp-filter-7.0.0.tgz"
Expand Down
Loading