25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

3 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /** @license
  2. * Copyright 2016 - present The Material Motion Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy
  6. * of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations
  14. * under the License.
  15. */
  16. const {
  17. readFileSync,
  18. writeFileSync,
  19. } = require('fs');
  20. const licenseText = `/** @license
  21. * Copyright 2016 - present The Material Motion Authors. All Rights Reserved.
  22. *
  23. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  24. * use this file except in compliance with the License. You may obtain a copy
  25. * of the License at
  26. *
  27. * http://www.apache.org/licenses/LICENSE-2.0
  28. *
  29. * Unless required by applicable law or agreed to in writing, software
  30. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  31. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  32. * License for the specific language governing permissions and limitations
  33. * under the License.
  34. */
  35. "use strict";`;
  36. const observableSource = readFileSync('./dist/IndefiniteObservable.js').toString();
  37. const wrapWithObserverSource = readFileSync('./dist/wrapWithObserver.js').toString();
  38. const symbolObservable = readFileSync('./third_party/symbol-observable/index.js').toString();
  39. writeFileSync(
  40. './dist/indefinite-observable.js',
  41. licenseText + '\n' +[
  42. observableSource.replace(licenseText, ''),
  43. wrapWithObserverSource.replace(licenseText, ''),
  44. ].join('\n\n').replace(
  45. /const symbol_observable_\d = require\("symbol-observable"\);/,
  46. symbolObservable
  47. ).replace(
  48. /const symbol_observable_\d = require\("symbol-observable"\);/,
  49. ''
  50. ).replace(
  51. /const wrapWithObserver_\d = require\(".\/wrapWithObserver"\);/g,
  52. ''
  53. ).replace(
  54. // strip comments
  55. /\n^\s*\/\/.*$/mg,
  56. ''
  57. ).replace(
  58. /symbol_observable_\d\.default/g,
  59. '$$observable'
  60. ).replace(
  61. /wrapWithObserver/g,
  62. '_wrapWithObserver'
  63. ).replace(
  64. /_wrapWithObserver_\d\.default/g,
  65. '_wrapWithObserver'
  66. ).replace(
  67. /Object\.defineProperty\(exports, "__esModule", \{ value: true \}\);/g,
  68. ''
  69. ).replace(
  70. /exports\.default = \w+;/g,
  71. ''
  72. ).replace(
  73. /\n\n+/g,
  74. '\n\n'
  75. // Use 2 spaces instead of 4 in the TypeScript output to keep comments wrapped
  76. // to 80 chars. If we ever try to use spaces for alignment (independent of
  77. // indentation), this regex will need to be revisited.
  78. ).replace(
  79. / /g,
  80. ' '
  81. )
  82. );